Skip to content

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?

@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.

@daxpedda daxpedda force-pushed the publish-include branch 2 times, most recently from 733ad68 to 80e86d7 Compare August 5, 2024 08:34
@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
Member

@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!

@rib rib force-pushed the publish-include branch from 80e86d7 to 84432a9 Compare August 11, 2025 11:34
@rib
Copy link
Member

rib commented Aug 11, 2025

Since merging the update to GameActivity 4.0, I've tweaked this to include /android-games-sdk instead of /game-activity-csrc (which no longer exists)

This reduces package size and notably prevents any bash files from landing on a users device.
@rib rib force-pushed the publish-include branch from 84432a9 to a262d3e Compare August 11, 2025 12:16
@rib rib merged commit 1652ebb into rust-mobile:main Aug 11, 2025
3 checks passed
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