Skip to content

Use package.include to remove the reference implementation which isn't necessary for building#29

Open
42triangles wants to merge 1 commit intorust-lang:mainfrom
42triangles:main
Open

Use package.include to remove the reference implementation which isn't necessary for building#29
42triangles wants to merge 1 commit intorust-lang:mainfrom
42triangles:main

Conversation

@42triangles
Copy link
Copy Markdown

@42triangles 42triangles commented Feb 9, 2026

This decreases the packaged size to less than half:

# of files uncompressed compressed
before 35 355.5KiB 82.9KiB
with package.include 15 (42.9%) 122.9KiB (34.6%) 30.1KiB (36.3%)
with tests¹ 20 (57.1%) 166.5KiB (46.9%) 37.4KiB (45.1%)

And beyond that allows easier dependency reviews (though that is in this
case much less important since everything rust-lang is likely trusted
anyways)

This now includes (output from cargo package --list):

.cargo_vcs_info.json
Cargo.lock
Cargo.toml
Cargo.toml.orig
LICENSE.txt
Readme.md
src/alignment.rs
src/archive.rs
src/archive_writer.rs
src/coff.rs
src/coff_import_file.rs
src/lib.rs
src/mangler.rs
src/math_extras.rs
src/object_reader.rs

¹ Using the version below (which includes tests as well):

include = ["/src", "/tests", "/LICENSE.txt", "/Readme.md"]

The additionally included files would be:

tests/common.rs
tests/import_library.def
tests/import_library.rs
tests/multiple_objects.rs
tests/round_trip.rs

…t necessary for building

This decreases the packaged size to less than half:

|                        | # of files | uncompressed     | compressed      |
| ---------------------- | ---------- | ---------------- | --------------- |
| before                 | 35         | 355.5KiB         | 82.9KiB         |
| with `package.include` | 15 (42.9%) | 122.9KiB (34.6%) | 30.1KiB (36.3%) |
| with tests¹            | 20 (57.1%) | 166.5KiB (46.9%) | 37.4KiB (45.1%) |

And beyond that allows easier dependency reviews (though that is in this
case much less important since everything `rust-lang` is likely trusted
anyways)

This now includes (output from `cargo package --list`):
```
.cargo_vcs_info.json
Cargo.lock
Cargo.toml
Cargo.toml.orig
LICENSE.txt
Readme.md
src/alignment.rs
src/archive.rs
src/archive_writer.rs
src/coff.rs
src/coff_import_file.rs
src/lib.rs
src/mangler.rs
src/math_extras.rs
src/object_reader.rs
```

¹ Using the version below (which includes tests as well):
```rust
include = ["/src", "/tests", "/LICENSE.txt", "/Readme.md"]
```
The additionally included files would be:
```
tests/common.rs
tests/import_library.def
tests/import_library.rs
tests/multiple_objects.rs
tests/round_trip.rs
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant