From 8ce099470b1e979e5429545b605ae680303db478 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 14 Apr 2024 15:27:23 -0700 Subject: [PATCH] cargo: explicitly indicate paths to publish Running `cargo publish` from a non-colocated repo (such as my usual repo) is currently quite scary because it uploads all non-hidden files, even if they're ignored by `.gitignore` (https://github.com/rust-lang/cargo/issues/2063). I noticed this a while ago and have always run the command from a fresh clone since then. To avoid the need for that, let's use the workaround mentioned on the bug, which is to explicitly list patterns we want to publish. --- cli/Cargo.toml | 12 ++++++++++++ lib/Cargo.toml | 10 ++++++++++ lib/proc-macros/Cargo.toml | 2 ++ 3 files changed, 24 insertions(+) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 1444902a5..8d2b41c51 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -13,6 +13,18 @@ repository = { workspace = true } documentation = { workspace = true } keywords = { workspace = true } +include = [ + "/LICENSE", + "/build.rs", + "/examples/", + "/src/", + "/testing/", + "/tests/", + "!*.pending-snap", + "!*.snap*", + "/tests/cli-reference@.md.snap" +] + [[bin]] name = "jj" path = "src/main.rs" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 760578f8a..d7a68f6a1 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,6 +12,16 @@ repository = { workspace = true } documentation = { workspace = true } readme = { workspace = true } +include = [ + "/LICENSE", + "/benches/", + "/src/", + "/tests/", + "!*.pending-snap", + "!*.snap*", +] + + [[test]] name = "runner" diff --git a/lib/proc-macros/Cargo.toml b/lib/proc-macros/Cargo.toml index 4bba85cfc..e26bfa26b 100644 --- a/lib/proc-macros/Cargo.toml +++ b/lib/proc-macros/Cargo.toml @@ -11,6 +11,8 @@ repository = { workspace = true } documentation = { workspace = true } readme = { workspace = true } +include = ["/LICENSE", "/src/"] + [lib] proc-macro = true