refactor(installer): split installer UI into its own ui.wxs
Moves the WixUI_Minimal UI and finish-screen launch checkbox out of main.wxs into a dedicated ui.wxs fragment, referenced from main.wxs via <UIRef Id='OpenCADStudioUI'>. Keeps the package/feature definition and the UI concerns in separate files. Updates the release workflow to compile both .wxs files (candle now writes per-source .wixobj into a directory) and link both objects. https://claude.ai/code/session_01DFVSKgViFaxEjZD2KsTdtt
This commit is contained in:
parent
556989dbdb
commit
fd949b74c7
3 changed files with 59 additions and 34 deletions
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
|
|
@ -128,17 +128,24 @@ jobs:
|
||||||
# filename.
|
# filename.
|
||||||
$exePath = (Resolve-Path target\release\OpenCADStudio.exe).Path
|
$exePath = (Resolve-Path target\release\OpenCADStudio.exe).Path
|
||||||
$iconPath = (Resolve-Path packaging\windows\AppIcon.ico).Path
|
$iconPath = (Resolve-Path packaging\windows\AppIcon.ico).Path
|
||||||
$wxsPath = (Resolve-Path packaging\windows\main.wxs).Path
|
# main.wxs holds the package/feature; ui.wxs holds the installer UI
|
||||||
$wixObj = Join-Path $PWD "packaging\windows\main.wixobj"
|
# and finish-screen launch checkbox. Both compile together.
|
||||||
|
$mainWxs = (Resolve-Path packaging\windows\main.wxs).Path
|
||||||
|
$uiWxs = (Resolve-Path packaging\windows\ui.wxs).Path
|
||||||
|
# candle writes one .wixobj per source into this directory (the
|
||||||
|
# trailing slash tells it -out is a folder, not a single file).
|
||||||
|
$objDir = Join-Path $PWD "packaging\windows\"
|
||||||
$msiPath = Join-Path $PWD "OpenCADStudio.msi"
|
$msiPath = Join-Path $PWD "OpenCADStudio.msi"
|
||||||
& $candle -arch x64 `
|
& $candle -arch x64 `
|
||||||
"-dVersion=$version" `
|
"-dVersion=$version" `
|
||||||
"-dSource=$exePath" `
|
"-dSource=$exePath" `
|
||||||
"-dIcon=$iconPath" `
|
"-dIcon=$iconPath" `
|
||||||
$wxsPath `
|
$mainWxs $uiWxs `
|
||||||
-out $wixObj
|
-out $objDir
|
||||||
if ($LASTEXITCODE -ne 0) { throw "candle failed" }
|
if ($LASTEXITCODE -ne 0) { throw "candle failed" }
|
||||||
& $light $wixObj -ext WixUIExtension -out $msiPath
|
$mainObj = Join-Path $objDir "main.wixobj"
|
||||||
|
$uiObj = Join-Path $objDir "ui.wixobj"
|
||||||
|
& $light $mainObj $uiObj -ext WixUIExtension -out $msiPath
|
||||||
if ($LASTEXITCODE -ne 0) { throw "light failed" }
|
if ($LASTEXITCODE -ne 0) { throw "light failed" }
|
||||||
|
|
||||||
- name: Sign MSI installer (Azure Trusted Signing)
|
- name: Sign MSI installer (Azure Trusted Signing)
|
||||||
|
|
|
||||||
|
|
@ -122,35 +122,8 @@
|
||||||
<ComponentRef Id='ProgramMenuDirComp' />
|
<ComponentRef Id='ProgramMenuDirComp' />
|
||||||
</Feature>
|
</Feature>
|
||||||
|
|
||||||
<!--
|
<!-- Installer UI + finish-screen launch checkbox (see ui.wxs). -->
|
||||||
Finish-screen "Launch Open CAD Studio" checkbox.
|
<UIRef Id='OpenCADStudioUI' />
|
||||||
WIXUI_EXITDIALOGOPTIONALCHECKBOX=1 pre-ticks the checkbox; the Publish
|
|
||||||
below fires the launch action when the user clicks Finish with it checked.
|
|
||||||
WixUI_Minimal shows a minimal wizard (Welcome → Progress → Finish).
|
|
||||||
-->
|
|
||||||
<Property Id='WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT' Value='Launch Open CAD Studio' />
|
|
||||||
<Property Id='WIXUI_EXITDIALOGOPTIONALCHECKBOX' Value='1' />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Start the installed exe after the wizard closes.
|
|
||||||
asyncNoWait lets the installer exit cleanly while the app starts.
|
|
||||||
-->
|
|
||||||
<CustomAction
|
|
||||||
Id='LaunchApplication'
|
|
||||||
FileKey='OpenCADStudioEXE'
|
|
||||||
ExeCommand=''
|
|
||||||
Execute='immediate'
|
|
||||||
Return='asyncNoWait'
|
|
||||||
Impersonate='yes' />
|
|
||||||
|
|
||||||
<UI>
|
|
||||||
<UIRef Id='WixUI_Minimal' />
|
|
||||||
<Publish
|
|
||||||
Dialog='ExitDialog'
|
|
||||||
Control='Finish'
|
|
||||||
Event='DoAction'
|
|
||||||
Value='LaunchApplication'>WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed</Publish>
|
|
||||||
</UI>
|
|
||||||
|
|
||||||
</Product>
|
</Product>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|
|
||||||
45
packaging/windows/ui.wxs
Normal file
45
packaging/windows/ui.wxs
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version='1.0' encoding='windows-1252'?>
|
||||||
|
<!--
|
||||||
|
Installer UI for the Windows MSI, kept separate from the package/feature
|
||||||
|
definition in main.wxs. Linked in via `<UIRef Id='OpenCADStudioUI' />`
|
||||||
|
there; both files are compiled together by candle and linked by light
|
||||||
|
(which needs `-ext WixUIExtension` for the WixUI_Minimal dialog set).
|
||||||
|
|
||||||
|
Provides:
|
||||||
|
* WixUI_Minimal wizard (Welcome → Progress → Finish).
|
||||||
|
* A pre-ticked "Launch Open CAD Studio" checkbox on the finish screen
|
||||||
|
that starts the freshly installed exe when the user clicks Finish.
|
||||||
|
-->
|
||||||
|
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
|
||||||
|
<Fragment>
|
||||||
|
<!--
|
||||||
|
Finish-screen "Launch Open CAD Studio" checkbox.
|
||||||
|
WIXUI_EXITDIALOGOPTIONALCHECKBOX=1 pre-ticks the checkbox; the Publish
|
||||||
|
below fires the launch action when the user clicks Finish with it checked.
|
||||||
|
-->
|
||||||
|
<Property Id='WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT' Value='Launch Open CAD Studio' />
|
||||||
|
<Property Id='WIXUI_EXITDIALOGOPTIONALCHECKBOX' Value='1' />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Start the installed exe after the wizard closes. FileKey points at the
|
||||||
|
File defined in main.wxs (light resolves the cross-fragment reference).
|
||||||
|
asyncNoWait lets the installer exit cleanly while the app starts.
|
||||||
|
-->
|
||||||
|
<CustomAction
|
||||||
|
Id='LaunchApplication'
|
||||||
|
FileKey='OpenCADStudioEXE'
|
||||||
|
ExeCommand=''
|
||||||
|
Execute='immediate'
|
||||||
|
Return='asyncNoWait'
|
||||||
|
Impersonate='yes' />
|
||||||
|
|
||||||
|
<UI Id='OpenCADStudioUI'>
|
||||||
|
<UIRef Id='WixUI_Minimal' />
|
||||||
|
<Publish
|
||||||
|
Dialog='ExitDialog'
|
||||||
|
Control='Finish'
|
||||||
|
Event='DoAction'
|
||||||
|
Value='LaunchApplication'>WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed</Publish>
|
||||||
|
</UI>
|
||||||
|
</Fragment>
|
||||||
|
</Wix>
|
||||||
Loading…
Reference in a new issue