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 a --profile flag to be more general than --debug-build #198

Merged
merged 3 commits into from
Aug 18, 2023

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Aug 17, 2023

This also does some driveby fixes to add .action(ArgAction::SetTrue)) to a bunch of --flags because a breaking change was made to clap:

https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#migrating


I'm experimenting with adding support for cargo-wix, but to avoid duplicate builds I want to use --no-build (and as far as I can tell cargo-wix doesn't set any particularly special cargo/rust build flags, so we aren't messing up something important by doing that).

However cargo-dist sets --profile=dist which changes the directory the binaries end up in, so I need cargo-wix to be able to take an arbitrary --profile. Thankfully this is very easy to do, as you already made all your logic work with an abitrary profile string.

For the record the specific invocation I would use would look like:

cargo wix --no-build --profile=dist --target=x86_64-pc-windows-msvc -o target/distrib/cargodisttest.msi

This also does some driveby fixes to add `.action(ArgAction::SetTrue))` to a bunch of --flags
because a breaking change was made to clap:

https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#migrating
Copy link
Owner

@volks73 volks73 left a comment

Choose a reason for hiding this comment

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

Thank you for the PR.

I understand the need and I like the flexibility with defining other profiles.

I am not sure what is going on with the tests and CI. Would you be able to take a look and possibly add a test that uses the new --profile argument?

* Limit assert_fs to 1.0.12 (1.0.13 requires rust 1.65.0
* Add rust-version field so that devs know we care about msrv
* Add Cargo.lock so the CLI's build is reproducible
@Gankra
Copy link
Contributor Author

Gankra commented Aug 18, 2023

pushed a potential fix (only the dependency change really matters, but figured I'd toss in the rest)

@Gankra
Copy link
Contributor Author

Gankra commented Aug 18, 2023

Oh right, tests, will do.

@Gankra
Copy link
Contributor Author

Gankra commented Aug 18, 2023

Great call on the tests -- I had tested things pretty thoroughly for my exact usecase but completely blanked on testing (and apparently implementing!) actual builds. Some extra logic was required to deal with the mismatch between builtin profile names and the output dirs they go to.

I also fixed some broken doctests, because your CI wasn't testing docs (unfortunately according to cargo test's docs, --all-targets is a trick:

--all-targets
    Test all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.

--doc
    Test only the library’s documentation. This cannot be mixed with other target options. 

Running rustdoc with -Dwarnings gets the desired functionality, so I added that to your CI.

@volks73
Copy link
Owner

volks73 commented Aug 18, 2023

Thank you for tests. They are really appreciated and look great.

I missed the doc builds for the CI. Nice catch. This is ready merge. Thank you.

@KGrewal1
Copy link

KGrewal1 commented Aug 7, 2024

Hi - was looking for this setting and found this PR - is this documented anywhere (along with what flags it is incompatible with), the docs don't appear to have this! Does appear in the cli --help tho so may have just been looking in wrong place.

@volks73
Copy link
Owner

volks73 commented Aug 7, 2024

@KGrewal1 The online documentation might be out-of-sync. The --help documentation is the "source of truth" for supported functionality and flags. It does appear the online documentation is missing any mention of this feature.

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