Skip to content

Commit 8d4db3e

Browse files
committed
Auto merge of #7905 - ehuss:license-file-updates, r=alexcrichton
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
2 parents d6fa260 + 9088770 commit 8d4db3e

File tree

7 files changed

+495
-208
lines changed

7 files changed

+495
-208
lines changed

src/cargo/core/package.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ impl Package {
203203
}
204204

205205
pub fn to_registry_toml(&self, config: &Config) -> CargoResult<String> {
206-
let manifest = self.manifest().original().prepare_for_publish(config)?;
206+
let manifest = self
207+
.manifest()
208+
.original()
209+
.prepare_for_publish(config, self.root())?;
207210
let toml = toml::to_string(&manifest)?;
208211
Ok(format!(
209212
"# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO\n\

0 commit comments

Comments
 (0)