Giter Club home page Giter Club logo

cargo-wix's People

Contributors

arbitrix avatar coding-badly avatar cstkingkey avatar davidkna avatar dependabot[bot] avatar elpiel avatar filips123 avatar gankra avatar l-as avatar orhun avatar printfn avatar roblabla avatar roylaurie avatar serpilliere avatar slonopotamus avatar volks73 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cargo-wix's Issues

Add reading WIX_PATH environment variable

If the WIX_PATH environment variable exists, then this subcommand should use the value of the environment variable as the path to the WiX Toolset's bin folder, i.e. where the candle.exe and light.exe applications are located. If it is not set, then it is assumed the WiX Toolset's bin folder is in the PATH system environment variables (current behavior).

There will need to be a way for users to specify the path to the WiX Toolset's bin folder and/or compiler and linker outside of the PATH system environment variable. It is possible not everyone can modify his or her PATH or that a different version of the WiX Toolset is to be temporarily used.

Add better error messages for commands

If an error occurs with the builder (cargo build --release), compiler (candle), linker (light), or signer (signtool), then a simply, generic "failure has occurred" message is printed. Ideally, the stderr from the failing command should be the error message, or at the very least the exit code should be included with the error message.

Support the `license-file` field for custom licenses

Currently, cargo-wix will ignore the license-file field and only work when the license given is a builtin one.

Ex. if I have a cargo project with license-file="LICENSE", cargo-wix ignores it completeley and tells me that it couldn't generate an appropriate license file:

cargo-wix/src/wix.rs

Lines 263 to 275 in f4ad20e

let license_name = self.get_manifest_license_name(&manifest);
debug!("license_name = {:?}", license_name);
if let Some(l) = license_name {
info!("Creating the 'wix\\License.{}' file", RTF_FILE_EXTENSION);
let license = Template::from_str(&l)?;
let mut license_path = PathBuf::from(WIX);
license_path.push("License");
license_path.set_extension(RTF_FILE_EXTENSION);
let mut rtf = File::create(license_path)?;
self.write_license(&mut rtf, &license, &manifest)?;
} else {
warn!("Could not generate an appropriate license file in the Rich Text Format (RTF). Please manually create one to avoid errors during installer creation.");
}

  • You are only checking the license field here, not the license-file field. So it will fail to build the MSI if you are not specifying a license identifier, but a license in a seperate file.

Add documentation to help about the WIX_PATH environment variable

Information about the WIX_PATH environment variable and the precedence for finding the compiler (candle.exe) and linker (light.exe) is missing from the CLI help (--help). This information is available in the online documentation under the Concepts section as:

The WiX Toolset provides a compiler (candle.exe) and linker (light.exe). These can be found in the bin directory of the installation location for the WiX Toolset. This subcommand uses these two applications with the std::process::Command module to create an installer. Generally, it is best to add the WiX Toolset bin folder to the PATH system environment variable, but a WIX_PATH environment variable or the -B,--bin-path option can be used to specify a path (relative or absolute) to the WiX Toolset bin folder. The order of precedence (descending) is: -B,--bin-path option, WIX_PATH environment variable, and then the PATH system environment variable.

but not in the sub-command's help text.

Document usable fields

If you support a seperate [wix] section - what keys / values are valid? For example, it would be nice, not to add the main.wxs into source control. It would be great if settings (app icon, banner, help / documentation link, etc.) could be set via the Cargo.toml file instead of the main.wxs file:

Also, it would be great, if you could support a "nice name". Cargo will complain if you capitalize the package name (which is OK), but for a user it's often more friendly to have a capitalized name

I.e. something like this:

[package]
name = "something"

[package.metadata.wix]
nice-name = "Something Editor Pro"
icon = "assets/main.ico"
help = "http://company.com/support"
install-banner-picture = "assets/Banner.bmp"
install-dialog-picture = "assets/Dialog.bmp"

It would be great if this could be done directly in the Cargo.toml file, so that the main.wxs file doesn't need to be checked into version control. If something like this is already possible, it would be good to have some documentation on which fields / keys are valid.

Fix subject of signed installer

When using the -s,--sign flag, the /d switch for the signtool should be used to set the subject of the Authenticode dialog to the name of the product, not the random hex string.msi name.

