-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@smartthings/cli": patch | ||
--- | ||
|
||
Add Windows installer build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## SmartThings CLI Windows Installer | ||
|
||
### WiX Toolset | ||
|
||
We use a "simple" [WiX Toolset](https://wixtoolset.org/) v3 configuration. The majority of the .wxs file was written with these examples as reference <https://github.com/kurtanr/WiXInstallerExamples>. Comments try to point to references for info that is not immediately intuitive. | ||
|
||
### smartthings.wxs | ||
|
||
This is the WiX source file that needs to be "compiled" to a `.wixobj` and then finally linked into an `.msi`. The steps and expectations for this process are below. | ||
|
||
#### Environment Variables | ||
|
||
The WiX file includes some build variables that can be passed by setting specific env vars in the shell that runs the tasks. | ||
|
||
1. `SMARTTHINGS_SEMVER`: Sets the version that shows in Windows Programs and Features. This should not include the fourth section of the Windows format, as we ignore this and leave 0. Pre-release labels are not supported. | ||
|
||
1. `SMARTTHINGS_BINARY_PATH`: Specifies the location of the executable that we want to install. This will need to be accessible during the linking step below, so needs to be relative path to the `.wxs` file or an absolute system path. | ||
|
||
#### License | ||
|
||
The End User License Agreement step of the installer requires an `.rtf` file specified in the WiX markup. The current setup assumes this is in the same directory as the `.wxs` file. | ||
|
||
#### Usage | ||
|
||
The following assumes running under Windows OS with the WiX Toolset installed and on the system Path. GitHub hosted runners have the v3 tools installed by default as of writing. These tasks are ran in the same directory as required files. | ||
|
||
> :warning: Ensure the required Environment Variables are set. | ||
Compile WiX Source | ||
|
||
```console | ||
candle.exe smartthings.wxs -ext WixUIExtension | ||
``` | ||
|
||
Build .msi Installer | ||
|
||
```console | ||
light.exe -out smartthings.msi smartthings.wixobj -ext WixUIExtension | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<!-- Version cannot include pre-release label extensions --> | ||
<!-- https://github.com/kurtanr/WiXInstallerExamples/tree/main/00_HelloWorldInstaller#product --> | ||
<Product | ||
Id="*" | ||
Language="1033" | ||
Manufacturer="SmartThings" | ||
Name="SmartThings CLI" | ||
UpgradeCode="{AA0B7D9A-214A-4F22-9E4A-773E9FE7AE94}" | ||
Version="$(env.SMARTTHINGS_SEMVER).0"> | ||
|
||
<Package | ||
InstallScope="perMachine" | ||
InstallerVersion="200" | ||
Compressed="yes" /> | ||
|
||
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." /> | ||
|
||
<!-- https://github.com/kurtanr/WiXInstallerExamples/tree/main/00_HelloWorldInstaller#mediatemplate --> | ||
<MediaTemplate EmbedCab="yes" /> | ||
|
||
<!-- https://github.com/kurtanr/WiXInstallerExamples/tree/main/00_HelloWorldInstaller#directory --> | ||
<Directory Id="TARGETDIR" Name="SourceDir"> | ||
<Directory Id="ProgramFilesFolder"> | ||
<Directory Id="INSTALLDIR" Name="SmartThings" /> | ||
</Directory> | ||
</Directory> | ||
|
||
<ComponentGroup Directory="INSTALLDIR" Id="ProductComponentGroup"> | ||
<!-- https://github.com/kurtanr/WiXInstallerExamples/tree/main/00_HelloWorldInstaller#component --> | ||
<Component Id="ProductComponent"> | ||
<File KeyPath="yes" Source="$(env.SMARTTHINGS_BINARY_PATH)"></File> | ||
</Component> | ||
</ComponentGroup> | ||
|
||
<!-- https://stackoverflow.com/a/46366291 --> | ||
<DirectoryRef Id="TARGETDIR"> | ||
<Component Id="PathComponent" Guid="{B01A7C23-58B3-43C8-A61C-AF8D1649CC6F}"> | ||
<Environment | ||
Id="PATH" | ||
Name="PATH" | ||
Value="[INSTALLDIR]" | ||
Permanent="no" | ||
Part="last" | ||
Action="set" | ||
System="no" /> | ||
</Component> | ||
</DirectoryRef> | ||
|
||
<!-- https://wixtoolset.org//documentation/manual/v3/wixui/dialog_reference/wixui_installdir.html --> | ||
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" /> | ||
<UIRef Id="WixUI_InstallDir" /> | ||
|
||
<Feature Id="SmartThingsFeature"> | ||
<ComponentRef Id="ProductComponent" /> | ||
<ComponentRef Id="PathComponent" /> | ||
</Feature> | ||
|
||
<!-- https://stackoverflow.com/a/1116236 --> | ||
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" /> | ||
|
||
</Product> | ||
</Wix> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters