Skip to content

Commit

Permalink
SNOW-1055755: windows build debug - ...wix util schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mraba committed Sep 9, 2024
1 parent 6f9d8fe commit 37f7e87
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 8 deletions.
81 changes: 81 additions & 0 deletions scripts/packaging/win/snowflake_cli_template_v4.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<Package Name="Snowflake CLI" Language="1033" Version="$(var.SnowflakeCLIVersion)" Manufacturer="Snowflake, Inc." UpgradeCode="42280567-AE10-4184-8BB4-F98F59519CB2" InstallerVersion="405"><SummaryInformation Manufacturer="Snowflake, Inc." />
<WixVariable Id="WixUIDialogBmp" Value="scripts\packaging\win\snowflake_msi_background.png" />
<WixVariable Id="WixUIBannerBmp" Value="scripts\packaging\win\snowflake_msi_banner.png" />
<Media Id="1" Cabinet="snow.cab" EmbedCab="yes" />
<MajorUpgrade AllowDowngrades="yes" />

<DirectoryRef Id="TESTFILEPRODUCTDIR">
<Component Id="snow.exe" Guid="3FDE264C-66C4-4B6C-AE4C-F42618FB98BC" Bitness="always64">
<Environment Id="PATH" Name="PATH" Value="[TESTFILEPRODUCTDIR]" Permanent="no" Part="last" Action="set" System="yes" />
<File Id="snow.exe" Source="dist\snow\snow.exe" KeyPath="yes" Checksum="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Snowflake CLI" Level="1">
<ComponentRef Id="snow.exe" />
</Feature>
<Icon Id="icon.ico" SourceFile="scripts\packaging\win\snowflake_msi.ico" />
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="ARPHELPLINK" Value="https://docs.snowflake.net/manuals/user-guide/snowflake-cli.html" />
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" />
<Property Id="ARPURLINFOABOUT" Value="https://snowflake.com/" />
<Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" />
<UIRef Id="WixUI_InstallDir2" />
<Property Id="ApplicationFolderName" Value="Snowflake CLI" />
<Property Id="WixAppFolder" Value="WixUISupportPerUser" />
<util:BroadcastSettingChange />
<util:BroadcastEnvironmentChange />

<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="TESTFILEPRODUCTDIR" Name="Snowflake CLI" />
</StandardDirectory>
</Package>
<Fragment>
<UI Id="WixUI_InstallDir2">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<DialogRef Id="SnowflakeCLIExitDlg" />

<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(sys.BUILDARCHSHORT)" Order="3" />
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />

<Publish Dialog="SnowflakeCLIExitDlg" Control="Finish" Event="EndDialog" Value="Return" Order="999" />

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Condition="NOT Installed" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH" />

<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" />
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(sys.BUILDARCHSHORT)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />

<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1" Condition="NOT Installed" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2" Condition="Installed AND NOT PATCH" />
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" Condition="Installed AND PATCH" />

<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" />

<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg" />
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg" />
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>
14 changes: 6 additions & 8 deletions scripts/packaging/win/wxs_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
DIST_DIR = PROJECT_ROOT_PATH.joinpath("dist")
LIBS = DIST_DIR.joinpath("snow")

WXS_TEMPLATE_FILE = (
Path(__file__).parent.absolute().joinpath("snowflake_cli_template.wxs")
)
WXS_FILE = Path(__file__).parent.absolute().joinpath("snowflake_cli.wxs")
WIN_RES_DIR = Path(__file__).parent.absolute()
WXS_TEMPLATE_FILE = WIN_RES_DIR.joinpath("snowflake_cli_template_v4.wxs")
WXS_OUTPUT_FILE = WXS_TEMPLATE_FILE.parent.joinpath("snowflake_cli.wxs")

wxs = ElementTree.parse(WXS_TEMPLATE_FILE)
root = wxs.getroot()
snow_files_xpath = ".//{http://schemas.microsoft.com/wix/2006/wi}Component"
snow_files_xpath = ".//{http://wixtoolset.org/schemas/v4/wxs}Component"
snow_files = root.findall(snow_files_xpath)


Expand All @@ -38,15 +37,14 @@
file.set("Id", str(relative_lib_path))
source_path = lib_path.relative_to(PROJECT_ROOT_PATH)
file.set("Source", str(source_path))
file.set("Name", "PATH")
file.set("KeyPath", "yes")
file.set("Checksum", "yes")

component = ElementTree.Element("Component")
component.set("Id", relative_file)
guid_hash = str(uuid.uuid3(uuid.NAMESPACE_DNS, relative_file)).upper()
component.set("Guid", guid_hash)
component.set("Win64", "yes")
component.set("Bitness", "always64")

component.append(environment)
component.append(file)
Expand All @@ -55,5 +53,5 @@

ElementTree.indent(root, space=" ", level=0)

with WXS_FILE.expanduser().open("wb") as f:
with WXS_OUTPUT_FILE.expanduser().open("wb") as f:
wxs.write(f, encoding="utf-8")

0 comments on commit 37f7e87

Please sign in to comment.