Add homepage URL to signed content

The /du switch should be used with the signtool to specify a URL for the signed content. This would be taken from the homepage field of the package's manifest (Cargo.toml). If the homepage is not set in the manifest, then the /du switch is not used when signing the installer.

Add `--print-license` option

The --print-license option should be added. It would accept the ID of the license as a value and print it to stdout, similar to the --print-template flag. This would also users to create license files from the support templates. Note, the output would be RTF, so not very human-readable, but redirection can be used to create a RTF file from the output and viewed using WordPad.

Add -b,--binary-name option

The -b,--binary-name option would override the name field for the bin section of the package's manfiest (Cargo.toml), which is used for the executable name within the installer. This allows the user to change from defaults for specific configurations.

Add `--print-template` option

As mentioned in #29, the --print-template option would accept WXS, MIT, Apache-2.0, and GPL-3.0 as valid values and print the corresponding template to stdout. Values would be case insensitive. This would provide a more generalized way to print the various templates, and future templates, to stdout or file.

Add -a,--author option

The -a,--author option would override using the first author in the authors field of the package's manifest (Cargo.toml). It would take a value. This would be used for the Manufacturer attribute of the Package element of the WiX Source in the template.

Wording is incorrect for warning message

The following message appears when a LICENSE file does not exist for a project:

WARN: A 'LICENSE' file does not exist in the project root. Please consider adding a such a file to avoid errors during installer creation.

There is an extraneous a before such in the sentence.

Use empty string for no description

Instead of returning an error if the -d,--description option or description field in the package's manifest does not exist, the empty string should be used and a warning issued instead.

Add optional value to the --print-template flag

The --print-template flag should be changed to an option with an optional value. If a value is supplied, then the template is printed to the path specified in the value, but if no value is supplied (default), then the template is printed to stdout. This saves the need for redirecting. The subcommand should also ensure the full path to the file exists, i.e. folders are created if needed.

The entire error message is red

The entire error message is printed in red, not just the "tag", which is the portion to the left of the colon, :, before the message. The tag should be red, but not message.

Create short and long help messages

The clap argument parser supports short and long help messages where the -h flag displays the short help message and the --help flag displays the long help message. This is pretty cool. The -h,--help documentation for this subcommand should be refactored to support a short, quick message and a longer, more detailed message.

Create License Agreement RTF from license field in package manifest

A License Agreement Rich Text Format (RTF) file should be generated based on the license field in a package's manifest (Cargo.toml) when the --init flag is used. The WixUI_FeatureTree dialog set is used within the embedded template because it displays a dialog for customizing the installation. All the built-in dialog sets for the WiX Toolset have a License dialog of some kind. A generic placeholder is used if the <WixVariable Id='WixUILicenseRtf' Value='wix\License.rtf'/> tag is not used or uncommented, but we should be able to use the license information from the package manifest to automatically replace the generic placeholder with the package-specific license.

For example, if the license field for the package section is set to GPL-3.0, then the GPL-3.0 license in the RTF format should be automatically generated. Custom licenses would require manual modification of the WiX Source (wxs) file, but the licenses supported by the license field should be automatic. There are a lot of supported license identifiers, so maybe just initially support the most common ones used by Rust project: Apache-2.0, MIT, and GPL-3.0.

If the license-file field is used in the package manfiest, then it is used for the License.rtf file, but I am not sure how convert the file to RTF automatically. I am also not sure how to handle the various RTF files. Should there be a pre-built RTF file for each license embedded in the binary?

There is also the matter of the License file being included in the installation location directory afterwards as well. How should this be handled?

Change "run" to "build" for builder API

All of the "commands", such as --print-template, --clean, --init, etc., also "run". So, the method used to build, and/or create, the Windows installer should be renamed from run to build. The create method is also a possibility.

Add warning check during initialization for license source

A warning message should be displayed during initialization (cargo wix --init) if the license-file field is not set and a LICENSE file is not present in the root directory. If the license-file field is set, it is ultimately used for the license source, so there is no warning or error. This is a warning instead of an error because the user could use the -l,--license option during installer creation.

Add -o,--output option

The -o,--output option would indicate an alternative location for the output of the create method instead of the target\wix folder. If used, the build artifacts, such as the wixobj file would be created in a temporary directory that is destroyed after the MSI is created. This would be useful for creating an installer with a destination in another location.

