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

refactor(package): Simplify getting of published Manifest #13666

Merged
merged 5 commits into from
Mar 28, 2024

Conversation

epage
Copy link
Contributor

@epage epage commented Mar 28, 2024

What does this PR try to resolve?

This is a parallel effort to #13664 in an effort to #13456

This abstracts away the logic for getting the published version of Cargo.toml so we can more easily change the APIs that were previously exposed

How should we test and review this PR?

Additional information

@rustbot
Copy link
Collaborator

rustbot commented Mar 28, 2024

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-manifest Area: Cargo.toml issues Command-package Command-vendor S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 28, 2024
@@ -218,10 +218,32 @@ fn warn_on_unused(unused: &BTreeSet<String>, warnings: &mut Vec<String>) {
}
}

pub fn prepare_for_publish(me: &Package, ws: &Workspace<'_>) -> CargoResult<Package> {
Copy link
Member

Choose a reason for hiding this comment

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

While not necessary, I feel like prepare_for_publish and friends could be moved to a dedicated module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've been going back and forth on it, so I've just left it for now.

The main benefit for keeping it here is to keep awareness of it when adding new features to the manifest in the hope that we remember that they might impact this so we update it.

@weihanglo
Copy link
Member

The comment is not a blocker, so

@bors r+

Thanks for the refactor!

@bors
Copy link
Collaborator

bors commented Mar 28, 2024

📌 Commit ca706a4 has been approved by weihanglo

It is now in the queue for this repository.

@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 Mar 28, 2024
@bors
Copy link
Collaborator

bors commented Mar 28, 2024

⌛ Testing commit ca706a4 with merge a59aba1...

@bors
Copy link
Collaborator

bors commented Mar 28, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing a59aba1 to master...

@bors bors merged commit a59aba1 into rust-lang:master Mar 28, 2024
21 checks passed
@epage epage deleted the refactor-package branch March 28, 2024 21:51
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 29, 2024
Update cargo

8 commits in 499a61ce7a0fc6a72040084862a68b2603e770e8..a59aba136aab5510c16b0750a36cbd9916f91796
2024-03-26 04:17:04 +0000 to 2024-03-28 21:21:41 +0000
- refactor(package): Simplify getting of published Manifest (rust-lang/cargo#13666)
- fix(toml): Warn on unused workspace.dependencies keys on virtual workspaces (rust-lang/cargo#13664)
- docs: clarify `--locked` ensures Cargo uses dependency versions in lockfile (rust-lang/cargo#13665)
- RUSTC_WORKSPACE_WRAPPER: clarify docs (rust-lang/cargo#13648)
- fix(add): Preserve comments when updating simple deps (rust-lang/cargo#13655)
- fix(generate-lockfile): hold lock before querying index (rust-lang/cargo#13657)
- test: Add asserts to catch BorrowMutError's (rust-lang/cargo#13651)
- Publish test crates (rust-lang/cargo#13418)

r? ghost
@rustbot rustbot added this to the 1.79.0 milestone Mar 30, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 30, 2024
Update cargo

8 commits in 499a61ce7a0fc6a72040084862a68b2603e770e8..a59aba136aab5510c16b0750a36cbd9916f91796
2024-03-26 04:17:04 +0000 to 2024-03-28 21:21:41 +0000
- refactor(package): Simplify getting of published Manifest (rust-lang/cargo#13666)
- fix(toml): Warn on unused workspace.dependencies keys on virtual workspaces (rust-lang/cargo#13664)
- docs: clarify `--locked` ensures Cargo uses dependency versions in lockfile (rust-lang/cargo#13665)
- RUSTC_WORKSPACE_WRAPPER: clarify docs (rust-lang/cargo#13648)
- fix(add): Preserve comments when updating simple deps (rust-lang/cargo#13655)
- fix(generate-lockfile): hold lock before querying index (rust-lang/cargo#13657)
- test: Add asserts to catch BorrowMutError's (rust-lang/cargo#13651)
- Publish test crates (rust-lang/cargo#13418)

r? ghost
bors added a commit that referenced this pull request Apr 3, 2024
refactor(toml): Split out an explicit step to resolve `Cargo.toml`

### What does this PR try to resolve?

This builds on #13664 and #13666.   Currently, once we have deserialized `Cargo.toml`, we pass it to a large machinery (`to_real_manifest`, `to_virtual_manifest`) so that
- `Cargo.toml` is resolved
- `Summary` is created
- `Manifest` is created

This splits out the resolving of `Cargo.toml` which is mostly workspace inheritance today.

While splitting logic conjoined like this can be a bit messy in the short term, the hope is that overall this makes the logic easier to follow (more condensed, focused sections to view; more explicit inputs/outputs).

In particular, I hope that this will make it clearer and easier to shift more logic into the resolving step, specifically the inferring of build targets for #13456.

### How should we test and review this PR?

This is broken up into very small steps in the hope that it makes it easier to analyze a step.

### Additional information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-manifest Area: Cargo.toml issues Command-package Command-vendor 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.

5 participants