Skip to content

Commit

Permalink
Auto merge of #7905 - ehuss:license-file-updates, r=alexcrichton
Browse files Browse the repository at this point in the history
Better support for license-file.

This adds some changes to how `cargo package` and `cargo publish` handle the `license-file` field. This also incorporates some refactoring which hopefully makes the code a little clearer and straightforward, but which also resulted in some minor behavior changes.

* Warn if license-file points to a non-existent file.
* Automatically include license-file, even if it is not listed in the `package.include` list (similar to how Cargo.toml/lock are automatically included).
* If license-file points outside of the package root, copy the file to the package root (and rewrite the field in Cargo.toml).
* Files are now sorted when archived.
* `Archiving: Cargo.toml.orig` is explicitly printed where before it did not report that.
* `cargo package --list` now shows `Cargo.toml.orig` where before it was not reported.

Closes #3537
Closes #7830
  • Loading branch information
bors committed Feb 20, 2020
2 parents d6fa260 + 9088770 commit 8d4db3e
Show file tree
Hide file tree
Showing 7 changed files with 495 additions and 208 deletions.
5 changes: 4 additions & 1 deletion src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ impl Package {
}

pub fn to_registry_toml(&self, config: &Config) -> CargoResult<String> {
let manifest = self.manifest().original().prepare_for_publish(config)?;
let manifest = self
.manifest()
.original()
.prepare_for_publish(config, self.root())?;
let toml = toml::to_string(&manifest)?;
Ok(format!(
"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\
Expand Down
Loading

0 comments on commit 8d4db3e

Please sign in to comment.