Add automatic GUID generation for --print-template flag

The mustache-rust and guid crates should be used to automatically replace the placeholders in the template for the UpgradeCode and Path Guid attributes with new GUIDs each time the --print-template flag is used.

This will eliminate the need for manual modification after printing the template to use it with this subcommand.

Switch console color crate from ansi_term to termcolor

The Windows 10 prompt supports ANSI escape sequences, so console colors can be easily achieved, but older versions of Windows do not support ANSI escape sequences. The termcolor crate provides console coloring for all versions of Windows. It might be better to switch to the termcolor crate to support older versions of Windows.

FYI, the termcolor crate is used in cargo.

Add ability to change timestamp server for installer signing

A -t,--timestamp option should be added to change the timestamp server URL for the signtool during signing of the installer. Right now it is hard-coded to Comodo's timestamp server because that is what I have used in the past for other projects. Ideally, it would be nice to have a [wix] section in the project's manifest (Cargo.toml) that has a timstamp-url field so that it does not have to be constantly specified at the command line.

This option would only be valid if the -s,--sign flag is also used.

Add -p,--product-name option

The -p,--product-name option would override the name field for the package's manifest (Cargo.toml), which is used for the installer's ProductName attributes and values. This would allow users to deviate from default behavior and have the product name be more end-user friendly than the developer's product name.

Add support for SIGNTOOL_PATH environment variable

Similar to the WIX_PATH environment variables, a SIGNTOOL_PATH environment variable should be supported. This would allow using a different installation of the signtool application available with the Windows SDK.

Make the help URL optional

If a help URL cannot be determined, then a warning should be printed to add the documentation, homepage, or repository fields to the package's manifest. The Help URL is only needed if the ARPHELPLINK is uncommented from the main.wxs file.

Add support for a Wix.toml manifest

If a Wix.toml manifest exists in the root of the project or in the wix folder, then the fields within this file are used when building, compiling, linking, and signing. When the --init flag is used, a Wix.toml file is created in the wix folder as part of the initialization of the wix sub-project.

Change name of --print-template flag

The --print-template flag should be renamed to --print-wxs, --print-main-wxs, --print-main, or something similar. Now that there are templates for licenses, the --print-template flag is a little ambiguous. The --print-template flag could be changed to an option that accepts the ID for a license or Wxs and prints the template to stdout.

Colors leak after application ends

If there is an error, then console turns red for all commands following the completion of this sub-command. It appears this sub-command changes the terminal color to print the error but does not change the color back after printing.

Add --clean and --purge flags

The --clean flag would delete/remove the target\wix folder if present, similar to the cargo clean subcommand.

The --purge flag would delete/remote the target\wix folder and the wix "source" folder that was created with the --init flag if present. This should be used with caution and possibly display a confirmation prompt to complete the action because other files might be present in the wix folder, like images and licenses.

Always hide the module path in log statements

Log statements currently hide the module path unless the verbosity is greater than four (4). In reality, the module path is never very useful for this project because all of the code is in one module, i.e. cargo_wix. The line numbers should be toggle on and off based on verbosity, but the module path should also be off. This will simplify the main function implementation and yield cleaner log statements with more focused, useful information.

Add --write-template option

The --write-template option would take a value identical to the --print-template option, but it would also use the INPUT positional argument to write the template to the path specified in the INPUT instead of just writing to stdout.

This is a nice to have and it might not be worth the hassle because redirection could just be used to create the file with the --print-template option. It is an idea.

Better error messages than "can't find file"

I'm trying to build a project, but all I'm getting as an error is "The system can't find the file (os error 2)". It would be really helpful to know what file exactly it can't find or where the error came from.

Add INPUT positional argument

The <INPUT> argument should be added. This takes a path to a WiX Source (wxs) file. When specified with this subcommand, the installer will be created using this wxs file instead of searching for the wix\main.wxs file (default). This will allow users to deviate from convention for custom configurations and project layouts.

ARPINSTALLLOCATION not working

The registry key, ARPINSTALLOCATION, is not being set during installation with an installer created using this subcommand and the main.wxs.mustache template.

Add warning when initializing if a License.rtf could not be generated or found

