Skip to content

Commit

Permalink
Exclude more files from the published crate (#591)
Browse files Browse the repository at this point in the history
There was an incorrect glob `bench/*` that was doing nothing, since the
benchmarks are in `benches/`; when I corrected it to `benches/*`, `cargo
publish --dry-run` failed:

```
error: failed to verify package tarball

Caused by:
  failed to parse manifest at `/home/ben/src/forks/oxipng/target/package/oxipng-9.0.0/Cargo.toml`

Caused by:
  can't find `zopfli` bench at `benches/zopfli.rs` or `benches/zopfli/main.rs`. Please specify bench.path if you want to use a non-default path.
```

…so I stopped trying to exclude the benchmarks from published crates at
all.

-----

Then, I added `Dockerfile`, `index.html`, and `scripts/` to the list of
paths to exclude from published crates.

Finally, I added some unnecessary “dotfiles” to the list of paths to
exclude from published crates.

-----

Some of this was suggested in a [package review for Fedora
Linux](https://bugzilla.redhat.com/show_bug.cgi?id=2259760).

After the PR:

```
$ cargo package --list
.cargo/config.toml
.cargo_vcs_info.json
CHANGELOG.md
Cargo.lock
Cargo.toml
Cargo.toml.orig
LICENSE
MANUAL.txt
README.md
benches/deflate.rs
[…]
benches/zopfli.rs
src/atomicmin.rs
[…]
src/sanity_checks.rs
$ cargo publish --dry-run
[…]
   Compiling oxipng v9.0.0 (/home/ben/src/forks/oxipng/target/package/oxipng-9.0.0)
    Finished dev [optimized + debuginfo] target(s) in 15.76s
    Packaged 37 files, 255.4KiB (61.6KiB compressed)
   Uploading oxipng v9.0.0 (/home/ben/src/forks/oxipng)
warning: aborting upload due to dry run
```
  • Loading branch information
musicinmybrain authored Feb 17, 2024
1 parent 1b500da commit 4cb8296
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ categories = ["command-line-utilities", "compression"]
description = "A lossless PNG compression optimizer"
documentation = "https://docs.rs/oxipng"
edition = "2021"
exclude = ["tests/*", "bench/*"]
exclude = [
".editorconfig",
".gitattributes",
".github/*",
".gitignore",
".pre-commit-hooks.yaml",
"Dockerfile",
"scripts/*",
"tests/*",
]
homepage = "https://github.com/shssoichiro/oxipng"
license = "MIT"
name = "oxipng"
Expand Down
1 change: 0 additions & 1 deletion index.html

This file was deleted.

0 comments on commit 4cb8296

Please sign in to comment.