Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package.include to Cargo.toml #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Aug 3, 2024

See the Cargo documentation on package.include.

When using cargo publish every file is included and uploaded, even the shell files used to generate bindings not necessary during build time. Using package.include we can make sure that this doesn't happen and only what the user needs to compile the package or generate local documentation is included.

@ardocrat
Copy link

ardocrat commented Aug 4, 2024

Good catch, but I guess you can setup this at your application, not at lib level?

@daxpedda
Copy link
Contributor Author

daxpedda commented Aug 4, 2024

Good catch, but I guess you can setup this at your application, not at lib level?

Not sure what you mean, this is about crates.io releases.
Or do people use cargo publish for something else?

android-activity/Cargo.toml Outdated Show resolved Hide resolved
android-activity/Cargo.toml Outdated Show resolved Hide resolved
@daxpedda daxpedda requested a review from MarijnS95 August 5, 2024 08:06
Copy link
Member

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question: how is README.md from the root of this repo getting into the android-activity subfolder? I don't see a symlink of sorts but it's in the packaged crate: https://docs.rs/crate/android-activity/latest/source/README.md

@daxpedda
Copy link
Contributor Author

daxpedda commented Aug 5, 2024

One more question: how is README.md from the root of this repo getting into the android-activity subfolder? I don't see a symlink of sorts but it's in the packaged crate: https://docs.rs/crate/android-activity/latest/source/README.md

Its getting it from the package.readme field, which correctly points to the README file.
But its missing in the documentation that the README is included by default, so that's interesting.

This reduces package size and notably prevents any bash files from landing on a users device.
@MarijnS95
Copy link
Member

Its getting it from the package.readme field, which correctly points to the README file.

Ah, I didn't see that there's a ../ in there which, typically, it's not allowed to go outside of the crate root. Guess cargo makes an exception for singular files with an explicit location.

But its missing in the documentation that the README is included by default, so that's interesting.

Yeah, that's correct.

@MarijnS95 MarijnS95 requested a review from rib August 6, 2024 11:50
Copy link
Collaborator

@rib rib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this looks good to me too, thanks!

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.

4 participants