pub struct Builder<'a> { /* private fields */ }
Expand description
A builder for running the cargo wix
subcommand.
Implementations§
source§impl<'a> Builder<'a>
impl<'a> Builder<'a>
sourcepub fn bin_path(&mut self, b: Option<&'a str>) -> &mut Self
pub fn bin_path(&mut self, b: Option<&'a str>) -> &mut Self
Sets the path to the WiX Toolset’s bin
folder.
The WiX Toolset’s bin
folder should contain the needed candle.exe
and light.exe
applications. The default is to use the WIX system
environment variable that is created during installation of the WiX
Toolset. This will override any value obtained from the environment.
sourcepub fn capture_output(&mut self, c: bool) -> &mut Self
pub fn capture_output(&mut self, c: bool) -> &mut Self
Enables or disables capturing of the output from the builder (cargo
),
compiler (candle
), linker (light
), and signer (signtool
).
The default is to capture all output, i.e. display nothing in the console but the log statements.
sourcepub fn compiler_args(&mut self, c: Option<Vec<&'a str>>) -> &mut Self
pub fn compiler_args(&mut self, c: Option<Vec<&'a str>>) -> &mut Self
Adds an argument to the compiler command.
This “passes” the argument directly to the WiX compiler (candle.exe). See the help documentation for the WiX compiler for information about valid options and flags.
sourcepub fn culture(&mut self, c: Option<&'a str>) -> &mut Self
pub fn culture(&mut self, c: Option<&'a str>) -> &mut Self
Sets the culture to use with the linker (light.exe) for building a localized installer.
This value will override any defaults and skip looking for a value in
the [package.metadata.wix]
section of the package’s manifest
(Cargo.toml).
sourcepub fn debug_build(&mut self, d: bool) -> &mut Self
pub fn debug_build(&mut self, d: bool) -> &mut Self
Builds the package with the Debug profile instead of the Release profile.
See the Cargo book for more information about release profiles. The
default is to use the Release profile when creating the installer. This
value is ignored if the no_build
method is set to true
.
sourcepub fn debug_name(&mut self, d: bool) -> &mut Self
pub fn debug_name(&mut self, d: bool) -> &mut Self
Appends -debug
to the file stem for the installer (msi).
If true
, then -debug
is added as suffix to the file stem (string
before the dot and file extension) for the installer’s file name. For
example, if true
, then file name would be
example-0.1.0-x86_64-debug.msi
. The default is to not append the
-debug
because the Release profile is the default.
Generally, this should be used in combination with the debug_build
method to indicate the installer is for a debugging variant of the
installed binary.
sourcepub fn includes(&mut self, i: Option<Vec<&'a str>>) -> &mut Self
pub fn includes(&mut self, i: Option<Vec<&'a str>>) -> &mut Self
Adds multiple WiX Source (wxs) files to the creation of an installer.
By default, any .wxs
file located in the project’s wix
folder will
be included in the creation of an installer for the project. This method
adds, or appends, to the list of .wxs
files. The value is a relative
or absolute path.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn input(&mut self, i: Option<&'a str>) -> &mut Self
pub fn input(&mut self, i: Option<&'a str>) -> &mut Self
Sets the path to a package’s manifest (Cargo.toml) file.
A package’s manifest is used to create an installer. If no path is
specified, then the current working directory (CWD) is used. An error
will occur if there is no Cargo.toml
file in the CWD or at the
specified path. Either an absolute or relative path is valid.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn linker_args(&mut self, l: Option<Vec<&'a str>>) -> &mut Self
pub fn linker_args(&mut self, l: Option<Vec<&'a str>>) -> &mut Self
Adds an argument to the linker command.
This “passes” the argument directly to the WiX linker (light.exe). See the help documentation for the WiX compiler for information about valid options and flags.
sourcepub fn locale(&mut self, l: Option<&'a str>) -> &mut Self
pub fn locale(&mut self, l: Option<&'a str>) -> &mut Self
Sets the path to a WiX localization file, .wxl
, for the linker
(light.exe).
The WiX localization file is an XML file that contains localization strings.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn name(&mut self, p: Option<&'a str>) -> &mut Self
pub fn name(&mut self, p: Option<&'a str>) -> &mut Self
Sets the name.
The default is to use the name
field under the [package]
section of
the package’s manifest (Cargo.toml). This overrides that value.
The installer (msi) that is created will be named in the following
format: “name-major.minor.patch-platform.msi”, where name is the value
specified with this method or the value from the name
field under the
[package]
section, the major.minor.patch is the version number from
the package’s manifest version
field or the value specified at the
command line, and the platform is either “i686” or “x86_64” depending
on the build environment.
This does not change the name of the executable that is installed. The name of the executable can be changed by modifying the WiX Source (wxs) file with a text editor.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn no_build(&mut self, n: bool) -> &mut Self
pub fn no_build(&mut self, n: bool) -> &mut Self
Skips the building of the project with the release profile.
If true
, the project will not be built using the release profile,
i.e. the cargo build --release
command will not be executed. The
default is to build the project before each creation. This is useful if
building the project is more involved or is handled in a separate
process.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn target_bin_dir(&mut self, p: Option<&'a str>) -> &mut Self
pub fn target_bin_dir(&mut self, p: Option<&'a str>) -> &mut Self
Specifies that binaries should be sourced from the given directory.
Specifically this sets CargoTargetBinDir
in wxs templates. It is
intended to be combined with no_build(true)
to let another tool
orchestrate cargo-wix and handle the builds for it.
sourcepub fn install(&mut self, n: bool) -> &mut Self
pub fn install(&mut self, n: bool) -> &mut Self
Runs the installer after creating it.
If true
, the MSI installer will be created and then launched. This will
automatically open the installation wizard for the project and allow the
user to install it.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn output(&mut self, o: Option<&'a str>) -> &mut Self
pub fn output(&mut self, o: Option<&'a str>) -> &mut Self
Sets the output file and destination.
The default is to create a MSI file with the
<product-name>-<version>-<arch>.msi
file name and extension in the
target\wix
folder. Use this method to override the destination and
file name of the Windows installer.
If the path is to an existing folder or contains a trailing slash
(forward or backward), then the default MSI file name is used, but the
installer will be available at the specified path. When specifying a
file name and path, the .msi
file is not required. It will be added
automatically.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn package(&mut self, p: Option<&'a str>) -> &mut Self
pub fn package(&mut self, p: Option<&'a str>) -> &mut Self
Sets the package.
If the project is organized using a workspace, this selects the package by name to create an installer. If a workspace is not used, then this has no effect.
sourcepub fn target(&mut self, v: Option<&'a str>) -> &mut Self
pub fn target(&mut self, v: Option<&'a str>) -> &mut Self
Sets the build target.
The default is to use the default target for the environment. Use this
method to change the target for the build and installer creation. The
value should be a string from the rustc --print target-list
command.
This enables “cross-compilation” of installers similar to the
cross-compilation of Rust code, but only for Windows targets.
sourcepub fn version(&mut self, v: Option<&'a str>) -> &mut Self
pub fn version(&mut self, v: Option<&'a str>) -> &mut Self
Sets the version.
This overrides the version
field of the package’s manifest
(Cargo.toml). The version should be in the “Major.Minor.Patch” notation.
This value will override any default and skip looking for a value in the
[package.metadata.wix]
section of the package’s manifest (Cargo.toml).
sourcepub fn build(&mut self) -> Execution
pub fn build(&mut self) -> Execution
Builds a context for creating, or building, the installer.