mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
feat(publish): Stabilize multi-package publishing
A user will now be able to use flags like `--workspace` with `cargo publish`. `cargo package` will now also work with those flags without having to pass `--no-verify --exclude-lockfile`. Many release tools have come out that solve this problem. They will still need a lot of the logic that went into that for other parts of the release process. However, a cargo-native solution allows for: - Verification during dry-run - Better strategies for waiting for the publish timeout `cargo publish` is non-atomic at this time. If there is a server side error, network error, or rate limit during the publish, the workspace will be left in a partially published state. Verification is done before any publishing so that won't affect things. There are multiple strategies we can employ for improving this over time, including - atomic publish - `--idempotent` (#13397) - leave this to release tools to manage This includes support for `--dry-run` verification. As release tools didn't have a way to do this before, users may be surprised at how slow this is because a `cargo build` is done instead of a `cargo check`. This is being tracked in #14941. This adds to `cargo package` the `--registry` and `--index` flags to help with resolving dependencies when depending on a package being packaged at that moment. These flags are only needed when a `cargo package --workspace` operation would have failed before due to inability to find a locally created dependency. Regarding the publish timeout, `cargo publish --workspace` publishes packages in batches and we only timeout if nothing in the batch has finished being published within the timeout, deferring the rest to the next wait-for-publish. So for example, if you have packages `a`, `b`, `c` then we'll wait up to 60 seconds and if only `a` and `b` were ready in that time, we'll then wait another 60 seconds for `c`. During testing, users ran into issues with `.crate` checksums that we've not been able to reproduce since: - https://github.com/rust-lang/cargo/issues/1169#issuecomment-2567995987 - #14396 By stabilizing this, Cargo's behavior becomes dependent on an overlay registry. When generating a lockfile or verifying a package, we overlay the locally generated `.crate` files on top of the registry so the registry appears as it would and everything works. If there is a conflict with a version, the local version wins which is important for the dry-run mode of release tools as they won't have bumped the version yet. Our concern for the overlay registry is dependency confusion attacks. Considering this is not accessible for general user operations, this should be fine. Fixes #1169 Fixes #10948
This commit is contained in:
parent
463e483346
commit
c8bf4096de
@ -7,8 +7,8 @@ use cargo::ops::PackageOpts;
|
||||
pub fn cli() -> Command {
|
||||
subcommand("package")
|
||||
.about("Assemble the local package into a distributable tarball")
|
||||
.arg_index("Registry index URL to prepare the package for (unstable)")
|
||||
.arg_registry("Registry to prepare the package for (unstable)")
|
||||
.arg_index("Registry index URL to prepare the package for")
|
||||
.arg_registry("Registry to prepare the package for")
|
||||
.arg(
|
||||
flag(
|
||||
"list",
|
||||
@ -57,22 +57,6 @@ pub fn cli() -> Command {
|
||||
}
|
||||
|
||||
pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
|
||||
if args._value_of("registry").is_some() {
|
||||
gctx.cli_unstable().fail_if_stable_opt_custom_z(
|
||||
"--registry",
|
||||
13947,
|
||||
"package-workspace",
|
||||
gctx.cli_unstable().package_workspace,
|
||||
)?;
|
||||
}
|
||||
if args._value_of("index").is_some() {
|
||||
gctx.cli_unstable().fail_if_stable_opt_custom_z(
|
||||
"--index",
|
||||
13947,
|
||||
"package-workspace",
|
||||
gctx.cli_unstable().package_workspace,
|
||||
)?;
|
||||
}
|
||||
let reg_or_index = args.registry_or_index(gctx)?;
|
||||
let ws = args.workspace(gctx)?;
|
||||
if ws.root_maybe().is_embedded() {
|
||||
|
@ -20,8 +20,8 @@ pub fn cli() -> Command {
|
||||
.arg_silent_suggestion()
|
||||
.arg_package_spec_no_all(
|
||||
"Package(s) to publish",
|
||||
"Publish all packages in the workspace (unstable)",
|
||||
"Don't publish specified packages (unstable)",
|
||||
"Publish all packages in the workspace",
|
||||
"Don't publish specified packages",
|
||||
)
|
||||
.arg_features()
|
||||
.arg_parallel()
|
||||
@ -45,23 +45,6 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
|
||||
.into());
|
||||
}
|
||||
|
||||
let unstable = gctx.cli_unstable();
|
||||
let enabled = unstable.package_workspace;
|
||||
if args.get_flag("workspace") {
|
||||
unstable.fail_if_stable_opt_custom_z("--workspace", 10948, "package-workspace", enabled)?;
|
||||
}
|
||||
if args._value_of("exclude").is_some() {
|
||||
unstable.fail_if_stable_opt_custom_z("--exclude", 10948, "package-workspace", enabled)?;
|
||||
}
|
||||
if args._values_of("package").len() > 1 {
|
||||
unstable.fail_if_stable_opt_custom_z(
|
||||
"--package (multiple occurrences)",
|
||||
10948,
|
||||
"package-workspace",
|
||||
enabled,
|
||||
)?;
|
||||
}
|
||||
|
||||
ops::publish(
|
||||
&ws,
|
||||
&PublishOpts {
|
||||
|
@ -845,7 +845,6 @@ unstable_cli_options!(
|
||||
next_lockfile_bump: bool,
|
||||
no_embed_metadata: bool = ("Avoid embedding metadata in library artifacts"),
|
||||
no_index_update: bool = ("Do not update the registry index even if the cache is outdated"),
|
||||
package_workspace: bool = ("Handle intra-workspace dependencies when packaging"),
|
||||
panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
|
||||
profile_hint_mostly_unused: bool = ("Enable the `hint-mostly-unused` setting in profiles to mark a crate as mostly unused."),
|
||||
profile_rustflags: bool = ("Enable the `rustflags` option in profiles in .cargo/config.toml file"),
|
||||
@ -942,6 +941,9 @@ const STABILIZED_CHECK_CFG: &str =
|
||||
|
||||
const STABILIZED_DOCTEST_XCOMPILE: &str = "Doctest cross-compiling is now always enabled.";
|
||||
|
||||
const STABILIZED_PACKAGE_WORKSPACE: &str =
|
||||
"Workspace packaging and publishing (a.k.a. `-Zpackage-workspace`) is now always enabled.";
|
||||
|
||||
fn deserialize_comma_separated_list<'de, D>(
|
||||
deserializer: D,
|
||||
) -> Result<Option<Vec<String>>, D::Error>
|
||||
@ -1323,6 +1325,7 @@ impl CliUnstable {
|
||||
"lints" => stabilized_warn(k, "1.74", STABILIZED_LINTS),
|
||||
"registry-auth" => stabilized_warn(k, "1.74", STABILIZED_REGISTRY_AUTH),
|
||||
"check-cfg" => stabilized_warn(k, "1.80", STABILIZED_CHECK_CFG),
|
||||
"package-workspace" => stabilized_warn(k, "1.89", STABILIZED_PACKAGE_WORKSPACE),
|
||||
|
||||
// Unstable features
|
||||
// Sorted alphabetically:
|
||||
@ -1366,7 +1369,6 @@ impl CliUnstable {
|
||||
"mtime-on-use" => self.mtime_on_use = parse_empty(k, v)?,
|
||||
"no-embed-metadata" => self.no_embed_metadata = parse_empty(k, v)?,
|
||||
"no-index-update" => self.no_index_update = parse_empty(k, v)?,
|
||||
"package-workspace" => self.package_workspace = parse_empty(k, v)?,
|
||||
"panic-abort-tests" => self.panic_abort_tests = parse_empty(k, v)?,
|
||||
"public-dependency" => self.public_dependency = parse_empty(k, v)?,
|
||||
"profile-hint-mostly-unused" => self.profile_hint_mostly_unused = parse_empty(k, v)?,
|
||||
|
@ -262,7 +262,7 @@ fn do_package<'a>(
|
||||
let deps = local_deps(pkgs.iter().map(|(p, f)| ((*p).clone(), f.clone())));
|
||||
let just_pkgs: Vec<_> = pkgs.iter().map(|p| p.0).collect();
|
||||
|
||||
let mut local_reg = if ws.gctx().cli_unstable().package_workspace {
|
||||
let mut local_reg = {
|
||||
// The publish registry doesn't matter unless there are local dependencies that will be
|
||||
// resolved,
|
||||
// so only try to get one if we need it. If they explicitly passed a
|
||||
@ -279,8 +279,6 @@ fn do_package<'a>(
|
||||
let reg_dir = ws.build_dir().join("package").join("tmp-registry");
|
||||
sid.map(|sid| TmpRegistry::new(ws.gctx(), reg_dir, sid))
|
||||
.transpose()?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// Packages need to be created in dependency order, because dependencies must
|
||||
|
@ -69,18 +69,8 @@ pub struct PublishOpts<'gctx> {
|
||||
}
|
||||
|
||||
pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
|
||||
let multi_package_mode = ws.gctx().cli_unstable().package_workspace;
|
||||
let specs = opts.to_publish.to_package_id_specs(ws)?;
|
||||
|
||||
if !multi_package_mode {
|
||||
if specs.len() > 1 {
|
||||
bail!("the `-p` argument must be specified to select a single package to publish")
|
||||
}
|
||||
if Packages::Default == opts.to_publish && ws.is_virtual() {
|
||||
bail!("the `-p` argument must be specified in the root of a virtual workspace")
|
||||
}
|
||||
}
|
||||
|
||||
let member_ids: Vec<_> = ws.members().map(|p| p.package_id()).collect();
|
||||
// Check that the specs match members.
|
||||
for spec in &specs {
|
||||
@ -97,13 +87,12 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
|
||||
// If `--workspace` is passed,
|
||||
// the intent is more like "publish all publisable packages in this workspace",
|
||||
// so skip `publish=false` packages.
|
||||
let allow_unpublishable = multi_package_mode
|
||||
&& match &opts.to_publish {
|
||||
Packages::Default => ws.is_virtual(),
|
||||
Packages::All(_) => true,
|
||||
Packages::OptOut(_) => true,
|
||||
Packages::Packages(_) => false,
|
||||
};
|
||||
let allow_unpublishable = match &opts.to_publish {
|
||||
Packages::Default => ws.is_virtual(),
|
||||
Packages::All(_) => true,
|
||||
Packages::OptOut(_) => true,
|
||||
Packages::Packages(_) => false,
|
||||
};
|
||||
if !unpublishable.is_empty() && !allow_unpublishable {
|
||||
bail!(
|
||||
"{} cannot be published.\n\
|
||||
|
@ -68,64 +68,7 @@ which defaults to `crates-io`.
|
||||
|
||||
{{/options}}
|
||||
|
||||
### Package Selection
|
||||
|
||||
By default, when no package selection options are given, the packages selected
|
||||
depend on the selected manifest file (based on the current working directory if
|
||||
`--manifest-path` is not given). If the manifest is the root of a workspace then
|
||||
the workspaces default members are selected, otherwise only the package defined
|
||||
by the manifest will be selected.
|
||||
|
||||
The default members of a workspace can be set explicitly with the
|
||||
`workspace.default-members` key in the root manifest. If this is not set, a
|
||||
virtual workspace will include all workspace members (equivalent to passing
|
||||
`--workspace`), and a non-virtual workspace will include only the root crate itself.
|
||||
|
||||
Selecting more than one package is unstable and available only on the
|
||||
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
|
||||
and requires the `-Z package-workspace` flag to enable.
|
||||
See <https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
|
||||
|
||||
{{#options}}
|
||||
|
||||
{{#option "`-p` _spec_..." "`--package` _spec_..."}}
|
||||
{{actionverb}} only the specified packages. See {{man "cargo-pkgid" 1}} for the
|
||||
SPEC format. This flag may be specified multiple times and supports common Unix
|
||||
glob patterns like `*`, `?` and `[]`. However, to avoid your shell accidentally
|
||||
expanding glob patterns before Cargo handles them, you must use single quotes or
|
||||
double quotes around each pattern.
|
||||
|
||||
Selecting more than one package with this option is unstable and available only
|
||||
on the
|
||||
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
|
||||
and requires the `-Z package-workspace` flag to enable.
|
||||
See <https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
{{/option}}
|
||||
|
||||
{{#option "`--workspace`" }}
|
||||
{{actionverb}} all members in the workspace.
|
||||
|
||||
This option is unstable and available only on the
|
||||
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
|
||||
and requires the `-Z package-workspace` flag to enable.
|
||||
See <https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
{{/option}}
|
||||
|
||||
{{#option "`--exclude` _SPEC_..." }}
|
||||
Exclude the specified packages. Must be used in conjunction with the
|
||||
`--workspace` flag. This flag may be specified multiple times and supports
|
||||
common Unix glob patterns like `*`, `?` and `[]`. However, to avoid your shell
|
||||
accidentally expanding glob patterns before Cargo handles them, you must use
|
||||
single quotes or double quotes around each pattern.
|
||||
|
||||
This option is unstable and available only on the
|
||||
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
|
||||
and requires the `-Z package-workspace` flag to enable.
|
||||
See <https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
{{/option}}
|
||||
|
||||
{{/options}}
|
||||
{{> section-package-selection }}
|
||||
|
||||
### Compilation Options
|
||||
|
||||
|
@ -85,12 +85,6 @@ OPTIONS
|
||||
passing --workspace), and a non-virtual workspace will include only the
|
||||
root crate itself.
|
||||
|
||||
Selecting more than one package is unstable and available only on the
|
||||
nightly channel
|
||||
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
|
||||
requires the -Z package-workspace flag to enable. See
|
||||
<https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
|
||||
-p spec…, --package spec…
|
||||
Publish only the specified packages. See cargo-pkgid(1) for the SPEC
|
||||
format. This flag may be specified multiple times and supports
|
||||
@ -99,21 +93,11 @@ OPTIONS
|
||||
them, you must use single quotes or double quotes around each
|
||||
pattern.
|
||||
|
||||
Selecting more than one package with this option is unstable and
|
||||
available only on the nightly channel
|
||||
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
|
||||
requires the -Z package-workspace flag to enable. See
|
||||
<https://github.com/rust-lang/cargo/issues/10948> for more
|
||||
information.
|
||||
|
||||
--workspace
|
||||
Publish all members in the workspace.
|
||||
|
||||
This option is unstable and available only on the nightly channel
|
||||
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
|
||||
requires the -Z package-workspace flag to enable. See
|
||||
<https://github.com/rust-lang/cargo/issues/10948> for more
|
||||
information.
|
||||
--all
|
||||
Deprecated alias for --workspace.
|
||||
|
||||
--exclude SPEC…
|
||||
Exclude the specified packages. Must be used in conjunction with the
|
||||
@ -123,12 +107,6 @@ OPTIONS
|
||||
handles them, you must use single quotes or double quotes around
|
||||
each pattern.
|
||||
|
||||
This option is unstable and available only on the nightly channel
|
||||
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
|
||||
requires the -Z package-workspace flag to enable. See
|
||||
<https://github.com/rust-lang/cargo/issues/10948> for more
|
||||
information.
|
||||
|
||||
Compilation Options
|
||||
--target triple
|
||||
Publish for the given architecture. The default is the host
|
||||
|
@ -88,12 +88,6 @@ The default members of a workspace can be set explicitly with the
|
||||
virtual workspace will include all workspace members (equivalent to passing
|
||||
`--workspace`), and a non-virtual workspace will include only the root crate itself.
|
||||
|
||||
Selecting more than one package is unstable and available only on the
|
||||
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
|
||||
and requires the `-Z package-workspace` flag to enable.
|
||||
See <https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
|
||||
|
||||
<dl>
|
||||
|
||||
<dt class="option-term" id="option-cargo-publish--p"><a class="option-anchor" href="#option-cargo-publish--p"></a><code>-p</code> <em>spec</em>…</dt>
|
||||
@ -102,20 +96,15 @@ See <https://github.com/rust-lang/cargo/issues/10948> for more information.
|
||||
SPEC format. This flag may be specified multiple times and supports common Unix
|
||||
glob patterns like <code>*</code>, <code>?</code> and <code>[]</code>. However, to avoid your shell accidentally
|
||||
expanding glob patterns before Cargo handles them, you must use single quotes or
|
||||
double quotes around each pattern.</p>
|
||||
<p>Selecting more than one package with this option is unstable and available only
|
||||
on the
|
||||
<a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html">nightly channel</a>
|
||||
and requires the <code>-Z package-workspace</code> flag to enable.
|
||||
See <a href="https://github.com/rust-lang/cargo/issues/10948">https://github.com/rust-lang/cargo/issues/10948</a> for more information.</dd>
|
||||
double quotes around each pattern.</dd>
|
||||
|
||||
|
||||
<dt class="option-term" id="option-cargo-publish---workspace"><a class="option-anchor" href="#option-cargo-publish---workspace"></a><code>--workspace</code></dt>
|
||||
<dd class="option-desc">Publish all members in the workspace.</p>
|
||||
<p>This option is unstable and available only on the
|
||||
<a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html">nightly channel</a>
|
||||
and requires the <code>-Z package-workspace</code> flag to enable.
|
||||
See <a href="https://github.com/rust-lang/cargo/issues/10948">https://github.com/rust-lang/cargo/issues/10948</a> for more information.</dd>
|
||||
<dd class="option-desc">Publish all members in the workspace.</dd>
|
||||
|
||||
|
||||
<dt class="option-term" id="option-cargo-publish---all"><a class="option-anchor" href="#option-cargo-publish---all"></a><code>--all</code></dt>
|
||||
<dd class="option-desc">Deprecated alias for <code>--workspace</code>.</dd>
|
||||
|
||||
|
||||
<dt class="option-term" id="option-cargo-publish---exclude"><a class="option-anchor" href="#option-cargo-publish---exclude"></a><code>--exclude</code> <em>SPEC</em>…</dt>
|
||||
@ -123,11 +112,7 @@ See <a href="https://github.com/rust-lang/cargo/issues/10948">https://github.com
|
||||
<code>--workspace</code> flag. This flag may be specified multiple times and supports
|
||||
common Unix glob patterns like <code>*</code>, <code>?</code> and <code>[]</code>. However, to avoid your shell
|
||||
accidentally expanding glob patterns before Cargo handles them, you must use
|
||||
single quotes or double quotes around each pattern.</p>
|
||||
<p>This option is unstable and available only on the
|
||||
<a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html">nightly channel</a>
|
||||
and requires the <code>-Z package-workspace</code> flag to enable.
|
||||
See <a href="https://github.com/rust-lang/cargo/issues/10948">https://github.com/rust-lang/cargo/issues/10948</a> for more information.</dd>
|
||||
single quotes or double quotes around each pattern.</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
|
@ -100,11 +100,6 @@ The default members of a workspace can be set explicitly with the
|
||||
virtual workspace will include all workspace members (equivalent to passing
|
||||
\fB\-\-workspace\fR), and a non\-virtual workspace will include only the root crate itself.
|
||||
.sp
|
||||
Selecting more than one package is unstable and available only on the
|
||||
\fInightly channel\fR <https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html>
|
||||
and requires the \fB\-Z package\-workspace\fR flag to enable.
|
||||
See <https://github.com/rust\-lang/cargo/issues/10948> for more information.
|
||||
.sp
|
||||
\fB\-p\fR \fIspec\fR\[u2026],
|
||||
\fB\-\-package\fR \fIspec\fR\[u2026]
|
||||
.RS 4
|
||||
@ -113,22 +108,16 @@ SPEC format. This flag may be specified multiple times and supports common Unix
|
||||
glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
|
||||
expanding glob patterns before Cargo handles them, you must use single quotes or
|
||||
double quotes around each pattern.
|
||||
.sp
|
||||
Selecting more than one package with this option is unstable and available only
|
||||
on the
|
||||
\fInightly channel\fR <https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html>
|
||||
and requires the \fB\-Z package\-workspace\fR flag to enable.
|
||||
See <https://github.com/rust\-lang/cargo/issues/10948> for more information.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-workspace\fR
|
||||
.RS 4
|
||||
Publish all members in the workspace.
|
||||
.RE
|
||||
.sp
|
||||
This option is unstable and available only on the
|
||||
\fInightly channel\fR <https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html>
|
||||
and requires the \fB\-Z package\-workspace\fR flag to enable.
|
||||
See <https://github.com/rust\-lang/cargo/issues/10948> for more information.
|
||||
\fB\-\-all\fR
|
||||
.RS 4
|
||||
Deprecated alias for \fB\-\-workspace\fR\&.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-exclude\fR \fISPEC\fR\[u2026]
|
||||
@ -138,11 +127,6 @@ Exclude the specified packages. Must be used in conjunction with the
|
||||
common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell
|
||||
accidentally expanding glob patterns before Cargo handles them, you must use
|
||||
single quotes or double quotes around each pattern.
|
||||
.sp
|
||||
This option is unstable and available only on the
|
||||
\fInightly channel\fR <https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html>
|
||||
and requires the \fB\-Z package\-workspace\fR flag to enable.
|
||||
See <https://github.com/rust\-lang/cargo/issues/10948> for more information.
|
||||
.RE
|
||||
.SS "Compilation Options"
|
||||
.sp
|
||||
|
@ -1,4 +1,4 @@
|
||||
<svg width="1255px" height="884px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="1255px" height="866px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
@ -70,47 +70,45 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="496px"><tspan> -Z no-index-update Do not update the registry index even if the cache is outdated</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="514px"><tspan> -Z package-workspace Handle intra-workspace dependencies when packaging</tspan>
|
||||
<tspan x="10px" y="514px"><tspan> -Z panic-abort-tests Enable support to run tests with -Cpanic=abort</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="532px"><tspan> -Z panic-abort-tests Enable support to run tests with -Cpanic=abort</tspan>
|
||||
<tspan x="10px" y="532px"><tspan> -Z profile-hint-mostly-unused Enable the `hint-mostly-unused` setting in profiles to mark a crate as mostly unused.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="550px"><tspan> -Z profile-hint-mostly-unused Enable the `hint-mostly-unused` setting in profiles to mark a crate as mostly unused.</tspan>
|
||||
<tspan x="10px" y="550px"><tspan> -Z profile-rustflags Enable the `rustflags` option in profiles in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="568px"><tspan> -Z profile-rustflags Enable the `rustflags` option in profiles in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="568px"><tspan> -Z public-dependency Respect a dependency's `public` field in Cargo.toml to control public/private dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="586px"><tspan> -Z public-dependency Respect a dependency's `public` field in Cargo.toml to control public/private dependencies</tspan>
|
||||
<tspan x="10px" y="586px"><tspan> -Z publish-timeout Enable the `publish.timeout` key in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="604px"><tspan> -Z publish-timeout Enable the `publish.timeout` key in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="604px"><tspan> -Z root-dir Set the root directory relative to which paths are printed (defaults to workspace root)</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="622px"><tspan> -Z root-dir Set the root directory relative to which paths are printed (defaults to workspace root)</tspan>
|
||||
<tspan x="10px" y="622px"><tspan> -Z rustdoc-depinfo Use dep-info files in rustdoc rebuild detection</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="640px"><tspan> -Z rustdoc-depinfo Use dep-info files in rustdoc rebuild detection</tspan>
|
||||
<tspan x="10px" y="640px"><tspan> -Z rustdoc-map Allow passing external documentation mappings to rustdoc</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="658px"><tspan> -Z rustdoc-map Allow passing external documentation mappings to rustdoc</tspan>
|
||||
<tspan x="10px" y="658px"><tspan> -Z rustdoc-scrape-examples Allows Rustdoc to scrape code examples from reverse-dependencies</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="676px"><tspan> -Z rustdoc-scrape-examples Allows Rustdoc to scrape code examples from reverse-dependencies</tspan>
|
||||
<tspan x="10px" y="676px"><tspan> -Z sbom Enable the `sbom` option in build config in .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="694px"><tspan> -Z sbom Enable the `sbom` option in build config in .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="694px"><tspan> -Z script Enable support for single-file, `.rs` packages</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="712px"><tspan> -Z script Enable support for single-file, `.rs` packages</tspan>
|
||||
<tspan x="10px" y="712px"><tspan> -Z target-applies-to-host Enable the `target-applies-to-host` key in the .cargo/config.toml file</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="730px"><tspan> -Z target-applies-to-host Enable the `target-applies-to-host` key in the .cargo/config.toml file</tspan>
|
||||
<tspan x="10px" y="730px"><tspan> -Z trim-paths Enable the `trim-paths` option in profiles</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="748px"><tspan> -Z trim-paths Enable the `trim-paths` option in profiles</tspan>
|
||||
<tspan x="10px" y="748px"><tspan> -Z unstable-options Allow the usage of unstable options</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="766px"><tspan> -Z unstable-options Allow the usage of unstable options</tspan>
|
||||
<tspan x="10px" y="766px"><tspan> -Z warnings Allow use of the build.warnings config key</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="784px"><tspan> -Z warnings Allow use of the build.warnings config key</tspan>
|
||||
<tspan x="10px" y="784px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="802px">
|
||||
<tspan x="10px" y="802px"><tspan>Run with `cargo -Z [FLAG] [COMMAND]`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="820px"><tspan>Run with `cargo -Z [FLAG] [COMMAND]`</tspan>
|
||||
<tspan x="10px" y="820px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="838px">
|
||||
<tspan x="10px" y="838px"><tspan>See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="856px"><tspan>See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="874px">
|
||||
<tspan x="10px" y="856px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.8 KiB |
@ -29,9 +29,9 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="100px"><tspan class="fg-green bold">Options:</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-cyan bold">--index</tspan><tspan class="fg-cyan"> </tspan><tspan class="fg-cyan"><INDEX></tspan><tspan> Registry index URL to prepare the package for (unstable)</tspan>
|
||||
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-cyan bold">--index</tspan><tspan class="fg-cyan"> </tspan><tspan class="fg-cyan"><INDEX></tspan><tspan> Registry index URL to prepare the package for</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-cyan bold">--registry</tspan><tspan class="fg-cyan"> </tspan><tspan class="fg-cyan"><REGISTRY></tspan><tspan> Registry to prepare the package for (unstable)</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-cyan bold">--registry</tspan><tspan class="fg-cyan"> </tspan><tspan class="fg-cyan"><REGISTRY></tspan><tspan> Registry to prepare the package for</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-cyan bold">-l</tspan><tspan>, </tspan><tspan class="fg-cyan bold">--list</tspan><tspan> Print files included in a package without making one</tspan>
|
||||
</tspan>
|
||||
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
@ -61,9 +61,9 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-cyan bold">-p</tspan><tspan>, </tspan><tspan class="fg-cyan bold">--package</tspan><tspan class="fg-cyan"> [</tspan><tspan class="fg-cyan"><SPEC></tspan><tspan class="fg-cyan">]</tspan><tspan> Package(s) to publish</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-cyan bold">--workspace</tspan><tspan> Publish all packages in the workspace (unstable)</tspan>
|
||||
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-cyan bold">--workspace</tspan><tspan> Publish all packages in the workspace</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="424px"><tspan> </tspan><tspan class="fg-cyan bold">--exclude</tspan><tspan class="fg-cyan"> </tspan><tspan class="fg-cyan"><SPEC></tspan><tspan> Don't publish specified packages (unstable)</tspan>
|
||||
<tspan x="10px" y="424px"><tspan> </tspan><tspan class="fg-cyan bold">--exclude</tspan><tspan class="fg-cyan"> </tspan><tspan class="fg-cyan"><SPEC></tspan><tspan> Don't publish specified packages</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="442px">
|
||||
</tspan>
|
||||
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
@ -5682,32 +5682,6 @@ fn workspace_with_local_deps() {
|
||||
let p = workspace_with_local_deps_project();
|
||||
|
||||
p.cargo("package")
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_status(101)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] level3 v0.0.1 ([ROOT]/foo/level3)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] level2 v0.0.1 ([ROOT]/foo/level2)
|
||||
[UPDATING] crates.io index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `level3` found
|
||||
location searched: crates.io index
|
||||
required by package `level2 v0.0.1 ([ROOT]/foo/level2)`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn workspace_with_local_deps_nightly() {
|
||||
let crates_io = registry::init();
|
||||
let p = workspace_with_local_deps_project();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -5862,8 +5836,7 @@ fn workspace_with_local_dev_deps() {
|
||||
.file("dev_dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -5954,31 +5927,6 @@ Caused by:
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn workspace_with_local_deps_packaging_one_fails_nightly() {
|
||||
let crates_io = registry::init();
|
||||
let p = workspace_with_local_deps_packaging_one_fails_project();
|
||||
|
||||
// We can't package just level1, because there's a dependency on level2.
|
||||
p.cargo("package -p level1 -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_status(101)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] level1 v0.0.1 ([ROOT]/foo/level1)
|
||||
[UPDATING] crates.io index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `level2` found
|
||||
location searched: crates.io index
|
||||
required by package `level1 v0.0.1 ([ROOT]/foo/level1)`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
// Same as workspace_with_local_deps_packaging_one_fails except that we're
|
||||
// packaging a bin. This fails during lock-file generation instead of during verification.
|
||||
#[cargo_test]
|
||||
@ -6026,8 +5974,7 @@ fn workspace_with_local_deps_packaging_one_bin_fails() {
|
||||
.build();
|
||||
|
||||
// We can't package just level1, because there's a dependency on level2.
|
||||
p.cargo("package -p level1 -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package -p level1")
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_status(101)
|
||||
.with_stdout_data("")
|
||||
@ -6108,8 +6055,7 @@ fn workspace_with_local_deps_packaging_one_with_needed_deps() {
|
||||
.file("level3/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -p level2 -p level3 -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package -p level2 -p level3")
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -6244,14 +6190,10 @@ fn workspace_with_local_deps_index_mismatch() {
|
||||
)
|
||||
.file("level2/src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo(&format!(
|
||||
"package --index {} -Zpackage-workspace",
|
||||
alt_reg.index_url()
|
||||
))
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
p.cargo(&format!("package --index {}", alt_reg.index_url()))
|
||||
.with_status(101)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] level2 v0.0.1 ([ROOT]/foo/level2)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] level1 v0.0.1 ([ROOT]/foo/level1)
|
||||
@ -6264,7 +6206,7 @@ Caused by:
|
||||
required by package `level1 v0.0.1 ([ROOT]/foo/level1)`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
@ -6315,13 +6257,9 @@ fn workspace_with_local_deps_alternative_index() {
|
||||
.file("level2/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo(&format!(
|
||||
"package --index {} -Zpackage-workspace",
|
||||
alt_reg.index_url()
|
||||
))
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
p.cargo(&format!("package --index {}", alt_reg.index_url()))
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] level2 v0.0.1 ([ROOT]/foo/level2)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] level1 v0.0.1 ([ROOT]/foo/level1)
|
||||
@ -6338,7 +6276,7 @@ fn workspace_with_local_deps_alternative_index() {
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
.run();
|
||||
|
||||
let index = alt_reg.index_url();
|
||||
let generated_lock = format!(
|
||||
@ -6429,37 +6367,6 @@ fn workspace_with_local_dep_already_published() {
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] crates.io index
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[VERIFYING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] dep v0.1.0
|
||||
[COMPILING] dep v0.1.0
|
||||
[COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn workspace_with_local_dep_already_published_nightly() {
|
||||
let reg = registry::init();
|
||||
let p = workspace_with_local_dep_already_published_project();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.replace_crates_io(reg.index_url())
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] crates.io index
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
|
||||
@ -6524,8 +6431,7 @@ fn workspace_with_local_and_remote_deps() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.replace_crates_io(reg.index_url())
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
@ -6597,8 +6503,7 @@ fn workspace_with_capitalized_member() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace --no-verify")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --no-verify")
|
||||
.replace_crates_io(reg.index_url())
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
@ -6685,8 +6590,7 @@ fn workspace_with_renamed_member() {
|
||||
)
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.replace_crates_io(reg.index_url())
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
@ -6765,8 +6669,7 @@ fn workspace_with_dot_rs_dir() {
|
||||
.file("crates/bar.rs/src/lib.rs", "pub fn foo() {}")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.replace_crates_io(reg.index_url())
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
@ -6811,8 +6714,7 @@ fn registry_not_in_publish_list() {
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
p.cargo("package --registry alternative -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --registry alternative")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] `foo` cannot be packaged.
|
||||
@ -6873,8 +6775,7 @@ fn registry_inferred_from_unique_option() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -6897,7 +6798,7 @@ fn registry_inferred_from_unique_option() {
|
||||
|
||||
#[cargo_test]
|
||||
fn registry_not_inferred_because_of_conflict() {
|
||||
let _alt_reg = registry::RegistryBuilder::new()
|
||||
let alt_reg = registry::RegistryBuilder::new()
|
||||
.http_api()
|
||||
.http_index()
|
||||
.alternative()
|
||||
@ -6949,16 +6850,7 @@ fn registry_not_inferred_because_of_conflict() {
|
||||
p.cargo("package")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/main)`
|
||||
[ERROR] conflicts between `package.publish` fields in the selected packages
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -6966,21 +6858,7 @@ Caused by:
|
||||
p.cargo("package --exclude-lockfile")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[VERIFYING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to verify package tarball
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)`
|
||||
[ERROR] conflicts between `package.publish` fields in the selected packages
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -6988,112 +6866,12 @@ Caused by:
|
||||
p.cargo("package --no-verify")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/main)`
|
||||
[ERROR] conflicts between `package.publish` fields in the selected packages
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile --no-verify")
|
||||
.with_status(0)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn registry_not_inferred_because_of_conflict_nightly() {
|
||||
let alt_reg = registry::RegistryBuilder::new()
|
||||
.http_api()
|
||||
.http_index()
|
||||
.alternative()
|
||||
.build();
|
||||
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
members = ["dep", "main"]
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"main/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "main"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "main"
|
||||
repository = "bar"
|
||||
publish = ["alternative"]
|
||||
|
||||
[dependencies]
|
||||
dep = { path = "../dep", version = "0.1.0", registry = "alternative" }
|
||||
"#,
|
||||
)
|
||||
.file("main/src/main.rs", "fn main() {}")
|
||||
.file(
|
||||
"dep/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "dep"
|
||||
version = "0.1.0"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "dep"
|
||||
repository = "bar"
|
||||
publish = ["alternative2"]
|
||||
"#,
|
||||
)
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] conflicts between `package.publish` fields in the selected packages
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] conflicts between `package.publish` fields in the selected packages
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --no-verify -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] conflicts between `package.publish` fields in the selected packages
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile --no-verify -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7103,8 +6881,7 @@ fn registry_not_inferred_because_of_conflict_nightly() {
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package -Zpackage-workspace --registry=alternative")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --registry=alternative")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] `dep` cannot be packaged.
|
||||
@ -7113,12 +6890,8 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo(&format!(
|
||||
"package --index {} -Zpackage-workspace",
|
||||
alt_reg.index_url()
|
||||
))
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
p.cargo(&format!("package --index {}", alt_reg.index_url()))
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
@ -7135,7 +6908,7 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
@ -7189,8 +6962,7 @@ fn registry_inference_ignores_unpublishable() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7210,8 +6982,7 @@ fn registry_inference_ignores_unpublishable() {
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package -Zpackage-workspace --registry=alternative")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --registry=alternative")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7282,24 +7053,18 @@ fn registry_not_inferred_because_of_multiple_options() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[VERIFYING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to verify package tarball
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)`
|
||||
[ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -7307,112 +7072,12 @@ Caused by:
|
||||
p.cargo("package --no-verify")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/main)`
|
||||
[ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile --no-verify")
|
||||
.with_status(0)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn registry_not_inferred_because_of_multiple_options_nightly() {
|
||||
let _alt_reg = registry::RegistryBuilder::new()
|
||||
.http_api()
|
||||
.http_index()
|
||||
.alternative()
|
||||
.build();
|
||||
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
members = ["dep", "main"]
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"main/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "main"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "main"
|
||||
repository = "bar"
|
||||
publish = ["alternative", "alternative2"]
|
||||
|
||||
[dependencies]
|
||||
dep = { path = "../dep", version = "0.1.0", registry = "alternative" }
|
||||
"#,
|
||||
)
|
||||
.file("main/src/main.rs", "fn main() {}")
|
||||
.file(
|
||||
"dep/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "dep"
|
||||
version = "0.1.0"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "dep"
|
||||
repository = "bar"
|
||||
publish = ["alternative", "alternative2"]
|
||||
"#,
|
||||
)
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --no-verify -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile --no-verify -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7422,8 +7087,7 @@ fn registry_not_inferred_because_of_multiple_options_nightly() {
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package -Zpackage-workspace --registry=alternative")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --registry=alternative")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7499,16 +7163,7 @@ fn registry_not_inferred_because_of_mismatch() {
|
||||
p.cargo("package")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/main)`
|
||||
[ERROR] --registry is required because not all `package.publish` settings agree
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -7516,21 +7171,7 @@ Caused by:
|
||||
p.cargo("package --exclude-lockfile")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[VERIFYING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to verify package tarball
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)`
|
||||
[ERROR] --registry is required because not all `package.publish` settings agree
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -7538,113 +7179,12 @@ Caused by:
|
||||
p.cargo("package --no-verify")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[UPDATING] `alternative` index
|
||||
[ERROR] failed to prepare local package for uploading
|
||||
|
||||
Caused by:
|
||||
no matching package named `dep` found
|
||||
location searched: `alternative` index
|
||||
required by package `main v0.0.1 ([ROOT]/foo/main)`
|
||||
[ERROR] --registry is required because not all `package.publish` settings agree
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile --no-verify")
|
||||
.with_status(0)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn registry_not_inferred_because_of_mismatch_nightly() {
|
||||
let _alt_reg = registry::RegistryBuilder::new()
|
||||
.http_api()
|
||||
.http_index()
|
||||
.alternative()
|
||||
.build();
|
||||
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
members = ["dep", "main"]
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"main/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "main"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "main"
|
||||
repository = "bar"
|
||||
publish = ["alternative"]
|
||||
|
||||
[dependencies]
|
||||
dep = { path = "../dep", version = "0.1.0", registry = "alternative" }
|
||||
"#,
|
||||
)
|
||||
.file("main/src/main.rs", "fn main() {}")
|
||||
// No `publish` field means "any registry", but the presence of this package
|
||||
// will stop us from inferring a registry.
|
||||
.file(
|
||||
"dep/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "dep"
|
||||
version = "0.1.0"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "dep"
|
||||
repository = "bar"
|
||||
"#,
|
||||
)
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required because not all `package.publish` settings agree
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required because not all `package.publish` settings agree
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --no-verify -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] --registry is required because not all `package.publish` settings agree
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package --exclude-lockfile --no-verify -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7654,8 +7194,7 @@ fn registry_not_inferred_because_of_mismatch_nightly() {
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("package -Zpackage-workspace --registry=alternative")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --registry=alternative")
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
@ -7726,8 +7265,7 @@ fn unpublishable_dependency() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
|
||||
@ -7998,39 +7536,6 @@ fn unpublished_cyclic_dev_dependencies() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn unpublished_cyclic_dev_dependencies_nightly() {
|
||||
registry::init();
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
description = "foo"
|
||||
documentation = "foo"
|
||||
|
||||
[dev-dependencies]
|
||||
foo = { path = ".", version = "0.0.1" }
|
||||
"#,
|
||||
)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("package --no-verify --exclude-lockfile -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[PACKAGING] foo v0.0.1 ([ROOT]/foo)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
// A failing case from <https://github.com/rust-lang/cargo/issues/15059>
|
||||
#[cargo_test]
|
||||
fn unpublished_dependency() {
|
||||
@ -8133,8 +7638,7 @@ fn checksum_changed() {
|
||||
|
||||
p.cargo("check").run();
|
||||
|
||||
p.cargo("package --workspace -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("package --workspace")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
|
@ -2573,9 +2573,23 @@ fn with_duplicate_spec_in_members() {
|
||||
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `-p` argument must be specified to select a single package to publish
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[WARNING] manifest has no documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] li v0.0.1 ([ROOT]/foo/li)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[UPLOADED] bar v0.0.1 to registry `crates-io`
|
||||
[UPLOADING] li v0.0.1 ([ROOT]/foo/li)
|
||||
[UPLOADED] li v0.0.1 to registry `crates-io`
|
||||
[NOTE] waiting for bar v0.0.1 or li v0.0.1 to be available at registry `crates-io`.
|
||||
You may press ctrl-c to skip waiting; the crates should be available shortly.
|
||||
[PUBLISHED] bar v0.0.1 and li v0.0.1 at registry `crates-io`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -2662,9 +2676,17 @@ fn in_virtual_workspace() {
|
||||
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `-p` argument must be specified in the root of a virtual workspace
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] foo v0.0.1 ([ROOT]/foo/foo)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] foo v0.0.1 ([ROOT]/foo/foo)
|
||||
[UPLOADED] foo v0.0.1 to registry `crates-io`
|
||||
[NOTE] waiting for foo v0.0.1 to be available at registry `crates-io`.
|
||||
You may press ctrl-c to skip waiting; the crate should be available shortly.
|
||||
[PUBLISHED] foo v0.0.1 at registry `crates-io`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
@ -2819,16 +2841,29 @@ fn in_package_workspace_found_multiple() {
|
||||
|
||||
p.cargo("publish -p li* --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `-p` argument must be specified to select a single package to publish
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] li v0.0.1 ([ROOT]/foo/li)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[WARNING] manifest has no documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] lii v0.0.1 ([ROOT]/foo/lii)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] li v0.0.1 ([ROOT]/foo/li)
|
||||
[UPLOADED] li v0.0.1 to registry `crates-io`
|
||||
[UPLOADING] lii v0.0.1 ([ROOT]/foo/lii)
|
||||
[UPLOADED] lii v0.0.1 to registry `crates-io`
|
||||
[NOTE] waiting for li v0.0.1 or lii v0.0.1 to be available at registry `crates-io`.
|
||||
You may press ctrl-c to skip waiting; the crates should be available shortly.
|
||||
[PUBLISHED] li v0.0.1 and lii v0.0.1 at registry `crates-io`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
// https://github.com/rust-lang/cargo/issues/10536
|
||||
fn publish_path_dependency_without_workspace() {
|
||||
let registry = RegistryBuilder::new().http_api().http_index().build();
|
||||
|
||||
@ -3373,9 +3408,9 @@ fn timeout_waiting_for_dependency_publish() {
|
||||
)
|
||||
.build();
|
||||
|
||||
p.cargo("publish --no-verify -Zpublish-timeout -Zpackage-workspace")
|
||||
p.cargo("publish --no-verify -Zpublish-timeout")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.masquerade_as_nightly_cargo(&["publish-timeout", "package-workspace"])
|
||||
.masquerade_as_nightly_cargo(&["publish-timeout"])
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
@ -3403,84 +3438,6 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn package_selection_nightly() {
|
||||
let registry = registry::RegistryBuilder::new().http_api().build();
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
members = ["a", "b"]
|
||||
"#,
|
||||
)
|
||||
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
||||
.file("a/src/lib.rs", "#[test] fn a() {}")
|
||||
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
||||
.file("b/src/lib.rs", "#[test] fn b() {}")
|
||||
.build();
|
||||
|
||||
p.cargo("publish --no-verify --dry-run -Zpackage-workspace --workspace")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[WARNING] aborting upload due to dry run
|
||||
[UPLOADING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[WARNING] aborting upload due to dry run
|
||||
|
||||
"#]])
|
||||
.with_stdout_data(str![[r#""#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish --no-verify --dry-run -Zpackage-workspace --package a --package b")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[WARNING] aborting upload due to dry run
|
||||
[UPLOADING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[WARNING] aborting upload due to dry run
|
||||
|
||||
"#]])
|
||||
.with_stdout_data(str![[r#""#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish --no-verify --dry-run -Zpackage-workspace --workspace --exclude b")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[WARNING] aborting upload due to dry run
|
||||
|
||||
"#]])
|
||||
.with_stdout_data(str![[r#""#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn package_selection() {
|
||||
let registry = registry::RegistryBuilder::new().http_api().build();
|
||||
@ -3500,11 +3457,20 @@ fn package_selection() {
|
||||
|
||||
p.cargo("publish --no-verify --dry-run --workspace")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `--workspace` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
|
||||
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
|
||||
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--workspace` flag.
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[WARNING] aborting upload due to dry run
|
||||
[UPLOADING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[WARNING] aborting upload due to dry run
|
||||
|
||||
"#]])
|
||||
.with_stdout_data(str![[r#""#]])
|
||||
@ -3512,23 +3478,35 @@ See https://github.com/rust-lang/cargo/issues/10948 for more information about t
|
||||
|
||||
p.cargo("publish --no-verify --dry-run --package a --package b")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `--package (multiple occurrences)` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
|
||||
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
|
||||
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--package (multiple occurrences)` flag.
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[WARNING] aborting upload due to dry run
|
||||
[UPLOADING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[WARNING] aborting upload due to dry run
|
||||
|
||||
"#]])
|
||||
.with_stdout_data(str![[r#""#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish --no-verify --dry-run --exclude b")
|
||||
p.cargo("publish --no-verify --dry-run --workspace --exclude b")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `--exclude` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
|
||||
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
|
||||
See https://github.com/rust-lang/cargo/issues/10948 for more information about the `--exclude` flag.
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[UPLOADING] a v0.1.0 ([ROOT]/foo/a)
|
||||
[WARNING] aborting upload due to dry run
|
||||
|
||||
"#]])
|
||||
.with_stdout_data(str![[r#""#]])
|
||||
@ -3741,26 +3719,10 @@ fn workspace_with_local_deps_project() -> Project {
|
||||
|
||||
#[cargo_test]
|
||||
fn workspace_with_local_deps() {
|
||||
let crates_io = registry::init();
|
||||
let p = workspace_with_local_deps_project();
|
||||
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(crates_io.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `-p` argument must be specified to select a single package to publish
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn workspace_with_local_deps_nightly() {
|
||||
let registry = RegistryBuilder::new().http_api().http_index().build();
|
||||
let p = workspace_with_local_deps_project();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
@ -3867,8 +3829,7 @@ fn workspace_parallel() {
|
||||
.file("c/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
@ -3957,8 +3918,7 @@ fn workspace_missing_dependency() {
|
||||
.file("b/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace -p b")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish -p b")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -3975,8 +3935,7 @@ Caused by:
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace -p a")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish -p a")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
@ -3995,8 +3954,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
|
||||
.run();
|
||||
|
||||
// Publishing the whole workspace now will fail, as `a` is already published.
|
||||
p.cargo("publish -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -4053,8 +4011,7 @@ fn one_unpublishable_package() {
|
||||
.file("dep/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
@ -4133,8 +4090,7 @@ fn virtual_ws_with_multiple_unpublishable_package() {
|
||||
.file("publishable/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
@ -4205,8 +4161,7 @@ fn workspace_flag_with_unpublishable_packages() {
|
||||
.file("non-publishable/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("publish --workspace -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish --workspace")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
@ -4271,8 +4226,7 @@ fn unpublishable_package_as_versioned_dev_dep() {
|
||||
|
||||
// It is expected to find the versioned dev dep not being published,
|
||||
// regardless with `--dry-run` or `--no-verify`.
|
||||
p.cargo("publish -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -4289,8 +4243,7 @@ Caused by:
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace --dry-run")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish --dry-run")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -4307,8 +4260,7 @@ Caused by:
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish -Zpackage-workspace --no-verify")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish --no-verify")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
@ -4368,8 +4320,7 @@ fn all_unpublishable_packages() {
|
||||
.file("non-publishable2/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("publish --workspace -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish --workspace")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] nothing to publish, but found 2 unpublishable packages
|
||||
@ -4424,8 +4375,7 @@ fn checksum_changed() {
|
||||
|
||||
p.cargo("check").run();
|
||||
|
||||
p.cargo("publish --dry-run --workspace -Zpackage-workspace")
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
p.cargo("publish --dry-run --workspace")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
|
@ -2682,22 +2682,20 @@ fn nonexistence_package_together_with_workspace() {
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("publish --dry-run --package nonexistence -Zpackage-workspace --workspace")
|
||||
p.cargo("publish --dry-run --package nonexistence --workspace")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] package(s) `nonexistence` not found in workspace `[ROOT]/foo`
|
||||
|
||||
"#]])
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.run();
|
||||
// With pattern *
|
||||
p.cargo("publish --dry-run --package nonpattern* -Zpackage-workspace --workspace")
|
||||
p.cargo("publish --dry-run --package nonpattern* --workspace")
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] package pattern(s) `nonpattern*` not found in workspace `[ROOT]/foo`
|
||||
|
||||
"#]])
|
||||
.masquerade_as_nightly_cargo(&["package-workspace"])
|
||||
.run();
|
||||
|
||||
p.cargo("tree --package nonexistence --workspace")
|
||||
|
Loading…
x
Reference in New Issue
Block a user