Skip to content

Commit

Permalink
Add a warning if both package.include and package.exclude are specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed May 10, 2019
1 parent 3ca96e9 commit db3328e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult<Option

verify_dependencies(pkg)?;

if !pkg.manifest().exclude().is_empty() && !pkg.manifest().include().is_empty() {
config.shell().warn(
"both package.include and package.exclude are specified; \
the exclude list will be ignored",
)?;
}
// `list_files` outputs warnings as a side effect, so only do it once.
let src_files = src.list_files(pkg)?;

Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ fn include() {
"\
[WARNING] manifest has no description[..]
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
[WARNING] both package.include and package.exclude are specified; the exclude list will be ignored
[PACKAGING] foo v0.0.1 ([..])
[ARCHIVING] [..]
[ARCHIVING] [..]
Expand Down

0 comments on commit db3328e

Please sign in to comment.