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

Rework planning to use resolve tree and not packages (updated) #425

Merged
merged 4 commits into from
Aug 9, 2021
Merged

Rework planning to use resolve tree and not packages (updated) #425

merged 4 commits into from
Aug 9, 2021

Conversation

sayrer
Copy link
Contributor

@sayrer sayrer commented Jul 5, 2021

This addresses @dfreese's comments in #282 and preserves @GregBowyer's commit in the history.

GregBowyer and others added 3 commits April 23, 2021 17:21
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes #241, fixes #269, fixes #270, resolves #144, resolves #187
@sayrer sayrer requested a review from acmcarther as a code owner July 5, 2021 17:08
@google-cla
Copy link

google-cla bot commented Jul 5, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Jul 5, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@sayrer
Copy link
Contributor Author

sayrer commented Jul 5, 2021

I ran this patch on a large repo, and it seems to produce identical output to #282.

Copy link
Collaborator

@dfreese dfreese left a comment

Choose a reason for hiding this comment

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

LGTM, one comment and associated question. Thanks for following up on this.

The google CLA bot will require both you and @GregBowyer to sign off, since it requires consent from all commit authors. Squashing it down may be a relevant option here.

@@ -92,7 +95,7 @@ pub struct CrateDependencyContext {
// build_data_dependencies can only be set when using cargo-raze as a library at the moment.
pub build_data_dependencies: Vec<BuildableDependency>,
pub dev_dependencies: Vec<BuildableDependency>,
pub aliased_dependencies: Vec<DependencyAlias>,
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you comment on the meaning of the string here?

Not necessary, but a struct, holding a string may provide more meaning long term if that's fairly straight-forward.

Copy link
Contributor Author

@sayrer sayrer Jul 12, 2021

Choose a reason for hiding this comment

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

I'm happy to work on this a bit more, but I might suggest that it would be easier to commit this change and iterate, or just let you change my patch to your satisfaction in a followup. That way, we don't get delayed by asynchronous conversations. Your comments are reasonable, but the back and forth conversation seems too costly for things that don't impact correctness.

The pattern here is something I would do if I reviewed a coworker's code on a daily basis, and I wanted to make that process smoother going forward. But I think I'll only be sending cargo-raze patches here and there.

As for the CLAs, mine is signed. There was also a warning about this in #282 regarding @GregBowyer's sign-off.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was mostly to make sure I understood intent correctly, and I assumed adding a comment would be a pretty quick change on your end.

Suggested change
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,
/// Aliased dependencies, sorted/keyed by their `target` name in the `DependencyAlias` struct.
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,

@GregBowyer
Copy link
Contributor

@googlebot I consent.

@@ -92,7 +95,7 @@ pub struct CrateDependencyContext {
// build_data_dependencies can only be set when using cargo-raze as a library at the moment.
pub build_data_dependencies: Vec<BuildableDependency>,
pub dev_dependencies: Vec<BuildableDependency>,
pub aliased_dependencies: Vec<DependencyAlias>,
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It was mostly to make sure I understood intent correctly, and I assumed adding a comment would be a pretty quick change on your end.

Suggested change
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,
/// Aliased dependencies, sorted/keyed by their `target` name in the `DependencyAlias` struct.
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,

@dfreese dfreese merged commit 78617c1 into google:main Aug 9, 2021
dfreese pushed a commit to dfreese/cargo-raze that referenced this pull request Aug 9, 2021
dfreese pushed a commit that referenced this pull request Aug 9, 2021
illicitonion pushed a commit that referenced this pull request Aug 25, 2021
This fixes `crates.bzl` never having any crates defined in the `_PROC_MACRO_DEPENDENCIES` map.

This fixes a regression from #425 (or #282) and regenerates cargo-raze outputs (which should have been done on the merged commit). 

This also fixes a regression in how BUILD files were rendered, resulting in buildifier defects. I cherry picked a change I had an another branch which is ahead of `main` and contains the fix. This change includes #393

Finally, this fixes another regression where `extra_aliased_targets` was being ignored.
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

3 participants