mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(toml): Warn, rather than fail publish, if targets are excluded
This could offer performance gains when parsing a published manifest since the targets don't need to be discovered. To see this, we'd first need to stop discovering potential targets even when it isn't needed.
This commit is contained in:
parent
1e6047763d
commit
06a57142f1
@ -264,7 +264,7 @@ fn resolve_toml(
|
|||||||
manifest_file: &Path,
|
manifest_file: &Path,
|
||||||
gctx: &GlobalContext,
|
gctx: &GlobalContext,
|
||||||
warnings: &mut Vec<String>,
|
warnings: &mut Vec<String>,
|
||||||
_errors: &mut Vec<String>,
|
errors: &mut Vec<String>,
|
||||||
) -> CargoResult<manifest::TomlManifest> {
|
) -> CargoResult<manifest::TomlManifest> {
|
||||||
if let Some(workspace) = &original_toml.workspace {
|
if let Some(workspace) = &original_toml.workspace {
|
||||||
if workspace.resolver.as_deref() == Some("3") {
|
if workspace.resolver.as_deref() == Some("3") {
|
||||||
@ -277,11 +277,11 @@ fn resolve_toml(
|
|||||||
package: None,
|
package: None,
|
||||||
project: None,
|
project: None,
|
||||||
profile: original_toml.profile.clone(),
|
profile: original_toml.profile.clone(),
|
||||||
lib: original_toml.lib.clone(),
|
lib: None,
|
||||||
bin: original_toml.bin.clone(),
|
bin: None,
|
||||||
example: original_toml.example.clone(),
|
example: None,
|
||||||
test: original_toml.test.clone(),
|
test: None,
|
||||||
bench: original_toml.bench.clone(),
|
bench: None,
|
||||||
dependencies: None,
|
dependencies: None,
|
||||||
dev_dependencies: None,
|
dev_dependencies: None,
|
||||||
dev_dependencies2: None,
|
dev_dependencies2: None,
|
||||||
@ -318,6 +318,47 @@ fn resolve_toml(
|
|||||||
});
|
});
|
||||||
resolved_toml.package = Some(resolved_package);
|
resolved_toml.package = Some(resolved_package);
|
||||||
|
|
||||||
|
resolved_toml.lib = targets::resolve_lib(
|
||||||
|
original_toml.lib.as_ref(),
|
||||||
|
package_root,
|
||||||
|
&original_package.name,
|
||||||
|
edition,
|
||||||
|
warnings,
|
||||||
|
)?;
|
||||||
|
resolved_toml.bin = Some(targets::resolve_bins(
|
||||||
|
original_toml.bin.as_ref(),
|
||||||
|
package_root,
|
||||||
|
&original_package.name,
|
||||||
|
edition,
|
||||||
|
original_package.autobins,
|
||||||
|
warnings,
|
||||||
|
resolved_toml.lib.is_some(),
|
||||||
|
)?);
|
||||||
|
resolved_toml.example = Some(targets::resolve_examples(
|
||||||
|
original_toml.example.as_ref(),
|
||||||
|
package_root,
|
||||||
|
edition,
|
||||||
|
original_package.autoexamples,
|
||||||
|
warnings,
|
||||||
|
errors,
|
||||||
|
)?);
|
||||||
|
resolved_toml.test = Some(targets::resolve_tests(
|
||||||
|
original_toml.test.as_ref(),
|
||||||
|
package_root,
|
||||||
|
edition,
|
||||||
|
original_package.autotests,
|
||||||
|
warnings,
|
||||||
|
errors,
|
||||||
|
)?);
|
||||||
|
resolved_toml.bench = Some(targets::resolve_benches(
|
||||||
|
original_toml.bench.as_ref(),
|
||||||
|
package_root,
|
||||||
|
edition,
|
||||||
|
original_package.autobenches,
|
||||||
|
warnings,
|
||||||
|
errors,
|
||||||
|
)?);
|
||||||
|
|
||||||
let activated_opt_deps = resolved_toml
|
let activated_opt_deps = resolved_toml
|
||||||
.features
|
.features
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -519,10 +560,10 @@ fn resolve_package_toml<'a>(
|
|||||||
.map(manifest::InheritableField::Value),
|
.map(manifest::InheritableField::Value),
|
||||||
workspace: original_package.workspace.clone(),
|
workspace: original_package.workspace.clone(),
|
||||||
im_a_teapot: original_package.im_a_teapot.clone(),
|
im_a_teapot: original_package.im_a_teapot.clone(),
|
||||||
autobins: original_package.autobins.clone(),
|
autobins: Some(false),
|
||||||
autoexamples: original_package.autoexamples.clone(),
|
autoexamples: Some(false),
|
||||||
autotests: original_package.autotests.clone(),
|
autotests: Some(false),
|
||||||
autobenches: original_package.autobenches.clone(),
|
autobenches: Some(false),
|
||||||
default_run: original_package.default_run.clone(),
|
default_run: original_package.default_run.clone(),
|
||||||
description: original_package
|
description: original_package
|
||||||
.description
|
.description
|
||||||
@ -1149,8 +1190,8 @@ fn to_real_manifest(
|
|||||||
// If we have a lib with no path, use the inferred lib or else the package name.
|
// If we have a lib with no path, use the inferred lib or else the package name.
|
||||||
let targets = to_targets(
|
let targets = to_targets(
|
||||||
&features,
|
&features,
|
||||||
|
&original_toml,
|
||||||
&resolved_toml,
|
&resolved_toml,
|
||||||
package_name,
|
|
||||||
package_root,
|
package_root,
|
||||||
edition,
|
edition,
|
||||||
&resolved_package.metabuild,
|
&resolved_package.metabuild,
|
||||||
@ -2520,14 +2561,14 @@ fn prepare_toml_for_publish(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let lib = if let Some(target) = &me.lib {
|
let lib = if let Some(target) = &me.lib {
|
||||||
Some(prepare_target_for_publish(target, "library")?)
|
prepare_target_for_publish(target, included, "library", ws.gctx())?
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
let bin = prepare_targets_for_publish(me.bin.as_ref(), "binary")?;
|
let bin = prepare_targets_for_publish(me.bin.as_ref(), included, "binary", ws.gctx())?;
|
||||||
let example = prepare_targets_for_publish(me.example.as_ref(), "example")?;
|
let example = prepare_targets_for_publish(me.example.as_ref(), included, "example", ws.gctx())?;
|
||||||
let test = prepare_targets_for_publish(me.test.as_ref(), "test")?;
|
let test = prepare_targets_for_publish(me.test.as_ref(), included, "test", ws.gctx())?;
|
||||||
let bench = prepare_targets_for_publish(me.bench.as_ref(), "benchmark")?;
|
let bench = prepare_targets_for_publish(me.bench.as_ref(), included, "benchmark", ws.gctx())?;
|
||||||
|
|
||||||
let all = |_d: &manifest::TomlDependency| true;
|
let all = |_d: &manifest::TomlDependency| true;
|
||||||
let mut manifest = manifest::TomlManifest {
|
let mut manifest = manifest::TomlManifest {
|
||||||
@ -2685,7 +2726,9 @@ fn prepare_toml_for_publish(
|
|||||||
|
|
||||||
fn prepare_targets_for_publish(
|
fn prepare_targets_for_publish(
|
||||||
targets: Option<&Vec<manifest::TomlTarget>>,
|
targets: Option<&Vec<manifest::TomlTarget>>,
|
||||||
|
included: &[PathBuf],
|
||||||
context: &str,
|
context: &str,
|
||||||
|
gctx: &GlobalContext,
|
||||||
) -> CargoResult<Option<Vec<manifest::TomlTarget>>> {
|
) -> CargoResult<Option<Vec<manifest::TomlTarget>>> {
|
||||||
let Some(targets) = targets else {
|
let Some(targets) = targets else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
@ -2693,23 +2736,41 @@ fn prepare_targets_for_publish(
|
|||||||
|
|
||||||
let mut prepared = Vec::with_capacity(targets.len());
|
let mut prepared = Vec::with_capacity(targets.len());
|
||||||
for target in targets {
|
for target in targets {
|
||||||
let target = prepare_target_for_publish(target, context)?;
|
let Some(target) = prepare_target_for_publish(target, included, context, gctx)? else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
prepared.push(target);
|
prepared.push(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Some(prepared))
|
if prepared.is_empty() {
|
||||||
|
Ok(None)
|
||||||
|
} else {
|
||||||
|
Ok(Some(prepared))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_target_for_publish(
|
fn prepare_target_for_publish(
|
||||||
target: &manifest::TomlTarget,
|
target: &manifest::TomlTarget,
|
||||||
|
included: &[PathBuf],
|
||||||
context: &str,
|
context: &str,
|
||||||
) -> CargoResult<manifest::TomlTarget> {
|
gctx: &GlobalContext,
|
||||||
let mut target = target.clone();
|
) -> CargoResult<Option<manifest::TomlTarget>> {
|
||||||
if let Some(path) = target.path {
|
let path = target.path.as_ref().expect("previously resolved");
|
||||||
let path = normalize_path(&path.0);
|
let path = normalize_path(&path.0);
|
||||||
target.path = Some(manifest::PathValue(normalize_path_sep(path, context)?));
|
if !included.contains(&path) {
|
||||||
|
let name = target.name.as_ref().expect("previously resolved");
|
||||||
|
gctx.shell().warn(format!(
|
||||||
|
"ignoring {context} `{name}` as `{}` is not included in the published package",
|
||||||
|
path.display()
|
||||||
|
))?;
|
||||||
|
return Ok(None);
|
||||||
}
|
}
|
||||||
Ok(target)
|
|
||||||
|
let mut target = target.clone();
|
||||||
|
let path = normalize_path_sep(path, context)?;
|
||||||
|
target.path = Some(manifest::PathValue(path.into()));
|
||||||
|
|
||||||
|
Ok(Some(target))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalize_path_sep(path: PathBuf, context: &str) -> CargoResult<PathBuf> {
|
fn normalize_path_sep(path: PathBuf, context: &str) -> CargoResult<PathBuf> {
|
||||||
|
@ -34,8 +34,8 @@ const DEFAULT_EXAMPLE_DIR_NAME: &'static str = "examples";
|
|||||||
#[tracing::instrument(skip_all)]
|
#[tracing::instrument(skip_all)]
|
||||||
pub(super) fn to_targets(
|
pub(super) fn to_targets(
|
||||||
features: &Features,
|
features: &Features,
|
||||||
|
original_toml: &TomlManifest,
|
||||||
resolved_toml: &TomlManifest,
|
resolved_toml: &TomlManifest,
|
||||||
package_name: &str,
|
|
||||||
package_root: &Path,
|
package_root: &Path,
|
||||||
edition: Edition,
|
edition: Edition,
|
||||||
metabuild: &Option<StringOrVec>,
|
metabuild: &Option<StringOrVec>,
|
||||||
@ -44,26 +44,14 @@ pub(super) fn to_targets(
|
|||||||
) -> CargoResult<Vec<Target>> {
|
) -> CargoResult<Vec<Target>> {
|
||||||
let mut targets = Vec::new();
|
let mut targets = Vec::new();
|
||||||
|
|
||||||
let has_lib;
|
|
||||||
|
|
||||||
let lib = resolve_lib(
|
|
||||||
resolved_toml.lib.as_ref(),
|
|
||||||
package_root,
|
|
||||||
package_name,
|
|
||||||
edition,
|
|
||||||
warnings,
|
|
||||||
)?;
|
|
||||||
if let Some(target) = to_lib_target(
|
if let Some(target) = to_lib_target(
|
||||||
|
original_toml.lib.as_ref(),
|
||||||
resolved_toml.lib.as_ref(),
|
resolved_toml.lib.as_ref(),
|
||||||
lib.as_ref(),
|
|
||||||
package_root,
|
package_root,
|
||||||
edition,
|
edition,
|
||||||
warnings,
|
warnings,
|
||||||
)? {
|
)? {
|
||||||
targets.push(target);
|
targets.push(target);
|
||||||
has_lib = true;
|
|
||||||
} else {
|
|
||||||
has_lib = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let package = resolved_toml
|
let package = resolved_toml
|
||||||
@ -71,52 +59,31 @@ pub(super) fn to_targets(
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow::format_err!("manifest has no `package` (or `project`)"))?;
|
.ok_or_else(|| anyhow::format_err!("manifest has no `package` (or `project`)"))?;
|
||||||
|
|
||||||
let bins = resolve_bins(
|
|
||||||
resolved_toml.bin.as_ref(),
|
|
||||||
package_root,
|
|
||||||
package_name,
|
|
||||||
edition,
|
|
||||||
package.autobins,
|
|
||||||
warnings,
|
|
||||||
has_lib,
|
|
||||||
)?;
|
|
||||||
targets.extend(to_bin_targets(
|
targets.extend(to_bin_targets(
|
||||||
features,
|
features,
|
||||||
&bins,
|
resolved_toml.bin.as_deref().unwrap_or_default(),
|
||||||
package_root,
|
package_root,
|
||||||
edition,
|
edition,
|
||||||
errors,
|
errors,
|
||||||
)?);
|
)?);
|
||||||
|
|
||||||
let toml_examples = resolve_examples(
|
targets.extend(to_example_targets(
|
||||||
resolved_toml.example.as_ref(),
|
resolved_toml.example.as_deref().unwrap_or_default(),
|
||||||
package_root,
|
package_root,
|
||||||
edition,
|
edition,
|
||||||
package.autoexamples,
|
)?);
|
||||||
warnings,
|
|
||||||
errors,
|
|
||||||
)?;
|
|
||||||
targets.extend(to_example_targets(&toml_examples, package_root, edition)?);
|
|
||||||
|
|
||||||
let toml_tests = resolve_tests(
|
targets.extend(to_test_targets(
|
||||||
resolved_toml.test.as_ref(),
|
resolved_toml.test.as_deref().unwrap_or_default(),
|
||||||
package_root,
|
package_root,
|
||||||
edition,
|
edition,
|
||||||
package.autotests,
|
)?);
|
||||||
warnings,
|
|
||||||
errors,
|
|
||||||
)?;
|
|
||||||
targets.extend(to_test_targets(&toml_tests, package_root, edition)?);
|
|
||||||
|
|
||||||
let toml_benches = resolve_benches(
|
targets.extend(to_bench_targets(
|
||||||
resolved_toml.bench.as_ref(),
|
resolved_toml.bench.as_deref().unwrap_or_default(),
|
||||||
package_root,
|
package_root,
|
||||||
edition,
|
edition,
|
||||||
package.autobenches,
|
)?);
|
||||||
warnings,
|
|
||||||
errors,
|
|
||||||
)?;
|
|
||||||
targets.extend(to_bench_targets(&toml_benches, package_root, edition)?);
|
|
||||||
|
|
||||||
// processing the custom build script
|
// processing the custom build script
|
||||||
if let Some(custom_build) = package.resolved_build().expect("should be resolved") {
|
if let Some(custom_build) = package.resolved_build().expect("should be resolved") {
|
||||||
@ -158,7 +125,7 @@ pub(super) fn to_targets(
|
|||||||
Ok(targets)
|
Ok(targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_lib(
|
pub fn resolve_lib(
|
||||||
original_lib: Option<&TomlLibTarget>,
|
original_lib: Option<&TomlLibTarget>,
|
||||||
package_root: &Path,
|
package_root: &Path,
|
||||||
package_name: &str,
|
package_name: &str,
|
||||||
@ -283,7 +250,7 @@ fn to_lib_target(
|
|||||||
Ok(Some(target))
|
Ok(Some(target))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_bins(
|
pub fn resolve_bins(
|
||||||
toml_bins: Option<&Vec<TomlBinTarget>>,
|
toml_bins: Option<&Vec<TomlBinTarget>>,
|
||||||
package_root: &Path,
|
package_root: &Path,
|
||||||
package_name: &str,
|
package_name: &str,
|
||||||
@ -409,7 +376,7 @@ fn legacy_bin_path(package_root: &Path, name: &str, has_lib: bool) -> Option<Pat
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_examples(
|
pub fn resolve_examples(
|
||||||
toml_examples: Option<&Vec<TomlExampleTarget>>,
|
toml_examples: Option<&Vec<TomlExampleTarget>>,
|
||||||
package_root: &Path,
|
package_root: &Path,
|
||||||
edition: Edition,
|
edition: Edition,
|
||||||
@ -464,7 +431,7 @@ fn to_example_targets(
|
|||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_tests(
|
pub fn resolve_tests(
|
||||||
toml_tests: Option<&Vec<TomlTestTarget>>,
|
toml_tests: Option<&Vec<TomlTestTarget>>,
|
||||||
package_root: &Path,
|
package_root: &Path,
|
||||||
edition: Edition,
|
edition: Edition,
|
||||||
@ -512,7 +479,7 @@ fn to_test_targets(
|
|||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_benches(
|
pub fn resolve_benches(
|
||||||
toml_benches: Option<&Vec<TomlBenchTarget>>,
|
toml_benches: Option<&Vec<TomlBenchTarget>>,
|
||||||
package_root: &Path,
|
package_root: &Path,
|
||||||
edition: Edition,
|
edition: Edition,
|
||||||
|
@ -2215,6 +2215,10 @@ name = "foo"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "foo"
|
homepage = "foo"
|
||||||
documentation = "foo"
|
documentation = "foo"
|
||||||
@ -2223,6 +2227,10 @@ license = "MIT"
|
|||||||
repository = "foo"
|
repository = "foo"
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies.bar]
|
[dependencies.bar]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
artifact = ["bin"]
|
artifact = ["bin"]
|
||||||
|
@ -1704,11 +1704,19 @@ name = "a"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Zzz"]
|
authors = ["Zzz"]
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "https://example.com/"
|
homepage = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "a"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
|
@ -986,11 +986,19 @@ edition = "2015"
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "https://example.com/"
|
homepage = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies.opt-dep1]
|
[dependencies.opt-dep1]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
optional = true
|
optional = true
|
||||||
@ -1106,11 +1114,19 @@ edition = "2015"
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "https://example.com/"
|
homepage = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies.bar]
|
[dependencies.bar]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
optional = true
|
optional = true
|
||||||
|
@ -225,6 +225,10 @@ include = [
|
|||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
]
|
]
|
||||||
publish = true
|
publish = true
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "This is a crate"
|
description = "This is a crate"
|
||||||
homepage = "https://www.rust-lang.org"
|
homepage = "https://www.rust-lang.org"
|
||||||
documentation = "https://www.rust-lang.org/learn"
|
documentation = "https://www.rust-lang.org/learn"
|
||||||
@ -233,6 +237,10 @@ keywords = ["cli"]
|
|||||||
categories = ["development-tools"]
|
categories = ["development-tools"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/example/example"
|
repository = "https://github.com/example/example"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
),
|
),
|
||||||
@ -386,8 +394,16 @@ name = "bar"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "bar"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.dep]
|
[dependencies.dep]
|
||||||
version = "0.1"
|
version = "0.1"
|
||||||
|
|
||||||
@ -519,8 +535,16 @@ name = "bar"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "bar"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.dep]
|
[dependencies.dep]
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
features = ["testing"]
|
features = ["testing"]
|
||||||
@ -771,6 +795,10 @@ include = [
|
|||||||
"README.md",
|
"README.md",
|
||||||
]
|
]
|
||||||
publish = true
|
publish = true
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "This is a crate"
|
description = "This is a crate"
|
||||||
homepage = "https://www.rust-lang.org"
|
homepage = "https://www.rust-lang.org"
|
||||||
documentation = "https://www.rust-lang.org/learn"
|
documentation = "https://www.rust-lang.org/learn"
|
||||||
@ -780,6 +808,10 @@ categories = ["development-tools"]
|
|||||||
license = "MIT"
|
license = "MIT"
|
||||||
license-file = "LICENSE"
|
license-file = "LICENSE"
|
||||||
repository = "https://github.com/example/example"
|
repository = "https://github.com/example/example"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "bar"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
),
|
),
|
||||||
@ -935,8 +967,16 @@ name = "bar"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "bar"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.dep]
|
[dependencies.dep]
|
||||||
version = "0.1"
|
version = "0.1"
|
||||||
|
|
||||||
|
@ -1219,6 +1219,10 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
exclude = ["*.txt"]
|
exclude = ["*.txt"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -1226,6 +1230,10 @@ license = "MIT"
|
|||||||
[package.metadata]
|
[package.metadata]
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.abc]
|
[dependencies.abc]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
|
|
||||||
@ -1296,7 +1304,15 @@ name = "bar"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "bar"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
@ -1365,8 +1381,16 @@ edition = "2015"
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.bar]
|
[dependencies.bar]
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
||||||
@ -1385,8 +1409,16 @@ edition = "2015"
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.bar]
|
[dependencies.bar]
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
public = true
|
public = true
|
||||||
@ -2864,8 +2896,16 @@ edition = "2021"
|
|||||||
name = "bar"
|
name = "bar"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
resolver = "1"
|
resolver = "1"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "bar"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
@ -2885,7 +2925,15 @@ edition = "2015"
|
|||||||
name = "baz"
|
name = "baz"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
readme = false
|
readme = false
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "baz"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
@ -2949,10 +2997,18 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
exclude = ["*.txt"]
|
exclude = ["*.txt"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "https://example.com/"
|
homepage = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
@ -3045,10 +3101,18 @@ name = "foo"
|
|||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "https://example.com/"
|
documentation = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
@ -3154,10 +3218,18 @@ name = "foo"
|
|||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "https://example.com/"
|
homepage = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
);
|
);
|
||||||
@ -3277,6 +3349,10 @@ fn normalize_case() {
|
|||||||
See [..]
|
See [..]
|
||||||
[PACKAGING] foo v0.0.1 ([CWD])
|
[PACKAGING] foo v0.0.1 ([CWD])
|
||||||
[WARNING] ignoring `package.build` as `build.rs` is not included in the published package
|
[WARNING] ignoring `package.build` as `build.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring binary `foo` as `src/main.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring example `ExampleFoo` as `examples/ExampleFoo.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring test `explicitpath` as `tests/explicitpath.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring test `ExplicitPath` as `tests/ExplicitPath.rs` is not included in the published package
|
||||||
[VERIFYING] foo v0.0.1 ([CWD])
|
[VERIFYING] foo v0.0.1 ([CWD])
|
||||||
[COMPILING] foo v0.0.1 ([CWD][..])
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
@ -3306,6 +3382,10 @@ src/lib.rs
|
|||||||
See [..]
|
See [..]
|
||||||
[PACKAGING] foo v0.0.1 ([CWD])
|
[PACKAGING] foo v0.0.1 ([CWD])
|
||||||
[WARNING] ignoring `package.build` as `build.rs` is not included in the published package
|
[WARNING] ignoring `package.build` as `build.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring binary `foo` as `src/main.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring example `ExampleFoo` as `examples/ExampleFoo.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring test `explicitpath` as `tests/explicitpath.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring test `ExplicitPath` as `tests/ExplicitPath.rs` is not included in the published package
|
||||||
[VERIFYING] foo v0.0.1 ([CWD])
|
[VERIFYING] foo v0.0.1 ([CWD])
|
||||||
[COMPILING] foo v0.0.1 ([CWD][..])
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
@ -3339,13 +3419,17 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
exclude = ["*.txt"]
|
exclude = ["*.txt"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[[test]]
|
[lib]
|
||||||
name = "explicitpath"
|
name = "foo"
|
||||||
path = "tests/explicitpath.rs"
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
),
|
),
|
||||||
@ -3750,12 +3834,17 @@ name = "foo"
|
|||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = []
|
authors = []
|
||||||
build = "src/build.rs"
|
build = "src/build.rs"
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = "docs/README.md"
|
readme = "docs/README.md"
|
||||||
license-file = "docs/LICENSE"
|
license-file = "docs/LICENSE"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
name = "foo"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
@ -3840,10 +3929,18 @@ include = [
|
|||||||
"src/lib.rs",
|
"src/lib.rs",
|
||||||
"build.rs",
|
"build.rs",
|
||||||
]
|
]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -3909,10 +4006,18 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
include = ["src/lib.rs"]
|
include = ["src/lib.rs"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -3981,10 +4086,18 @@ include = [
|
|||||||
"src/lib.rs",
|
"src/lib.rs",
|
||||||
"build.rs",
|
"build.rs",
|
||||||
]
|
]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4051,10 +4164,18 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
include = ["src/lib.rs"]
|
include = ["src/lib.rs"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4128,10 +4249,22 @@ include = [
|
|||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"src/lib.rs",
|
"src/lib.rs",
|
||||||
]
|
]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4163,6 +4296,7 @@ fn discovery_inferred_lib_excluded() {
|
|||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[PACKAGING] foo v0.0.1 ([CWD])
|
[PACKAGING] foo v0.0.1 ([CWD])
|
||||||
|
[WARNING] ignoring library `foo` as `src/lib.rs` is not included in the published package
|
||||||
[VERIFYING] foo v0.0.1 ([CWD])
|
[VERIFYING] foo v0.0.1 ([CWD])
|
||||||
[COMPILING] foo v0.0.1 ([CWD][..])
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
@ -4196,10 +4330,18 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
include = ["src/main.rs"]
|
include = ["src/main.rs"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4276,13 +4418,22 @@ include = [
|
|||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"src/lib.rs",
|
"src/lib.rs",
|
||||||
]
|
]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
name = "foo"
|
||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4313,20 +4464,59 @@ fn discovery_explicit_lib_excluded() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("package")
|
p.cargo("package")
|
||||||
.with_status(101)
|
|
||||||
.with_stdout("")
|
.with_stdout("")
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[PACKAGING] foo v0.0.1 ([CWD])
|
[PACKAGING] foo v0.0.1 ([CWD])
|
||||||
|
[WARNING] ignoring library `foo` as `src/lib.rs` is not included in the published package
|
||||||
[VERIFYING] foo v0.0.1 ([CWD])
|
[VERIFYING] foo v0.0.1 ([CWD])
|
||||||
[COMPILING] foo v0.0.1 ([CWD][..])
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
||||||
[ERROR] couldn't read src/lib.rs: [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
|
[PACKAGED] 4 files, [..] ([..] compressed)
|
||||||
[ERROR] could not compile `foo` (lib) due to 1 previous error
|
|
||||||
[ERROR] failed to verify package tarball
|
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
|
||||||
|
validate_crate_contents(
|
||||||
|
f,
|
||||||
|
"foo-0.0.1.crate",
|
||||||
|
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
|
||||||
|
&[(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||||
|
#
|
||||||
|
# When uploading crates to the registry Cargo will automatically
|
||||||
|
# "normalize" Cargo.toml files for maximal compatibility
|
||||||
|
# with all versions of Cargo and also rewrite `path` dependencies
|
||||||
|
# to registry (e.g., crates.io) dependencies.
|
||||||
|
#
|
||||||
|
# If you are reading this file be aware that the original Cargo.toml
|
||||||
|
# will likely look very different (and much more reasonable).
|
||||||
|
# See Cargo.toml.orig for the original contents.
|
||||||
|
|
||||||
|
[package]
|
||||||
|
edition = "2015"
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = []
|
||||||
|
build = false
|
||||||
|
include = ["src/main.rs"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
|
description = "foo"
|
||||||
|
documentation = "docs.rs/foo"
|
||||||
|
readme = false
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
|
"#,
|
||||||
|
)],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
@ -4406,10 +4596,34 @@ include = [
|
|||||||
"tests/test_foo.rs",
|
"tests/test_foo.rs",
|
||||||
"benches/bench_foo.rs",
|
"benches/bench_foo.rs",
|
||||||
]
|
]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/bin/foo/main.rs"
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "example_foo"
|
||||||
|
path = "examples/example_foo.rs"
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "test_foo"
|
||||||
|
path = "tests/test_foo.rs"
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "bench_foo"
|
||||||
|
path = "benches/bench_foo.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4444,6 +4658,10 @@ fn discovery_inferred_other_excluded() {
|
|||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[PACKAGING] foo v0.0.1 ([CWD])
|
[PACKAGING] foo v0.0.1 ([CWD])
|
||||||
|
[WARNING] ignoring binary `foo` as `src/bin/foo/main.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring example `example_foo` as `examples/example_foo.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring test `test_foo` as `tests/test_foo.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring benchmark `bench_foo` as `benches/bench_foo.rs` is not included in the published package
|
||||||
[VERIFYING] foo v0.0.1 ([CWD])
|
[VERIFYING] foo v0.0.1 ([CWD])
|
||||||
[COMPILING] foo v0.0.1 ([CWD][..])
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
@ -4477,10 +4695,18 @@ version = "0.0.1"
|
|||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
include = ["src/lib.rs"]
|
include = ["src/lib.rs"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4575,22 +4801,34 @@ include = [
|
|||||||
"tests/test_foo.rs",
|
"tests/test_foo.rs",
|
||||||
"benches/bench_foo.rs",
|
"benches/bench_foo.rs",
|
||||||
]
|
]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
documentation = "docs.rs/foo"
|
documentation = "docs.rs/foo"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "foo"
|
name = "foo"
|
||||||
|
path = "src/bin/foo/main.rs"
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "example_foo"
|
name = "example_foo"
|
||||||
|
path = "examples/example_foo.rs"
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "test_foo"
|
name = "test_foo"
|
||||||
|
path = "tests/test_foo.rs"
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "bench_foo"
|
name = "bench_foo"
|
||||||
|
path = "benches/bench_foo.rs"
|
||||||
"#,
|
"#,
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
@ -4633,20 +4871,60 @@ fn discovery_explicit_other_excluded() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("package")
|
p.cargo("package")
|
||||||
.with_status(101)
|
|
||||||
.with_stdout("")
|
.with_stdout("")
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[PACKAGING] foo v0.0.1 ([CWD])
|
[PACKAGING] foo v0.0.1 ([CWD])
|
||||||
|
[WARNING] ignoring binary `foo` as `src/bin/foo/main.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring example `example_foo` as `examples/example_foo.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring test `test_foo` as `tests/test_foo.rs` is not included in the published package
|
||||||
|
[WARNING] ignoring benchmark `bench_foo` as `benches/bench_foo.rs` is not included in the published package
|
||||||
[VERIFYING] foo v0.0.1 ([CWD])
|
[VERIFYING] foo v0.0.1 ([CWD])
|
||||||
[ERROR] failed to verify package tarball
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
||||||
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
Caused by:
|
[PACKAGED] 4 files, [..] ([..] compressed)
|
||||||
failed to parse manifest at `[CWD]/target/package/foo-0.0.1/Cargo.toml`
|
|
||||||
|
|
||||||
Caused by:
|
|
||||||
can't find `example_foo` example at `examples/example_foo.rs` or `examples/example_foo/main.rs`. Please specify example.path if you want to use a non-default path.
|
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
|
||||||
|
validate_crate_contents(
|
||||||
|
f,
|
||||||
|
"foo-0.0.1.crate",
|
||||||
|
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/lib.rs"],
|
||||||
|
&[(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||||
|
#
|
||||||
|
# When uploading crates to the registry Cargo will automatically
|
||||||
|
# "normalize" Cargo.toml files for maximal compatibility
|
||||||
|
# with all versions of Cargo and also rewrite `path` dependencies
|
||||||
|
# to registry (e.g., crates.io) dependencies.
|
||||||
|
#
|
||||||
|
# If you are reading this file be aware that the original Cargo.toml
|
||||||
|
# will likely look very different (and much more reasonable).
|
||||||
|
# See Cargo.toml.orig for the original contents.
|
||||||
|
|
||||||
|
[package]
|
||||||
|
edition = "2015"
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = []
|
||||||
|
build = false
|
||||||
|
include = ["src/lib.rs"]
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
|
description = "foo"
|
||||||
|
documentation = "docs.rs/foo"
|
||||||
|
readme = false
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
"#,
|
||||||
|
)],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1561,10 +1561,18 @@ You may press ctrl-c [..]
|
|||||||
version = \"0.1.0\"\n\
|
version = \"0.1.0\"\n\
|
||||||
authors = []\n\
|
authors = []\n\
|
||||||
build = false\n\
|
build = false\n\
|
||||||
|
autobins = false\n\
|
||||||
|
autoexamples = false\n\
|
||||||
|
autotests = false\n\
|
||||||
|
autobenches = false\n\
|
||||||
description = \"foo\"\n\
|
description = \"foo\"\n\
|
||||||
readme = false\n\
|
readme = false\n\
|
||||||
license = \"MIT\"\n\
|
license = \"MIT\"\n\
|
||||||
\n\
|
\n\
|
||||||
|
[[bin]]\n\
|
||||||
|
name = \"foo\"\n\
|
||||||
|
path = \"src/main.rs\"\n\
|
||||||
|
\n\
|
||||||
[dependencies.dep1]\n\
|
[dependencies.dep1]\n\
|
||||||
version = \"1.0\"\n\
|
version = \"1.0\"\n\
|
||||||
",
|
",
|
||||||
@ -1675,6 +1683,10 @@ name = "foo"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "foo"
|
homepage = "foo"
|
||||||
documentation = "foo"
|
documentation = "foo"
|
||||||
@ -1682,6 +1694,10 @@ readme = false
|
|||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "foo"
|
repository = "foo"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
"#,
|
"#,
|
||||||
cargo::core::manifest::MANIFEST_PREAMBLE
|
cargo::core::manifest::MANIFEST_PREAMBLE
|
||||||
@ -1936,6 +1952,10 @@ name = "foo"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = []
|
authors = []
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "foo"
|
homepage = "foo"
|
||||||
documentation = "foo"
|
documentation = "foo"
|
||||||
@ -1943,6 +1963,10 @@ readme = false
|
|||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "foo"
|
repository = "foo"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies.normal-and-dev]
|
[dependencies.normal-and-dev]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
features = ["cat"]
|
features = ["cat"]
|
||||||
|
@ -631,11 +631,19 @@ edition = "2015"
|
|||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
build = false
|
build = false
|
||||||
|
autobins = false
|
||||||
|
autoexamples = false
|
||||||
|
autotests = false
|
||||||
|
autobenches = false
|
||||||
description = "foo"
|
description = "foo"
|
||||||
homepage = "https://example.com/"
|
homepage = "https://example.com/"
|
||||||
readme = false
|
readme = false
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "foo"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies.bar]
|
[dependencies.bar]
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
optional = true
|
optional = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user