If a Rich Text Format (RTF) license file could not be found or generated during initialization, a warn statement should be printed. This is a warning because the developer may manually change the WiX Source (wxs) file to handle the EULA for the installer but it will be an error during building of the installer if no License.rtf file is found.

Add -W,--wix-path option

Similar to the #24 feature, the -W,--wix-path option should be added to the CLI so that the path to the WiX Toolset bin folder can be specified at the command line in addition to an environment variable. The precedence, with the first overriding the next, would be:

  1. -W,--wix-path option
  2. WIX_PATH environment variable
  3. PATH system environment variable

This allows for the subcommand to take into account the build environment, one-off execution, and defaults. Currently, only the PATH system environment variable is supported.

Add platform selection at compile-time

The platform is defaulted to x86 (32-bit) and there is a --x64 option to build the installer for the x64 platform instead of the x86 (32-bit) platform. However, it should be possible to determine this option based on the installation of this subcommand, i.e. at compile-time. If the subcommand is installed using the x86 toolchain with rustup, then it should use the x86 (32-bit) platform. If the subcommand is installed using the x64 toolchain with rustup, then it should use the x64 platform.

Conditional compilation should make this possible.

Add -d,--description option

The -d,--description option would take a value that overrides the description field of the package's manfiest (Cargo.toml) for the description within the installer. By default, the description field is used for the installer description. This would allow users to override the contents specifically for the installer.

Add warning check for missing description on initialization

A check should be added for the description field in the project's manifest when initializing. If the description field is not found, a warning message should be displayed indicating an error may occur if a description is not added for the project or the -d,--description option is not used when building the installer.

Add --init flag

The --init flag should be added to the Command Line Interface (CLI) for the cargo subcommand. This would function similar to the cargo init subcommand, but it would create the wix subfolder in the project's root directory and print the template into the wix\main.wxs file. In other words, it would initialize the installer portion of the project.

Consider changing logging support to env_logger

The loggerv crate uses the ansi_term crate for colorized output, so enabling ANSI escape sequences on Windows 10 is still needed to prevent preventing ANSI escape characters in the log messages. The ansi_term and atty crates dependencies still exist.

I believe the same verbosity-based logging functionality can be achieved with the env_logger crate, which uses the termcolor crate for coloring and would also add setting the log level from an environment variable.

It should be noted that the clap crate also uses the ansi_term crate for coloring but it handles the enabling of ANSI escape sequences for Windows 10 internally. Another alternative would be to add this internal functionality to the loggerv crate.

Refactor to use private methods for better testability

The run method of the Wix struct should be refactored to use private methods, so that the various functionality and execution of the run method can be better tested. Unit tests can be created for the private methods to ensure behavior of the overall execution of the run method is correct.

Add ability to specify certificate to use when signing the installer

Currently the /a flag is used with the signtool application for signing installers. This is fine most of the time as it indicates the application will automatically search for a suitable certificate in the Windows certificate manager. However, there are edge cases where someone may have multiple "suitable" certificates and want to specify a specific one to use. So, a -c,--certificate option should be added that takes a path and/or name to certificate to use when signing an installer with the -s,--sign flag.

Add aliases for timestamp servers

Aliases for the URLs to various timestamp servers for certificates should be added to the subcommand and used with the -t,--timestamp option. For example, instead of having to remember the full URL for the Comodo timestamp server and enter it at the CLI, the "alias" Comodo could be used for the option value. Similar to origin and upstream are aliases for the URLs in git repositories.

Build fails with i686 toolchain

The project fails to build and install when using the i686 toolchain. This appears to be a problem with the ansi_term crate. An issue has been submitted to that project. Until this can be resolved within the dependency, the subcommand only works for the x86_64 toolchain.

Add `-S,--sign-path` option

The -S,--sign-path option would function similar to the -B,--bin-path option but for the SignTool application instead of the WiX Toolset bin folder. This would override the PATH system environment variable or any environment variables established when using the Developer Prompt. The value should be a path to the bin folder for the Windows SDK that includes the signtool.exe file.

Strip email from first author

If an email is provided in the first author string for the authors field and the first author is used for the Manufacturer, the email should be stripped; otherwise, it appears in the "Publisher" column in the Add/Remove Programs control panel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.