Skip to content

Commit 3a77350

Browse files
committed
Auto merge of #13418 - PaulDance:publish-test-crates, r=weihanglo
Publish test crates ### What does this PR try to resolve? This is an attempt to close #10147. In short, publish the `cargo-test-(macro|support)` crates to crates.io. Main parts: * Updating the concerned manifests to make the packages publishable. * Adding them to `publish.py`: not sure if you want this to be done. I put them after all other packages and in reverse-dependency order to ensure things will work the best, hopefully. * Updating the contribution documentation to reflect the change. I didn't see any other place where the crates' publication was mentioned. ### How should we test and review this PR? Sadly, the effective testing could not be done by me as it would require publishing the crates, which would block future publications by Cargo team members and therefore render the whole point of this impossible or cumbersome. Hopefully, the PR is small and readable enough that mistakes can be seen easily. The real testing would need to be done manually by some team member either before by checking the source branch out or after merging. The only testing I was able to perform was to run `cargo publish --dry-run -p cargo-test-(macro|support)`. The first worked just fine. The second failed on the `crates-io` package not being available on crates.io in version `0.40.0`. However, the package is in this version in the current sources. I therefore suspect that a run of `publish.py` should work since the packages have been added there after `crates-io`. ### Additional information This is very much tentative and open to discussion. I tried my best to update things as I understood them. Please correct me on anything I would have done wrong or simply not thought of.
2 parents 499a61c + f422e96 commit 3a77350

File tree

15 files changed

+52
-13
lines changed

15 files changed

