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

Dont generate the bindings in src/bindings.rs #10

Closed
pragmatrix opened this issue Feb 8, 2019 · 5 comments · Fixed by #798
Closed

Dont generate the bindings in src/bindings.rs #10

pragmatrix opened this issue Feb 8, 2019 · 5 comments · Fixed by #798
Labels
blocked build Related to building this repository.

Comments

@pragmatrix
Copy link
Member

This messes up compilation dependency tracking and also - I think - produces stale IDE results in dependent projects when cargo check is used and INIT_SKIA is not set, because the cargo project is always out of date after the bindings are regenerated. I also assume that's why the check for INIT_SKIA exists in the build.rs script.

I've tried the following:

Next step is to patch mtime of the generated file src/bindings.rs in the build.rs script. This can only be a temporary solution primarily targeted for IDE support, because AFAIK we can not write in the src directory for cargo package generation anyway.

@pragmatrix
Copy link
Member Author

Update: The stale IDE results were caused by IntelliJs Rust plugin when cargo check was enabled, and were fixed in a recent nightly. Also the macro support was improved, so may be we can take another look at using include! here or just wait until rust-analyzer is in a reasonable stable state, because although I got used to CLion, personally I would prefer to use VSCode again.

Anyway, if we want to suppport different feature sets for the binding generation, putting bindings.rs into the src/ directory will produce problems for dependent projects.

To support a different skia configuration, I also started to experiment to put the complete skia / ninja output into OUT_DIR, which works rather fine and cargo clean does now what it's supposed to do.

Closing this because the original problem does not appear anymore. We may need to takle this problem again if we want to support multiple features.

@pragmatrix
Copy link
Member Author

I'm reopening this, because Rust / Cargo release version 1.33 might affect us: https://github.com/rust-lang/rust/blob/stable/RELEASES.md#cargo

@pragmatrix
Copy link
Member Author

pragmatrix commented Jul 3, 2019

This issue seems to stick with us until it gets fixed properly. Currently, there are two problems caused by it:

  • The crate verfication of skia-bindings fails, because it detects that skia-bindings/src/bindings.rs was modified in the build process.
  • A cargo build with a different target causes skia-bindings to be recompiled, but not the src/bindings.rs file to be regenerated which might cause linker errors. This can be reproduced by building a darwin target on a macOS machine and switching to aarch64-linux-android after that.

Blocked by:

@ghost
Copy link

ghost commented Jan 5, 2021

Is this in any way related to how skia-bindings redownloads Skia every time I change a compiler flag? If not, should I open a separate issue for that?

@pragmatrix
Copy link
Member Author

@JackRedstonia Sounds unrelated, every time the build scripts runs from within a crate, binaries are downloaded. I suppose that there should be a test if matching binaries already exist.

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

Successfully merging a pull request may close this issue.

1 participant