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

Crate is rebuilt on every build due to rerun-if-env-changed #220

Closed
joehoyle opened this issue Jan 31, 2023 · 4 comments · Fixed by #232
Closed

Crate is rebuilt on every build due to rerun-if-env-changed #220

joehoyle opened this issue Jan 31, 2023 · 4 comments · Fixed by #232

Comments

@joehoyle
Copy link
Collaborator

As mentioned in #210 (comment), every time I run cargo check etc then the ext-php-rs build script is run, due to the use of rerun-if-env-changed.

I tracked it down specifically to the PATH env var -- PHP and PHP_CONFIG don't cause issues (though those env vars are not set). My $PATH is stable, so it's not like it's changing. (unless the build script it's self is setting something).

@rmccue
Copy link
Contributor

rmccue commented Feb 24, 2023

Ran through debugging this with @joehoyle, this actually turns out to be due to:

println!("cargo:rerun-if-changed=Cargo.lock");

When this crate is loaded as a dependency, there's no local Cargo.lock (as it's in the root crate instead); this causes it to rebuild every time due to rust-lang/cargo#6003

@ptondereau
Copy link
Collaborator

Ran through debugging this with @joehoyle, this actually turns out to be due to:

println!("cargo:rerun-if-changed=Cargo.lock");

When this crate is loaded as a dependency, there's no local Cargo.lock (as it's in the root crate instead); this causes it to rebuild every time due to rust-lang/cargo#6003

I've introduced that cargo flag recently, but I forgot to remove it. If you have the time, feel free to submit a PR to remove it! I'll be glad to merge it quickly. Thank you for this investigation

@rmccue
Copy link
Contributor

rmccue commented Feb 24, 2023

Should we retain it behind a flag? Might be useful for debugging/development purposes.

@ptondereau
Copy link
Collaborator

Should we retain it behind a flag? Might be useful for debugging/development purposes.

Let just remove it for the moment and see later if we can provide a better solution

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 a pull request may close this issue.

3 participants