+52
-13
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ cargo-credential-libsecret = { version = "0.4.2", path = "credential/cargo-crede
3030
cargo-credential-macos-keychain = { version = "0.4.2", path = "credential/cargo-credential-macos-keychain" }
3131
cargo-credential-wincred = { version = "0.4.2", path = "credential/cargo-credential-wincred" }
3232
cargo-platform = { path = "crates/cargo-platform", version = "0.1.5" }
33-
cargo-test-macro = { path = "crates/cargo-test-macro" }
34-
cargo-test-support = { path = "crates/cargo-test-support" }
33+
cargo-test-macro = { version = "0.2.0", path = "crates/cargo-test-macro" }
34+
cargo-test-support = { version = "0.2.0", path = "crates/cargo-test-support" }
3535
cargo-util = { version = "0.2.9", path = "crates/cargo-util" }
3636
cargo-util-schemas = { version = "0.3.0", path = "crates/cargo-util-schemas" }
3737
cargo_metadata = "0.18.1"

crates/cargo-test-macro/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
[package]
22
name = "cargo-test-macro"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition.workspace = true
5+
rust-version = "1.77" # MSRV:1
56
license.workspace = true
67
homepage.workspace = true
78
repository.workspace = true
8-
documentation = "https://github.com/rust-lang/cargo"
99
description = "Helper proc-macro for Cargo's testsuite."
10-
publish = false
1110

1211
[lib]
1312
proc-macro = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE-APACHE

crates/cargo-test-macro/LICENSE-MIT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE-MIT

crates/cargo-test-macro/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
WARNING: You might not want to use this outside of Cargo.
2+
3+
* This is designed for testing Cargo itself. Use at your own risk.
4+
* No guarantee on any stability across versions.
5+
* No feature request would be accepted unless proved useful for testing Cargo.

crates/cargo-test-macro/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
//! # Cargo test macro.
2+
//!
3+
//! This is meant to be consumed alongside `cargo-test-support`. See
4+
//! <https://rust-lang.github.io/cargo/contrib/> for a guide on writing tests.
5+
//!
6+
//! WARNING: You might not want to use this outside of Cargo.
7+
//!
8+
//! * This is designed for testing Cargo itself. Use at your own risk.
9+
//! * No guarantee on any stability across versions.
10+
//! * No feature request would be accepted unless proved useful for testing Cargo.
11+
112
use proc_macro::*;
213
use std::path::Path;
314
use std::process::Command;

crates/cargo-test-support/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
[package]
22
name = "cargo-test-support"
3-
version = "0.1.0"
4-
license.workspace = true
3+
version = "0.2.0"
54
edition.workspace = true
6-
publish = false
5+
rust-version = "1.77" # MSRV:1
6+
license.workspace = true
7+
homepage.workspace = true
8+
repository.workspace = true
9+
description = "Testing framework for Cargo's testsuite."
710

811
[lib]
912
doctest = false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE-APACHE

crates/cargo-test-support/LICENSE-MIT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE-MIT

crates/cargo-test-support/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
WARNING: You might not want to use this outside of Cargo.
2+
3+
* This is designed for testing Cargo itself. Use at your own risk.
4+
* No guarantee on any stability across versions.
5+
* No feature request would be accepted unless proved useful for testing Cargo.

crates/cargo-test-support/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
//! # Cargo test support.
22
//!
33
//! See <https://rust-lang.github.io/cargo/contrib/> for a guide on writing tests.
4+
//!
5+
//! WARNING: You might not want to use this outside of Cargo.
6+
//!
7+
//! * This is designed for testing Cargo itself. Use at your own risk.
8+
//! * No guarantee on any stability across versions.
9+
//! * No feature request would be accepted unless proved useful for testing Cargo.
410
511
#![allow(clippy::disallowed_methods)]
612
#![allow(clippy::print_stderr)]

crates/xtask-bump-check/src/xtask.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ fn bump_check(args: &clap::ArgMatches, gctx: &cargo::util::GlobalContext) -> Car
168168
let mut cmd = ProcessBuilder::new("cargo");
169169
cmd.arg("semver-checks")
170170
.arg("check-release")
171+
.args(&["--exclude", "cargo-test-macro"]) // FIXME: Remove once 1.79 is stable.
172+
.args(&["--exclude", "cargo-test-support"]) // FIXME: Remove once 1.79 is stable.
171173
.arg("--workspace");
172174
gctx.shell().status("Running", &cmd)?;
173175
cmd.exec()?;
@@ -176,6 +178,8 @@ fn bump_check(args: &clap::ArgMatches, gctx: &cargo::util::GlobalContext) -> Car
176178
let mut cmd = ProcessBuilder::new("cargo");
177179
cmd.arg("semver-checks")
178180
.arg("--workspace")
181+
.args(&["--exclude", "cargo-test-macro"]) // FIXME: Remove once 1.79 is stable.
182+
.args(&["--exclude", "cargo-test-support"]) // FIXME: Remove once 1.79 is stable.
179183
.arg("--baseline-rev")
180184
.arg(referenced_commit.id().to_string());
181185
for krate in crates_not_check_against_channels {

publish.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'crates/cargo-util',
2727
'crates/crates-io',
2828
'crates/cargo-util-schemas',
29+
'crates/cargo-test-macro',
30+
'crates/cargo-test-support',
2931
'.',
3032
]
3133

src/doc/contrib/src/process/release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ Cargo's library and its related dependencies (like `cargo-util`) are published
131131
to [crates.io] as part of the 6-week stable release process by the [Release
132132
team]. There is a [`publish.py` script] that is used by the Release team's
133133
automation scripts (see <https://github.com/rust-lang/simpleinfra/>) to handle
134-
determining which packages to publish. The test and build tool crates aren't
135-
published. This runs on the specific git commit associated with the cargo
136-
submodule in the `stable` branch in `rust-lang/rust` at the time of release.
134+
determining which packages to publish. The build tool crates aren't published.
135+
This runs on the specific git commit associated with the cargo submodule in the
136+
`stable` branch in `rust-lang/rust` at the time of release.
137137

138138
On very rare cases, the Cargo team may decide to manually publish a new
139139
release to [crates.io]. For example, this may be necessary if there is a

0 commit comments

Comments
 (0)