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

Parse settings from Cargo metadata #302

Merged
merged 6 commits into from
Dec 15, 2020
Merged

Parse settings from Cargo metadata #302

merged 6 commits into from
Dec 15, 2020

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Nov 23, 2020

This change enables settings to be parsed from Cargo metadata to take full advantage of the changes introduced in #274. This also improves upon the changes in #276 to allow users to specify CrateSettings to be specified in the relevant packages when dealing with workspace projects

This also contains updates to the top level README. A rendering can be found here

Blocked by #306

@acmcarther
Copy link
Member

Why does this CL have a 57k LOC added diff?

@UebelAndre
Copy link
Collaborator Author

@acmcarther This PR contains changes from others I'm hoping to get through before it. So it'll appear large until then. I'll be marking the PRs ready for review in the order I'd planned on rolling them out but you can also follow the chain in the tickets noted in the description.

@UebelAndre
Copy link
Collaborator Author

Why does this CL have a 57k LOC added diff?

But to directly answer that. It's due to the changes in #300 where cargo metadata dumps were added for testing. Unfortunately, some tests use very large packages resulting in large json files.

@UebelAndre
Copy link
Collaborator Author

Why does this CL have a 57k LOC added diff?

Much smaller now that #300 is not in this CL. This will also continue to shrink.

@UebelAndre
Copy link
Collaborator Author

Documentation has been updated in this PR as per a discussion here: #277 (comment)

README.md Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator Author

@acmcarther This is a draft PR. I open draft PRs mainly for reference and high level conversation. The state of most of my changes right now are that they're based on other changes that I plan to open PRs for (if they're not open already). This change is 2 PRs ahead of master.

@acmcarther
Copy link
Member

I came here because you referenced this PR in the other PR as an explanation of a design decision.

@UebelAndre
Copy link
Collaborator Author

I came here because you referenced this PR in the other PR as an explanation of a design decision.

Yeah, my message was in response to #302 (comment)

Which I'm happy to talk about but not quite ready to do so since the reasoning for that is in another PR. But I thought it'd be valuable for you to see the state of things here at a high level.

@UebelAndre
Copy link
Collaborator Author

Just a heads up, I'm going to be rebasing this branch. I will stop rebasing once this is marked "Ready for review".

@UebelAndre UebelAndre marked this pull request as ready for review December 11, 2020 18:05
@UebelAndre
Copy link
Collaborator Author

@acmcarther This PR is now ready for review.

Copy link
Member

@acmcarther acmcarther left a comment

Choose a reason for hiding this comment

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

LGTM, just a few comments

README.md Show resolved Hide resolved
impl/src/metadata.rs Show resolved Hide resolved
impl/src/settings.rs Show resolved Hide resolved
// Check for duplication errors
if duplicate_binary_deps.len() > 0 {
return Err(anyhow!(
"Duplicate `raze.binary_deps` values detected accross various crates: {:?}",
Copy link
Member

Choose a reason for hiding this comment

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

Hmm..

I think we should permit duplicate binary deps provided they match. This serves as a record for humans as well, and they might be confused having to decide which toml to put the binary dependency in.

(i dont feel strongly about this)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think if something is used by multiple packages, then it should go in workspaces' metadata. I think allowing users to specify it in multiple packages promotes some sloppy copy/pasting of configurations. I'd like for this to be well defined. I'd opt to leave it as is but if you feel stronger about this I can make the change since the benefit of your suggestion is that users can see more relevant information about their package.

PS: Ultimately, my hope is that the need for this functionality will some day go away (if Cargo ever figures out what it wants to do about these things).

Copy link
Member

@acmcarther acmcarther Dec 15, 2020

Choose a reason for hiding this comment

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

I think the right answer here depends on the expected mental model. If users associate the binary dependency with an individual sub-crate, then it might make more sense for this setting to permit duplicates, since you might have multiple crates using the given binary dependency. If they view it as boilerplate for raze which is mostly independent of the subcrate in question then it might make more sense to prohibit duplicates (though, in that case I'd argue it ought to be required to be in the workspace root toml).

I still don't feel strongly about this though, so final decision up to you (though I'd recommend trying to find a place to document this restriction in the README if it isn't already documented).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've updated the documentation. I do think you're instincts are toward the better overall outcome here, but I would rather keep the functionality of binary dependencies very minimal and find a way to remove it. Maybe I'll try to drive some RFCs forward in cargo to try and get this resolved.

Anyway, I think it's a much smaller change to make interactions here more elegant and I'd love to find out that people feel strongly enough about it to make a PR for it 😄

impl/src/settings.rs Outdated Show resolved Hide resolved
impl/src/settings.rs Outdated Show resolved Hide resolved
impl/src/settings.rs Outdated Show resolved Hide resolved
@UebelAndre
Copy link
Collaborator Author

@acmcarther two open questions for you but otherwise ready for your eyes again.

@UebelAndre
Copy link
Collaborator Author

UebelAndre commented Dec 15, 2020

@acmcarther I think I've addressed all the open conversations. Please let me know if I missed anything or if you have any other feedback 🙏

edit: Also, ready for review.

@acmcarther
Copy link
Member

LGTM

@acmcarther acmcarther merged commit 52f20dd into google:master Dec 15, 2020
@UebelAndre UebelAndre deleted the settings branch December 15, 2020 04:19
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

2 participants