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

Rename Cargo.toml to Cargo.text in the init template files #1206

Conversation

elizabethengelman
Copy link
Contributor

@elizabethengelman elizabethengelman commented Feb 21, 2024

What

Updates the init template Cargo file from Cargo.toml to Cargo.text.

Why

We were seeing a failure with the dry-run:
https://github.com/stellar/soroban-cli/actions/runs/7983365311/job/21798405675

Slack thread with discussion about the problem: https://aha-labs.slack.com/archives/C04B02ABF37/p1708486449196609

This is due to a known cargo issue: rust-lang/cargo#9017

If a subdirectory includes a Cargo.toml file, it will be viewed as a sub-package, and therefore the contents of the directory will not be included in the package. Since we are including this Cargo.toml to be used as a template for writing a file to the user's fs, and it is not to be used as a sub-package, I've changed the name of the file to Cargo.text in this source code. Then when the file is being copied into the project that is being created on the user's machine, the file name is written as Cargo.toml, as expected.

From the cargo book docs:

Regardless of whether exclude or include is specified, the following files are always excluded:

Any sub-packages will be skipped (any subdirectory that contains a Cargo.toml file).
A directory named target in the root of the package will be skipped.

I tested this locally by recreating the steps in the dry-run, that @2opremio outlined in the slack convo, and was able to get through cargo-hack hack --feature-powerset --ignore-private --config "source.crates-io.replace-with = 'vendored-sources'" --config "source.vendored-sources.directory = 'vendor'" package without error.

@2opremio
Copy link
Contributor

2opremio commented Feb 21, 2024

Thanks!

I would personally use something more obvious, in the lines of Cargo.toml.removeextension or Cargo.toml.extensionworkaround

@elizabethengelman
Copy link
Contributor Author

I would personally use something more obvious, in the lines of Cargo.toml.removeextension or Cargo.toml.extensionworkaround

Great point. I'll push up a change shortly.

@elizabethengelman elizabethengelman marked this pull request as ready for review February 21, 2024 17:55
@Shaptic Shaptic merged commit 53ee2e6 into stellar:main Feb 21, 2024
13 checks passed
@2opremio 2opremio deleted the fix/ensure-init-template-files-included-in-package branch February 21, 2024 18:17
@2opremio
Copy link
Contributor

2opremio commented Feb 22, 2024

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.

3 participants