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

Use only predefined environment variables to compute name prefixes. #1975

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

briansmith
Copy link
Owner

Instead of having build.rs set a custom environment variable, just compute the value directly from environment variables that are guaranteed to be set. This way, non-Cargo build systems can avoid duplicating this custom logic.

Move the consistency check of links and the package version so that the check is also done during pregeneration.

Use read_env_var() for the relevant environment variables so that build.rs emits cargo:rerun-if-env-changed, as it was noticed that Cargo otherwise doesn't seem to rerun the build script when the Cargo.toml values are changed.

@briansmith briansmith self-assigned this Feb 29, 2024
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.29%. Comparing base (cecbbd9) to head (22bbb3b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1975   +/-   ##
=======================================
  Coverage   96.29%   96.29%           
=======================================
  Files         136      136           
  Lines       20677    20677           
  Branches      226      226           
=======================================
  Hits        19910    19910           
  Misses        733      733           
  Partials       34       34           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

It seems like Cargo will rerun the build script automatically if some
parts of Cargo.toml changes, but it isn't clear which changes to which
parts trigger a rerun. Avoid depending on that by emitting
"cargo:rerun-if-env-changed" for every variable read.
Instead of having build.rs set a custom environment variable, just
compute the value directly from environment variables that are
guaranteed to be set. This way, non-Cargo build systems can avoid
duplicating this custom logic.

Move the consistency check of `links` and the package version so that
the check is also done during pregeneration.

Use `read_env_var()` for the relevant environment variables so that
build.rs emits `cargo:rerun-if-env-changed`, as it was noticed that
Cargo otherwise doesn't seem to rerun the build script when the
Cargo.toml values are changed.
@briansmith briansmith merged commit 23dcc8f into main Mar 1, 2024
143 checks passed
@briansmith briansmith deleted the b/avoid-cargo-env branch March 1, 2024 00:53
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

1 participant