Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Adding feature-flags to cargo publish and cargo package #6453

Merged
merged 5 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Undoing bad formatting changes and removing redundant struct fields
  • Loading branch information
spacekookie committed Dec 29, 2018
commit 40cca8058d1126cf4ec89feb08c9bf317662dd8f
1 change: 0 additions & 1 deletion src/bin/cargo/commands/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
allow_dirty: args.is_present("allow-dirty"),
target: args.target(),
jobs: args.jobs()?,
registry: None,
features: args._values_of("features"),
all_features: args.is_present("all-features"),
},
Expand Down
1 change: 0 additions & 1 deletion src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct PackageOpts<'cfg> {
pub verify: bool,
pub jobs: Option<u32>,
pub target: Option<String>,
pub registry: Option<String>,
pub features: Vec<String>,
pub all_features: bool,
}
Expand Down
1 change: 0 additions & 1 deletion src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
allow_dirty: opts.allow_dirty,
target: opts.target.clone(),
jobs: opts.jobs,
registry: opts.registry.clone(),
features: opts.features.clone(),
all_features: opts.all_features,
},
Expand Down
4 changes: 0 additions & 4 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,8 +1305,6 @@ fn package_with_select_features() {
.file(
"Cargo.toml",
r#"
cargo-features = ["alternative-registries"]

[project]
name = "foo"
version = "0.0.1"
Expand Down Expand Up @@ -1337,8 +1335,6 @@ fn package_with_all_features() {
.file(
"Cargo.toml",
r#"
cargo-features = ["alternative-registries"]

[project]
name = "foo"
version = "0.0.1"
Expand Down
57 changes: 38 additions & 19 deletions tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ fn simple() {
license = "MIT"
description = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --no-verify --index")
Expand Down Expand Up @@ -96,7 +97,8 @@ fn old_token_location() {
license = "MIT"
description = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --no-verify --index")
Expand Down Expand Up @@ -162,7 +164,8 @@ fn simple_with_host() {
license = "MIT"
description = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --no-verify --host")
Expand Down Expand Up @@ -237,7 +240,8 @@ fn simple_with_index_and_host() {
license = "MIT"
description = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --no-verify --index")
Expand Down Expand Up @@ -315,7 +319,8 @@ fn git_deps() {
[dependencies.foo]
git = "git://path/to/nowhere"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish -v --no-verify --index")
Expand Down Expand Up @@ -351,7 +356,8 @@ fn path_dependency_no_version() {
[dependencies.bar]
path = "bar"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
.file("bar/src/lib.rs", "")
.build();
Expand Down Expand Up @@ -384,7 +390,8 @@ fn unpublishable_crate() {
description = "foo"
publish = false
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --index")
Expand Down Expand Up @@ -417,7 +424,8 @@ fn dont_publish_dirty() {
homepage = "foo"
repository = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --index")
Expand Down Expand Up @@ -456,7 +464,8 @@ fn publish_clean() {
homepage = "foo"
repository = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --index")
Expand Down Expand Up @@ -484,7 +493,8 @@ fn publish_in_sub_repo() {
homepage = "foo"
repository = "foo"
"#,
).file("bar/src/main.rs", "fn main() {}")
)
.file("bar/src/main.rs", "fn main() {}")
.build();

p.cargo("publish")
Expand Down Expand Up @@ -514,7 +524,8 @@ fn publish_when_ignored() {
homepage = "foo"
repository = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.file(".gitignore", "baz")
.build();

Expand Down Expand Up @@ -594,7 +605,8 @@ fn dry_run() {
license = "MIT"
description = "foo"
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --dry-run --index")
Expand Down Expand Up @@ -635,7 +647,8 @@ fn block_publish_feature_not_enabled() {
"test"
]
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --registry alternative -Zunstable-options")
Expand Down Expand Up @@ -676,7 +689,8 @@ fn registry_not_in_publish_list() {
"test"
]
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish")
Expand Down Expand Up @@ -711,7 +725,8 @@ fn publish_empty_list() {
description = "foo"
publish = []
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --registry alternative -Zunstable-options")
Expand Down Expand Up @@ -747,7 +762,8 @@ fn publish_allowed_registry() {
homepage = "foo"
publish = ["alternative"]
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --registry alternative -Zunstable-options")
Expand All @@ -773,7 +789,8 @@ fn block_publish_no_registry() {
description = "foo"
publish = []
"#,
).file("src/main.rs", "fn main() {}")
)
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("publish --registry alternative -Zunstable-options")
Expand Down Expand Up @@ -809,7 +826,8 @@ fn publish_with_select_features() {
required = []
optional = []
"#,
).file(
)
.file(
"src/main.rs",
"#[cfg(not(required))]
compile_error!(\"This crate requires `required` feature!\");
Expand Down Expand Up @@ -849,7 +867,8 @@ fn publish_with_all_features() {
required = []
optional = []
"#,
).file(
)
.file(
"src/main.rs",
"#[cfg(not(required))]
compile_error!(\"This crate requires `required` feature!\");
Expand Down