cargo-wix icon indicating copy to clipboard operation
cargo-wix copied to clipboard

Add `-B,--build-arg` option for the `cargo build` stage of the default subcommand

Open elpiel opened this issue 1 year ago • 5 comments

With cargo-deb you have the ability to set specific features that you want to use when building the package. It would be great to include such ability in cargo-wix as now you have to build manually with the given feature(s) and run cargo-wix with --no-build.

Our use case is that we distinguish between installed app and running with cargo run because of some binaries locations.

elpiel avatar Jan 09 '23 13:01 elpiel

My understanding was the features feature of cargo-deb was for defining a set of properties/flags/arguments like Profiles, but there are the -C and -L options that pass arguments to the candle.exe and light.exe applications for building the installer. To clarify, you would like something similar, like -B, to pass arguments to cargo for the cargo build "stage" of the cargo wix default subcommand?

To note, the -B option is already used for the init and print subcommands but not the cargo wix default command. I could see adding the -B,--build-arg option. Again, assuming this is what you are requesting.

volks73 avatar Jan 09 '23 17:01 volks73

yes, build arguments (cli) or features (config) to build the binaries with. For the config, I really like the simple cargo-deb approach of specifying the features with a key.

For the CLI --build-args seems reasonable. cargo-deb uses --cargo-build but that overrides the whole cargo command, i.e. if you want to build with features (and I have to verify, though, if -- --features=... is actually used by cargo build):

cargo deb --cargo-build build -- --features=bundled

elpiel avatar Jan 10 '23 11:01 elpiel

Got it. I see cargo deb uses the -- syntax for passing additional arguments to the cargo build command. This appears to be the convention for various cargo subcommands that pass additional arguments to the underlying binary, such as passing arguments to rustc.

While this is the convention and I like to follow conventions as much as possible, I am leaning towards the -B,--build-arg option to be consistent with the -C and -L options. There are three binaries at work with the default cargo wix subcommand: (1) cargo build, (2) candle.exe, and (3) light.exe. I believe the cargo convention of using -- to pass additional arguments works well because there is only one underlying binary per subcommand/action. With three, it could be a little confusing and then having it work just for the cargo build binary but needing to use options for the Candle and Light binaries would be inconsistent and an exception that needed to be documented and heavily noted. A -B option is feels cleaner and more consistent at the moment.

volks73 avatar Jan 10 '23 15:01 volks73

I have renamed the issue to be more descriptive and focused to the requested enhancement. I would also greatly appreciate and welcome any PR that implements this enhancement.

volks73 avatar Jan 10 '23 15:01 volks73

@elpiel While the -B,--build-arg has not been added to the CLI, does #198 work for the configuration aspect?

volks73 avatar Sep 06 '23 13:09 volks73