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

Propagate 'public' field on dependencies to the index #1685

Closed
wants to merge 3 commits into from

Conversation

Aaron1011
Copy link
Member

This implements the crates.io side of rust-lang/rust#44663

This is fully backwards-compatible - 'public' will default to 'false'
for old versions of Cargo that don't include it in their manifest

This implements the crates.io side of rust-lang/rust#44663

This is fully backwards-compatible - 'public' will default to 'false'
for old versions of Cargo that don't include it in their manifest
@Aaron1011 Aaron1011 force-pushed the feature/pub-priv-dep branch from 0cdf589 to 903e6be Compare March 21, 2019 06:09
@sgrif
Copy link
Contributor

sgrif commented Mar 21, 2019

I'd like to see an explicit test publishing a crate with a public dependency. Has the cargo side of this already been implemented? Can I test this today on nightly? Would also like to get someone from @rust-lang/cargo to confirm this is what they want in the index

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 21, 2019

I'd like to see an explicit test publishing a crate with a public dependency.

When I added the links, there was not a way to test this in crates.io's codebase. Has that changed?

Has the cargo side of this already been implemented? Can I test this today on nightly?

Not yet, I am hoping that that is where @Aaron1011 is heading next. We do have experimental support for it in the resolver, and this is the only bit of information we need there. There are some open questions about how this will interact with other functionality, that may make things more complicated.

One thought is that we can tell serde to not write the field if it is false, then the index won't know about this change until cargo learns to send it.

@Aaron1011
Copy link
Member Author

@Eh2406: I think it should be fine to start writing the public field to the index now. No matter what we do, there's going to be a long period of time where people are running a cargo build that doesn't understand it, since people don't always update immediately. Serde will ignore unknown fields unless explcitily configured otherwise, so this won't be a problem.

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 21, 2019

Yes, I agree. This won't break anything. What I was thinking is if we end up needing an escape hatch then this field may need to be and enum of public, private, escape, in which case not having public: false will make reading the index slightly easier.

@jtgeibel
Copy link
Member

I'm wondering, in general, what the expectations are on a timeline for enabling support in the official index. I think it would be best to set up an alternative registry to experiment with until the details are certain. I might be able to carry a patch in my staging area, if that helps.

Aaron1011 added a commit to Aaron1011/cargo that referenced this pull request Apr 26, 2019
This is part of rust-lang/rust#44663

This implements the 'frontend' portion of RFC 1977. Once PRs
rust-lang/rust#59335 and
rust-lang/crates.io#1685 are merged,
it will be possible to test the full public-private dependency feature:
marking a dependency a public, seeing exported_private_dependencies
warnings from rustc, and seeing pub-dep-reachability errors from Cargo.

Everything in this commit should be fully backwards-compatible - users
who don't enable the 'public-dependency' cargo feature won't notice any
changes.

Note that this commit does *not* implement the remaining two features of
the RFC:

* Choosing smallest versions when 'cargo publish' is run
* Turning exported_private_dependencies warnings into hard errors when
'cargo publish' is run

The former is a major change to Cargo's behavior, and should be done
in a separate PR with some kind of rollout plan.

The latter is described by the RFC as being enabled at 'some point in
the future'. This can be done via a follow-up PR.
bors added a commit to rust-lang/cargo that referenced this pull request Apr 26, 2019
Implement the 'frontend' of public-private dependencies

This is part of rust-lang/rust#44663

This implements the 'frontend' portion of [RFC 1977](https://github.com/rust-lang/rfcs/blob/master/text/1977-public-private-dependencies.md). Once PRs rust-lang/rust#59335 and rust-lang/crates.io#1685 are merged,
it will be possible to test the full public-private dependency feature:
marking a dependency a public, seeing exported_private_dependencies
warnings from rustc, and seeing pub-dep-reachability errors from Cargo.

Everything in this commit should be fully backwards-compatible - users
who don't enable the 'public-dependency' cargo feature won't notice any
changes.

Note that this commit does *not* implement the remaining two features of
the RFC:

* Choosing smallest versions when 'cargo publish' is run
* Turning exported_private_dependencies warnings into hard errors when 'cargo publish' is run

The former is a major change to Cargo's behavior, and should be done in a separate PR with some kind of rollout plan.

The latter is described by the RFC as being enabled at 'some point in the future'. This can be done via a follow-up PR.
@Aaron1011
Copy link
Member Author

Now that the Cargo frontend has been merged, it's possible to test this with Cargo.

@jtgeibel
Copy link
Member

jtgeibel commented May 1, 2019

Thanks @Aaron1011. If I understand your comment in rust-lang/rust#44663 (comment) correctly, there is a remaining bullet point to resolve before merging this. If practical, I would also like to wait until this feature is stable on nightly before allowing anyone to publicly publish crates using this feature to the index. Does that seem okay, or are there reasons to merge this sooner than that?

@Aaron1011
Copy link
Member Author

@jtgeibel: By 'stable on nightly', do you mean waiting until the first bullet point (deciding how to handle renamed dependencies) is dealt with? That sounds reasonable to me.

@Aaron1011
Copy link
Member Author

As I brought up in rust-lang/cargo#6129 (comment), I don't think that handling renamed dependencies will require changes to the index format.

@Aaron1011
Copy link
Member Author

@jtgeibel: I don't think this should be considered blocked anymore

@Aaron1011
Copy link
Member Author

Is there anything that I can do to help move this along?

@sgrif
Copy link
Contributor

sgrif commented Jun 5, 2019

Having another member of the cargo team sign off on this would be helpful. We also still need some form of test for this

@alexcrichton
Copy link
Member

We discussed this at the Cargo triage meeting yesterday, and my own personal conclusion is that we're probably not ready to land this at this time. After talking more about the current state of the feature and what it looks like, this is definitely sufficient for exactly what's implemented today but I'm not so certain we want to commit to this just yet.

There were a number of ergonomic concerns about the feature today and the rollout plan which makes us hesistant enough that we're pretty unlikely to stabilize the feature as-is, and changes to the feature are likely going to require changes to the index format, in which case would require updates here. Changes to the index aren't catastrophic, but we figured should be done carefully and avoided if possible.

For the actual feature and rollout though, I think it's probably best to continue discussion on the Cargo tracking issue, and I think @Eh2406 you were gonna write up some more information there?

@carols10cents
Copy link
Member

I'm a little unclear on the current status of this effort after reading through the tracking issue, but given these comments here:

  • we're probably not ready to land this at this time
  • we're pretty unlikely to stabilize the feature as-is and changes to the feature are likely going to require changes to the index format, in which case would require updates here

I'm going to close this PR for now. Please reopen this PR or open a new PR when the path forward is clearer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants