Skip to content

Auto-track all bridge files #1462

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

Closed
wants to merge 1 commit into from
Closed

Auto-track all bridge files #1462

wants to merge 1 commit into from

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Mar 6, 2025

Adds cargo:rerun-if-changed=<path> for all files used by the bridge.

Note that when I went through all the rerun-if-changed cases, some of them did not include the .rs file - which may mean that even this repo is missing the needed tracking and this would fix those.

Fixes #1461

Adds `cargo:rerun-if-changed=<path>` for all files used by the bridge.
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous consideration of this in #26. I think it's better not to do this.

@dtolnay dtolnay closed this Mar 6, 2025
@nyurik
Copy link
Contributor Author

nyurik commented Mar 6, 2025

@dtolnay thx, i didn't see that PR. Do you think cxx could adapt the approach to other similar crates like static_files change_detection? It has a builder that allows to enable change detction print statements, and afterwards it finalizes it.

The issue with cxx is that it produces a cc::Build directly - making it somewhat inconvinient when additional configurations are needed. Perhaps we can introduce a new Bridge or CxxBuild struct?

    cxx_build::new()  // empty CxxBuild
        .add_bridge("src/map_renderer.rs") // add a single bridge file
        .change_detection() // enable "rerun-if-changed" printing
        .to_bridge()  // consume CxxBuild and create cc::Build -- prints rerun-if-changed here
        .includes(&include_dirs)  // Just as before - operations on the cc::Build
        .file("src/renderer/bridge.cpp")
        .flag_if_supported("-std=c++20")
        .compile("maplibre_rust_map_renderer_bindings");

@dtolnay
Copy link
Owner

dtolnay commented Mar 6, 2025

I don't think a separate builder type is justified. But it could be done using CFG.

@nyurik
Copy link
Contributor Author

nyurik commented Mar 6, 2025

Thx, I created #1463 to do that

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.

Automatically generate cargo:rerun-if-changed
2 participants