From 53ecc3665c053f13696c4e3f511cbe2cadd3239e Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Thu, 13 Nov 2025 16:41:46 +1000 Subject: [PATCH] feat(windows): as wixproj for dotnet build wip --- resources/build/win/wix6.inc.sh | 20 + .../src/desktop/inst/KeymanDesktop.wixproj | 57 +++ windows/src/desktop/inst/build.sh | 70 ++- windows/src/desktop/inst/keymandesktop.wxs | 415 +++++++++--------- windows/src/engine/inst/build.sh | 28 +- windows/src/engine/inst/components.wxs | 81 ++-- windows/src/engine/inst/keymanengine.wxs | 80 ++-- 7 files changed, 441 insertions(+), 310 deletions(-) create mode 100644 resources/build/win/wix6.inc.sh create mode 100644 windows/src/desktop/inst/KeymanDesktop.wixproj diff --git a/resources/build/win/wix6.inc.sh b/resources/build/win/wix6.inc.sh new file mode 100644 index 0000000000..46a19a2dc4 --- /dev/null +++ b/resources/build/win/wix6.inc.sh @@ -0,0 +1,20 @@ + +WIX6PATH="C:\Users\ross_\.dotnet\tools" + +# !IFDEF LINT +#WIXLIGHTLINT=() +#!ELSE +# we suppress ICE82 because it reports spurious errors with merge module keymanengine to do with duplicate sequence numbers. Safely ignored. +#WIXLIGHTLINT=(-sice:ICE82 -sice:ICE80) +#!ENDIF + +if [[ "$GO_FAST" == 1 ]]; then + # for debug builds, we turn off compression because it is so hideously slow + # for test builds, we also turn off compression + WIXCOMPRESSION="-dcl none" +else + WIXCOMPRESSION="-dcl high" +fi + +# WIXLIT="$WIX6PATH/lit.exe" -wx -nologo +WIX6BUILD="$WIX6PATH/wix.exe build" diff --git a/windows/src/desktop/inst/KeymanDesktop.wixproj b/windows/src/desktop/inst/KeymanDesktop.wixproj new file mode 100644 index 0000000000..f85e50979f --- /dev/null +++ b/windows/src/desktop/inst/KeymanDesktop.wixproj @@ -0,0 +1,57 @@ + + + $(ProjectDir) + keymandesktop + AnyCPU + ICE80;ICE82 + en-us + none + true + + + PRODUCTID=$(PRODUCTID); + RELEASE=$(RELEASE); + KEYMAN_VERSION=$(KEYMAN_VERSION); + KEYMAN_VERSION_WIN=$(KEYMAN_VERSION_WIN); + KEYMAN_VERSION_WITH_TAG=$(KEYMAN_VERSION_WITH_TAG); + CefSourceDir=$(CefSourceDir); + DESKTOPUISOURCE=$(DESKTOPUISOURCE); + LOCALESOURCE=$(LOCALESOURCE) + + + + + + + CEF + INSTALLDIR + var.CefSourceDir + + + + + + DesktopUI + INSTALLDIR + var.DESKTOPUISOURCE + + true + + + + Locale + LocaleDir + var.LOCALESOURCE + + + + + + + + + + + diff --git a/windows/src/desktop/inst/build.sh b/windows/src/desktop/inst/build.sh index 8e64342a22..9c0d28937b 100755 --- a/windows/src/desktop/inst/build.sh +++ b/windows/src/desktop/inst/build.sh @@ -20,7 +20,7 @@ builder_if_release_build_level builder_describe_outputs \ builder_parse "$@" . "$KEYMAN_ROOT/resources/build/win/environment.inc.sh" -. "$KEYMAN_ROOT/resources/build/win/wix.inc.sh" +. "$KEYMAN_ROOT/resources/build/win/wix6.inc.sh" . "$KEYMAN_ROOT/resources/build/zip.inc.sh" # In dev environments, we'll hack the tier to alpha; CI sets this for us in real builds. @@ -62,20 +62,20 @@ function do_publish() { # # Build the installation archive # - do_candle - + #do_candle + do_wix_build # ICE82: we suppress because it reports spurious errors with merge module # keymanengine to do with duplicate sequence numbers. Safely ignored. # ICE80: we suppress because it reports x64 components without targeting x64. # Safely ignored. - "$WIXLIGHT" \ - -sice:ICE82 -sice:ICE80 \ - -nologo \ - -dWixUILicenseRtf=License.rtf \ - "$WIXLIGHTCOMPRESSION" \ - -out keymandesktop.msi -ext WixUIExtension \ - keymandesktop.wixobj desktopui.wixobj cef.wixobj locale.wixobj + #"$WIXLIGHT" \ + # -sice:ICE82 -sice:ICE80 \ + # -nologo \ + # -dWixUILicenseRtf=License.rtf \ + # "$WIXLIGHTCOMPRESSION" \ + # -out keymandesktop.msi -ext WixUIExtension \ + # keymandesktop.wixobj desktopui.wixobj cef.wixobj locale.wixobj # # Sign the installation archive @@ -135,12 +135,53 @@ function test-releaseexists() { fi } + +function do_wix_build_OLD() { + #"${WIXCOMPRESSION}" \ this line was in the wix build cli -culture en-us \ + local GUID1=$(generate_uuid) + DESKTOP_UI_SRC="../kmshell/xml" + LOCALE_SRC="../kmshell/locale" +$WIX6BUILD \ + -d KEYMAN_VERSION_WITH_TAG="${KEYMAN_VERSION_WITH_TAG}" \ + -d KEYMAN_VERSION="${KEYMAN_VERSION_WIN}" \ + -d RELEASE="${KEYMAN_VERSION_RELEASE}" \ + -d PRODUCTID="${GUID1}" \ + -d CefSourceDir="${KEYMAN_CEF4DELPHI_ROOT}" \ + -d DesktopUISource="${DESKTOP_UI_SRC}" \ + -d LocaleSource="${LOCALE_SRC}" \ + -d HarvestFileGenerateGuidsNow=true \ + keymandesktop.wxs \ + -ext WixToolset.Util.wixext \ + -o "KeymanDesktop-${KEYMAN_VERSION_WITH_TAG}.msi" \ + +} + +function do_wix_build() { + #"${WIXCOMPRESSION}" \ this line was in the wix build cli -culture en-us \ + exclude-cef + local GUID1=$(generate_uuid) + DESKTOPUISOURCE="../kmshell/xml" + LOCALESOURCE="../kmshell/locale" +echo "Building with ProductID: $GUID1" + dotnet build KeymanDesktop.wixproj \ + -p:PRODUCTID="$GUID1" \ + -p:RELEASE="$KEYMAN_VERSION_RELEASE" \ + -p:KEYMAN_VERSION="$KEYMAN_VERSION_WIN" \ + -p:KEYMAN_VERSION_WITH_TAG="$KEYMAN_VERSION_WITH_TAG" \ + -p:KEYMAN_VERSION_WIN="$KEYMAN_VERSION_WIN" \ + -p:CefSourceDir="$KEYMAN_WIX_TEMP_CEF" \ + -p:DESKTOPUISOURCE="$DESKTOPUISOURCE" \ + -p:LOCALESOURCE="$LOCALESOURCE" +} + + function do_candle() { heat-cef builder_heading candle local GUID1=$(generate_uuid) + "$WIXHEAT" dir "$KEYMAN_WIX_TEMP_CEF" -o cef.wxs -ag -cg CEF -dr INSTALLDIR -var var.CefSourceDir -wx -nologo "$WIXHEAT" dir ../kmshell/xml -o desktopui.wxs -ag -cg DesktopUI -dr INSTALLDIR -suid -var var.DESKTOPUISOURCE -wx -nologo "$WIXHEAT" dir ../kmshell/locale -o locale.wxs -ag -cg Locale -dr INSTALLDIR -var var.LOCALESOURCE -wx -nologo "$WIXCANDLE" -dKEYMAN_VERSION_WITH_TAG=${KEYMAN_VERSION_WITH_TAG} -dKEYMAN_VERSION=${KEYMAN_VERSION_WIN} -dRELEASE=${KEYMAN_VERSION_RELEASE} -dPRODUCTID=$GUID1 \ @@ -160,6 +201,15 @@ function heat-cef() { rm -rf "$KEYMAN_WIX_TEMP_CEF" } +function exclude-cef() { + builder_heading exclude-cef + + # We copy the files to a temp folder in order to exclude .git from harvesting + rm -rf "$KEYMAN_WIX_TEMP_CEF" + mkdir -p "$KEYMAN_WIX_TEMP_CEF" + cp -r "$KEYMAN_CEF4DELPHI_ROOT"/* "$KEYMAN_WIX_TEMP_CEF" +} + function create-setup-inf() { builder_heading create-setup-inf diff --git a/windows/src/desktop/inst/keymandesktop.wxs b/windows/src/desktop/inst/keymandesktop.wxs index b6329253e4..721cb33e94 100644 --- a/windows/src/desktop/inst/keymandesktop.wxs +++ b/windows/src/desktop/inst/keymandesktop.wxs @@ -1,10 +1,6 @@ - - - - + + + @@ -72,197 +68,35 @@ * DISABLEADVTSHORTCUTS: https://learn.microsoft.com/en-us/windows/win32/msi/disableadvtshortcuts * Shortcut advertisement: https://learn.microsoft.com/en-us/windows/win32/msi/advertisement --> - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + + + Level="1" ConfigurableDirectory="INSTALLDIR" AllowAdvertise="no" AllowAbsent="no"> @@ -275,67 +109,65 @@ - - - + - - - - - + + + + + - + - - + + - VERSION11FOUND + - - + + - CURRENTVERSIONFOUND - NEWERFOUND Or HIGHERFOUND + + - VERSION11FOUND + - - + + - + - + - 1 + - + - = 601)]]> + @@ -343,5 +175,176 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/windows/src/engine/inst/build.sh b/windows/src/engine/inst/build.sh index 3f98ed7688..eed4ca1b69 100755 --- a/windows/src/engine/inst/build.sh +++ b/windows/src/engine/inst/build.sh @@ -34,15 +34,29 @@ function do_publish() { # # Build the installation archive # - "$WIXCANDLE" -dKEYMAN_VERSION=$KEYMAN_VERSION_WIN -dRELEASE=$KEYMAN_VERSION_RELEASE -ext WixUtilExtension keymanengine.wxs components.wxs + #"$WIXCANDLE" -dKEYMAN_VERSION=$KEYMAN_VERSION_WIN -dRELEASE=$KEYMAN_VERSION_RELEASE -ext WixUtilExtension keymanengine.wxs components.wxs # warning 1072 relates to Error table defined by WixUtilExtension. Doesn't really affect us. - "$WIXLIGHT" \ - -sw1072 \ - -ext WixUtilExtension \ - "$WIXLIGHTCOMPRESSION" \ - keymanengine.wixobj components.wixobj \ - -o keymanengine.msm + #"$WIXLIGHT" \ + # -sw1072 \ + # -ext WixUtilExtension \ + # "$WIXLIGHTCOMPRESSION" \ + # keymanengine.wixobj components.wixobj \ + # -o keymanengine.msm + #wix build keymanengine.wxs components.wxs \ + #-ext WixToolset.Util.wixext \ + #-d KEYMAN_VERSION=$KEYMAN_VERSION_WIN \ + #-d RELEASE=$KEYMAN_VERSION_RELEASE \ + #-sw1072 \ + #-out keymanengine.msm + wix build -d KEYMAN_VERSION=$env:KEYMAN_VERSION -d RELEASE=$env:KEYMAN_VERSION_RELEASE keymanengine.wxs components.wxs -ext WixToolset.Util.wixext -sw1072 -out keymanengine.msm + + + echo $KEYMAN_VERSION_RELEASE + echo $KEYMAN_VERSION_WIN + echo $KEYMAN_VERSION + echo $RELEASE + # # Sign the installation archive diff --git a/windows/src/engine/inst/components.wxs b/windows/src/engine/inst/components.wxs index be36d57743..0bcb3937fc 100644 --- a/windows/src/engine/inst/components.wxs +++ b/windows/src/engine/inst/components.wxs @@ -1,10 +1,8 @@ - - + - + @@ -51,8 +49,8 @@ - - VersionNT64 + + @@ -130,7 +128,7 @@ - + @@ -142,51 +140,44 @@ - + - + - + - + - - + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + @@ -215,8 +206,8 @@ - - VersionNT >= 602 + + @@ -234,16 +225,16 @@ - - VersionNT64 + + - - VersionNT64 AND ProcessorArchitecture="ARM64" + + @@ -260,16 +251,16 @@ - + - + - + - + diff --git a/windows/src/engine/inst/keymanengine.wxs b/windows/src/engine/inst/keymanengine.wxs index 2aaaf1de9a..509f91bc18 100644 --- a/windows/src/engine/inst/keymanengine.wxs +++ b/windows/src/engine/inst/keymanengine.wxs @@ -1,15 +1,23 @@ - - - - + + - - + + + + + + + + + + + + + + @@ -21,30 +29,30 @@ guid rules with merge modules, as we end up with LGHT0231, as the CommonFilesFolder root folder seems to be ignored when building the merge module. Therefore we list these files in a single component for now. --> - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - + + @@ -61,9 +69,9 @@ - - - + + + @@ -80,18 +88,6 @@ - - - - - - - - - - - - - - + +