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

cargo-package ignores sub-directories containing Cargo.toml #9643

Closed
tmplt opened this issue Jul 1, 2021 · 2 comments
Closed

cargo-package ignores sub-directories containing Cargo.toml #9643

tmplt opened this issue Jul 1, 2021 · 2 comments
Labels
C-bug Category: bug Command-package S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@tmplt
Copy link

tmplt commented Jul 1, 2021

Problem

I am trying to publish a crate which builds adhoc crates during run-time. For this reason, I include_dir::include_dir!("assets/libadhoc"). This assets/libadhoc/ contains a Cargo.toml which is then written to disk and modified during run-time. However, on a cargo publish this directory is not copied to target/package/, even with package.include = ["*"] in the parent Cargo.toml.

Steps

$ cargo init --bin project && cd project
$ mkdir assets
$ touch assets/Cargo.toml
$ cargo package --list
Cargo.toml
src/main.rs

Possible Solution(s)

I figure **/Cargo.toml are ignored for a reason, but this is not documented in cargo-package(1). I suggest an amend.

Further, I cannot find a way to override this behavior. I suggest making that possible. Alternatively/additionally, I suggest adding an environmental variable that points to the generated target/package/project-0.1.0/ so that I can copy the files myself.

For now, I'll rename the file to not-Cargo.toml and rename it during run-time so that I can publish my crate.

Notes

Output of cargo version: cargo 1.52.0 (6976741 2021-04-21)

@tmplt tmplt added the C-bug Category: bug label Jul 1, 2021
tmplt added a commit to rtic-scope/cargo-rtic-scope that referenced this issue Jul 1, 2021
@gdesmott
Copy link

I'm having a similar problem with system-deps. My tests use a bunch of sub-directories containing a Cargo.toml which are not included in the package.

I think it's because cargo package does not recurse in dir containing a Cargo.toml. While it makes sense for the default, it should be overridable using the package.include field but it's not at the moment.

@epage epage added the S-triage Status: This issue is waiting on initial triage. label Nov 20, 2024
@weihanglo weihanglo added S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-triage Status: This issue is waiting on initial triage. S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. labels Dec 29, 2024
@weihanglo
Copy link
Member

I'll close this in favor of #8597, as this seems a duplicate. Thank you for the input and MRE!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-package S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

5 participants