Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow git+version dependency to be published. #7237

Merged
merged 1 commit into from
Aug 19, 2019

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Aug 12, 2019

This allows you to publish a dependency that specifies both git and version. The git value will be stripped out, just like a path dependency.

My original intent was to improve the error message, which was very confusing. I figured I might as well make git behave the same as path. I can change this PR to just reword the error instead of changing behavior if the new behavior isn't desired.

Closes #6738

@rust-highfive
Copy link

r? @nrc

(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 Aug 12, 2019
@alexcrichton alexcrichton added the T-cargo Team: Cargo label Aug 12, 2019
@alexcrichton
Copy link
Member

Sounds reasonable to me! This is an expansion of stable behavior, so I'd like to check in with other folks as well

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Aug 12, 2019

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Aug 12, 2019
@bors
Copy link
Contributor

bors commented Aug 12, 2019

☔ The latest upstream changes (presumably #7239) made this pull request unmergeable. Please resolve the merge conflicts.

@ehuss ehuss force-pushed the git-with-version branch from da8aef4 to df639b9 Compare August 12, 2019 16:07
@ymjing
Copy link

ymjing commented Aug 13, 2019

Once this is merged, I would be able to publish MesaLink on crates.io. This would benefit alexcrichton/curl-rust#280, too.

@rfcbot rfcbot added the final-comment-period FCP — a period for last comments before action is taken label Aug 14, 2019
@rfcbot
Copy link
Collaborator

rfcbot commented Aug 14, 2019

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period An FCP proposal has started, but not yet signed off. label Aug 14, 2019
@Drevoed
Copy link

Drevoed commented Aug 19, 2019

Is this going to be merged soon?

@ehuss
Copy link
Contributor Author

ehuss commented Aug 19, 2019

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Aug 19, 2019

📌 Commit df639b9a563d49d8036b764f8211c662eaa9fb70 has been approved by alexcrichton

@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 Aug 19, 2019
@bors
Copy link
Contributor

bors commented Aug 19, 2019

⌛ Testing commit df639b9a563d49d8036b764f8211c662eaa9fb70 with merge d565c1e0340aa70f12c212d16826e60233bf72a5...

@bors
Copy link
Contributor

bors commented Aug 19, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 19, 2019
@ehuss ehuss force-pushed the git-with-version branch from df639b9 to d682439 Compare August 19, 2019 16:40
@ehuss
Copy link
Contributor Author

ehuss commented Aug 19, 2019

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Aug 19, 2019

📌 Commit d682439 has been approved by alexcrichton

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 19, 2019
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 19, 2019
@bors
Copy link
Contributor

bors commented Aug 19, 2019

⌛ Testing commit d682439 with merge 93660b0...

bors added a commit that referenced this pull request Aug 19, 2019
Allow git+version dependency to be published.

This allows you to publish a dependency that specifies both `git` and `version`. The `git` value will be stripped out, just like a `path` dependency.

My original intent was to improve the error message, which was very confusing. I figured I might as well make `git` behave the same as `path`. I can change this PR to just reword the error instead of changing behavior if the new behavior isn't desired.

Closes #6738
@bors
Copy link
Contributor

bors commented Aug 19, 2019

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing 93660b0 to master...

@bors bors merged commit d682439 into rust-lang:master Aug 19, 2019
@rfcbot rfcbot added finished-final-comment-period FCP complete and removed final-comment-period FCP — a period for last comments before action is taken labels Aug 24, 2019
@hskang9
Copy link

hskang9 commented Sep 17, 2019

I am using the latest version of cargo cargo 1.39.0-nightly (9655d70af 2019-09-10), but I get error like this.

error: all dependencies must have a version specified when publishing.
dependency `shell` does not specify a version
Note: The published dependency will use the version from crates.io,
the `git` specification will be removed from the dependency declaration.

Is there an additional option for cargo to publish with git repositories?

@ehuss
Copy link
Contributor Author

ehuss commented Sep 17, 2019

@hskang9 No, to publish on crates.io, all dependencies also need to be published on crates.io. We are looking to relax that restriction for dev-dependencies in #7333.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 11, 2019
Pkgsrc changes:
 * Remove patch which no longer applies (but what about RPATH?)
 * Adapt a few patches to changed files upstream.

Upstream changes:

Version 1.39.0 (2019-11-07)
===========================

Language
--------
- [You can now create `async` functions and blocks with `async fn`,
  `async move {}`, and `async {}` respectively, and you can now call
  `.await` on async expressions.][63209]
- [You can now use certain attributes on function, closure, and function
  pointer parameters.][64010] These attributes include `cfg`, `cfg_attr`,
  `allow`, `warn`, `deny`, `forbid` as well as inert helper attributes used
  by procedural macro attributes applied to items. e.g.
  ```rust
  fn len(
      #[cfg(windows)] slice: &[u16],
      #[cfg(not(windows))] slice: &[u8],
  ) -> usize {
      slice.len()
  }
  ```
- [You can now take shared references to bind-by-move patterns in the
  `if` guards of `match` arms.][63118] e.g.
  ```rust
  fn main() {
      let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);

      match array {
          nums
  //      ---- `nums` is bound by move.
              if nums.iter().sum::<u8>() == 10
  //                 ^------ `.iter()` implicitly takes a reference to `nums`.
          => {
              drop(nums);
  //          ----------- Legal as `nums` was bound by move and so we have ownership.
          }
          _ => unreachable!(),
      }
  }
  ```

Compiler
--------
- [Added tier 3\* support for the `i686-unknown-uefi` target.][64334]
- [Added tier 3 support for the `sparc64-unknown-openbsd` target.][63595]
- [rustc will now trim code snippets in diagnostics to fit in your terminal.]
  [63402] **Note** Cargo currently doesn't use this feature. Refer to
  [cargo#7315][cargo/7315] to track this feature's progress.
- [You can now pass `--show-output` argument to test binaries to print the
  output of successful tests.][62600]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`Vec::new` and `String::new` are now `const` functions.][64028]
- [`LinkedList::new` is now a `const` function.][63684]
- [`str::len`, `[T]::len` and `str::as_bytes` are now `const` functions.][63770]
- [The `abs`, `wrapping_abs`, and `overflowing_abs` numeric functions are
  now `const`.][63786]

Stabilized APIs
---------------
- [`Pin::into_inner`]
- [`Instant::checked_duration_since`]
- [`Instant::saturating_duration_since`]

Cargo
-----
- [You can now publish git dependencies if supplied with a `version`.]
  [cargo/7237]
- [The `--all` flag has been renamed to `--workspace`.][cargo/7241] Using
  `--all` is now deprecated.

Misc
----
- [You can now pass `-Clinker` to rustdoc to control the linker used
  for compiling doctests.][63834]

Compatibility Notes
-------------------
- [Code that was previously accepted by the old borrow checker, but rejected by
  the NLL borrow checker is now a hard error in Rust 2018.][63565] This was
  previously a warning, and will also become a hard error in the Rust 2015
  edition in the 1.40.0 release.
- [`rustdoc` now requires `rustc` to be installed and in the same directory to
  run tests.][63827] This should improve performance when running a large
  amount of doctests.
- [The `try!` macro will now issue a deprecation warning.][62672] It is
  recommended to use the `?` operator instead.
- [`asinh(-0.0)` now correctly returns `-0.0`.][63698] Previously this
  returned `0.0`.

[62600]: rust-lang/rust#62600
[62672]: rust-lang/rust#62672
[63118]: rust-lang/rust#63118
[63209]: rust-lang/rust#63209
[63402]: rust-lang/rust#63402
[63565]: rust-lang/rust#63565
[63595]: rust-lang/rust#63595
[63684]: rust-lang/rust#63684
[63698]: rust-lang/rust#63698
[63770]: rust-lang/rust#63770
[63786]: rust-lang/rust#63786
[63827]: rust-lang/rust#63827
[63834]: rust-lang/rust#63834
[63927]: rust-lang/rust#63927
[63933]: rust-lang/rust#63933
[63934]: rust-lang/rust#63934
[63938]: rust-lang/rust#63938
[63940]: rust-lang/rust#63940
[63941]: rust-lang/rust#63941
[63945]: rust-lang/rust#63945
[64010]: rust-lang/rust#64010
[64028]: rust-lang/rust#64028
[64334]: rust-lang/rust#64334
[cargo/7237]: rust-lang/cargo#7237
[cargo/7241]: rust-lang/cargo#7241
[cargo/7315]: rust-lang/cargo#7315
[`Pin::into_inner`]: https://doc.rust-lang.org/std/pin/struct.Pin.html#method.into_inner
[`Instant::checked_duration_since`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_duration_since
[`Instant::saturating_duration_since`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.saturating_duration_since
LeoBorai added a commit to LeoBorai/local-ip-address that referenced this pull request Jun 19, 2021
When running "cargo publish --dry-run" an error is reported due to the
lack of the "bindings" crate in the package registry.

error: all dependencies must have a version specified when publishing.
dependency `bindings` does not specify a version
Note: The published dependency will use the version from crates.io,
the `path` specification will be removed from the dependency declaration.

Refer to: rust-lang/cargo#7237
@ehuss ehuss added this to the 1.39.0 milestone Feb 6, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-cargo Team: Cargo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publishing a crate with unpublished dependencies
9 participants