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

Fix links vars showing up for testing packages #9065

Merged
merged 1 commit into from
Jan 12, 2021

Conversation

alexcrichton
Copy link
Member

If a package is tested and the library for the package wasn't built
(e.g. only tested or it wasn't present) then the links env vars from
dependencies weren't showing up to the build script by accident. This
was an accidental regression from #8969.

The intention of #8969 was to exclude connections to build scripts
connected via dev-dependencies, but it only applied a heuristic because
the unit graph doesn't retain information about dev-dependencies. The
fix here is to instead actually retain information about
dev-dependencies which is only used for constructing the unit graph and
connecting build script executions to one another.

Closes #9063

@rust-highfive
Copy link

r? @ehuss

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 11, 2021

#[cargo_test]
fn test_with_dep_metadata() {
// rerun-if-changed of a directory should rerun if any file in the directory changes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy/paste error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, indeed!

If a package is tested and the library for the package wasn't built
(e.g. only tested or it wasn't present) then the `links` env vars from
dependencies weren't showing up to the build script by accident. This
was an accidental regression from rust-lang#8969.

The intention of rust-lang#8969 was to exclude connections to build scripts
connected via dev-dependencies, but it only applied a heuristic because
the unit graph doesn't retain information about dev-dependencies. The
fix here is to instead actually retain information about
dev-dependencies which is only used for constructing the unit graph and
connecting build script executions to one another.

Closes rust-lang#9063
@ehuss
Copy link
Contributor

ehuss commented Jan 12, 2021

Ugh, I see what you were saying about this on Zulip. I've been trying various different approaches such as fundamentally revisiting #5711, but every solution I can think of is as complex as this or worse. This is a precarious path to go down, where it will be near impossible to understand this file in the future. That being said, we can't remove or redesign these features from Cargo, and I don't see many other options. At least things are pretty well commented. 😄

@bors r+

@alexcrichton Do you want to backport this to beta?

@bors
Copy link
Collaborator

bors commented Jan 12, 2021

📌 Commit 21a5efb has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 12, 2021
@bors
Copy link
Collaborator

bors commented Jan 12, 2021

⌛ Testing commit 21a5efb with merge b64d668...

@alexcrichton
Copy link
Member Author

Indeed yeah the code at this point definitely doesn't speak for itself and we're really only left to rely on comments and tests at this point... I wish I knew a better way out of this quagmire!

Sure yeah though, I'll do the backport

@bors
Copy link
Collaborator

bors commented Jan 12, 2021

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing b64d668 to master...

@bors bors merged commit b64d668 into rust-lang:master Jan 12, 2021
bors added a commit that referenced this pull request Jan 12, 2021
[BETA] Fix `links` vars showing up for testing packages

This is a beta backport of #9065
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 15, 2021
Update cargo

10 commits in 329895f5b52a358e5d9ecb26215708b5cb31d906..a73e5b7d567c3036b296fc6b33ed52c5edcd882e
2021-01-06 00:01:52 +0000 to 2021-01-12 23:45:39 +0000
- Sort available binaries when multiple (rust-lang/cargo#9066)
- Fix misspelling of environment variable (rust-lang/cargo#9067)
- Remove statement that opt-level 0 turns on debug (rust-lang/cargo#9070)
- Fix `links` vars showing up for testing packages (rust-lang/cargo#9065)
- Fix unit_for computation on proc-macros in shared workspace. (rust-lang/cargo#9059)
- Document `could not find the github team` error on `cargo owner --add` (rust-lang/cargo#9000)
- Unstable section of cargo/config.toml takes bools (rust-lang/cargo#9057)
- [doc] add note about empty environment variables for missing manifest keys (rust-lang/cargo#9053)
- another round of clippy lint fixes (rust-lang/cargo#9051)
- Updated display message of cargo metadata --help (rust-lang/cargo#9050)
@ehuss ehuss modified the milestones: 1.51.0, 1.50.0 Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEP_* env variable not set in nightly test run
4 participants