From 156c65123f9c1564b7e66802d68d9c2cb3ea62e8 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 28 Apr 2020 10:49:03 -0700 Subject: [PATCH] Allow `cargo package --list` even for things that don't package. --- src/cargo/ops/cargo_package.rs | 32 +++++++++++------ tests/testsuite/package.rs | 55 +++++++++++++++++++++++++++-- tests/testsuite/publish_lockfile.rs | 4 +-- tests/testsuite/registry.rs | 15 +++++--- 4 files changed, 86 insertions(+), 20 deletions(-) diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 5dcdd2ff4ed..b9aa42fc4cb 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -50,8 +50,17 @@ struct ArchiveFile { enum FileContents { /// Absolute path to the file on disk to add to the archive. OnDisk(PathBuf), - /// Contents of a file generated in memory. - Generated(String), + /// Generates a file. + Generated(GeneratedFile), +} + +enum GeneratedFile { + /// Generates `Cargo.toml` by rewriting the original. + Manifest, + /// Generates `Cargo.lock` in some cases (like if there is a binary). + Lockfile, + /// Adds a `.cargo-vcs_info.json` file if in a (clean) git repo. + VcsInfo(String), } pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult> { @@ -71,8 +80,6 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult