Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move cdp build step into an integration test #80

Merged
merged 3 commits into from Dec 16, 2021
Merged

Conversation

djc
Copy link
Contributor

@djc djc commented Dec 16, 2021

I noticed that chromiumoxide is one of the slowest crates to compile in our dependency graph. This is mainly due to the amount of generated code, but the process by which the generated code is included can also be changed to limit impact on downstream compile times; this is a first step towards improving the situation.

Replace the build script with an integration test that fails if the
generated code is out of date. This has several advantages:

  • No need for downstream users to compile the build script
  • No need for downstream users to compile the pdl crate
  • No need for downstream users to run the code generation step
  • The generated code is more usable in an IDE
  • CI will fail if the generated code is out of date

The main downside is probably that the generated code is kept in
the repository, but this seems of relatively minimal impact,
especially if the code generator/source files don't change often.

@djc
Copy link
Contributor Author

djc commented Dec 16, 2021

CI is suffering from the yanked futures crate here, maybe review/merge #79 first?

@mattsse
Copy link
Owner

mattsse commented Dec 16, 2021

good call, this is certainly reasonable given that it takes quite a bit of time..

The main downside is probably that the generated code is kept in
the repository, but this seems of relatively minimal impact,
especially if the code generator/source files don't change often.

I agree that this is negligible and am in favor of merging this.

something's off in the CI with the futures dependency, maybe that version got yanked?

In the normal Rust module system, a module is represented in the
filesystem by a file of the same name. With the previous setup,
the generated code was saved in `<target_mod>.rs`, with that
file containing another `pub mod <target_mod> { .. }` inside.
Here we remove the outer containing module from the generated code
and instead add it in the cdp crate root, where the generated code
is included, to keep the same paths.
Replace the build script with an integration test that fails if the
generated code is out of date. This has several advantages:

* No need for downstream users to compile the build script
* No need for downstream users to compile the pdl crate
* No need for downstream users to run the code generation step
* The generated code is more usable in an IDE
* CI will fail if the generated code is out of date

The main downside is probably that the generated code is kept in
the repository, but this seems of relatively minimal impact,
especially if the code generator/source files don't change often.
@mattsse mattsse merged commit 388cb29 into mattsse:main Dec 16, 2021
@djc
Copy link
Contributor Author

djc commented Dec 16, 2021

Thanks for the review! If you could publish a fresh release, that would be great.

@mattsse
Copy link
Owner

mattsse commented Dec 16, 2021

just published 0.3.4 release
way faster :), thanks!

@djc
Copy link
Contributor Author

djc commented Dec 16, 2021

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants