volks73 / cargo-wix

A cargo subcommand to build Windows installers for rust projects using the WiX Toolset
https://volks73.github.io/cargo-wix
Apache License 2.0
314 stars 26 forks source link

Add a --profile flag to be more general than --debug-build #198

Closed Gankra closed 1 year ago

Gankra commented 1 year ago

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
Gankra commented 1 year ago

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

Gankra commented 1 year ago

Oh right, tests, will do.

Gankra commented 1 year ago

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 commented 1 year ago

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 commented 2 months ago

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 commented 2 months ago

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