Skip to content

Commit

Permalink
fix concurent build and merge template
Browse files Browse the repository at this point in the history
  • Loading branch information
douph1 committed May 17, 2021
1 parent f5ac9fc commit a0dc17c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 493 deletions.
32 changes: 14 additions & 18 deletions wix/Build.OpenJDK_generic.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ REM See folder e.g. "C:\Program Files (x86)\Windows Kits\[10]\bin\[10.0.16299.0]
SET WIN_SDK_MAJOR_VERSION=10
SET WIN_SDK_FULL_VERSION=10.0.17763.0

REM find all *.wxi.template,*.wxl.template,*.wxs.template files and replace text with configurations
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f %%i IN ('dir /s /b *.wxi.template,*.wxl.template,*.wxs.template') DO (
SET INPUT_FILE=%%i
SET OUTPUT_FILE=!INPUT_FILE:.template=%!
ECHO string replacement input !INPUT_FILE! output !OUTPUT_FILE!
powershell -Command "(gc -Raw -encoding utf8 %%i) -replace '{vendor}', '!VENDOR!' -replace '{vendor_branding_logo}', '!VENDOR_BRANDING_LOGO!' -replace '{vendor_branding_banner}', '!VENDOR_BRANDING_BANNER!' -replace '{vendor_branding_dialog}', '!VENDOR_BRANDING_DIALOG!' -replace '{vendor_branding}', '!VENDOR_BRANDING!' -replace '{product_help_link}', '!PRODUCT_HELP_LINK!' -replace '{product_support_link}', '!PRODUCT_SUPPORT_LINK!' -replace '{product_update_info_link}', '!PRODUCT_UPDATE_INFO_LINK!' | Out-File -encoding utf8 !OUTPUT_FILE!"
)
ENDLOCAL

REM
REM Nothing below this line need to be changed normally.
REM
Expand Down Expand Up @@ -180,6 +170,15 @@ FOR %%A IN (%ARCH%) DO (
ECHO Source dir used : !REPRO_DIR!

SET OUTPUT_BASE_FILENAME=!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!-!PRODUCT_CATEGORY!_!FOLDER_PLATFORM!_windows_!PACKAGE_TYPE!-!PRODUCT_FULL_VERSION!
REM find all *.wxi.template,*.wxl.template,*.wxs.template files and replace text with configurations
FOR /f %%i IN ('dir /s /b *.wxi.template,*.wxl.template,*.wxs.template') DO (
SET INPUT_FILE=%%i
REM Prevent concurrency issues if multiple builds are running in parallel.
SET OUTPUT_FILE=!OUTPUT_BASE_FILENAME!-!INPUT_FILE:.template=%!
ECHO string replacement input !INPUT_FILE! output !OUTPUT_FILE!
powershell -Command "(gc -Raw -encoding utf8 %%i) -replace '{vendor}', '!VENDOR!' -replace '{vendor_branding_logo}', '!VENDOR_BRANDING_LOGO!' -replace '{vendor_branding_banner}', '!VENDOR_BRANDING_BANNER!' -replace '{vendor_branding_dialog}', '!VENDOR_BRANDING_DIALOG!' -replace '{vendor_branding}', '!VENDOR_BRANDING!' -replace '{product_help_link}', '!PRODUCT_HELP_LINK!' -replace '{product_support_link}', '!PRODUCT_SUPPORT_LINK!' -replace '{product_update_info_link}', '!PRODUCT_UPDATE_INFO_LINK!' | Out-File -encoding utf8 !OUTPUT_FILE!"
)

SET CACHE_BASE_FOLDER=Cache
REM Each build his own cache for concurrent build
SET CACHE_FOLDER=!CACHE_BASE_FOLDER!\!OUTPUT_BASE_FILENAME!
Expand Down Expand Up @@ -210,15 +209,12 @@ FOR %%A IN (%ARCH%) DO (
)
)

REM Prevent concurrency issues if multiple builds are running in parallel.
ECHO copy "Main.!PACKAGE_TYPE!.wxs"
COPY /Y "Main.!PACKAGE_TYPE!.wxs" "Main-!OUTPUT_BASE_FILENAME!.wxs"

REM Build with extra Source Code feature (needs work)
REM "!WIX!bin\heat.exe" file "!REPRO_DIR!\lib\src.zip" -out Src-!OUTPUT_BASE_FILENAME!.wxs -gg -srd -cg "SrcFiles" -var var.ReproDir -dr INSTALLDIR -platform !PLATFORM!
REM "!WIX!bin\heat.exe" dir "!REPRO_DIR!" -out Files-!OUTPUT_BASE_FILENAME!.wxs -t "!SETUP_RESOURCES_DIR!\heat.tools.xslt" -gg -sfrag -scom -sreg -srd -ke -cg "AppFiles" -var var.ProductMajorVersion -var var.ProductMinorVersion -var var.ProductVersionString -var var.MSIProductVersion -var var.ReproDir -dr INSTALLDIR -platform !PLATFORM!
REM "!WIX!bin\candle.exe" -arch !PLATFORM! Main-!OUTPUT_BASE_FILENAME!.wxs Files-!OUTPUT_BASE_FILENAME!.wxs Src-!OUTPUT_BASE_FILENAME!.wxs -ext WixUIExtension -ext WixUtilExtension -dProductSku="!PRODUCT_SKU!" -dProductMajorVersion="!PRODUCT_MAJOR_VERSION!" -dProductMinorVersion="!PRODUCT_MINOR_VERSION!" -dProductVersionString="!PRODUCT_SHORT_VERSION!" -dMSIProductVersion="!MSI_PRODUCT_VERSION!" -dProductId="!PRODUCT_ID!" -dReproDir="!REPRO_DIR!" -dSetupResourcesDir="!SETUP_RESOURCES_DIR!" -dCulture="!CULTURE!"
REM "!WIX!bin\light.exe" !MSI_VALIDATION_OPTION! Main-!OUTPUT_BASE_FILENAME!.wixobj Files-!OUTPUT_BASE_FILENAME!.wixobj Src-!OUTPUT_BASE_FILENAME!.wixobj -cc !CACHE_FOLDER! -ext WixUIExtension -ext WixUtilExtension -spdb -out "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" -loc "Lang\!PRODUCT_SKU!.Base.!CULTURE!.wxl" -loc "Lang\!PRODUCT_SKU!.!PACKAGE_TYPE!.!CULTURE!.wxl" -cultures:!CULTURE!
REM "!WIX!bin\candle.exe" -arch !PLATFORM! !OUTPUT_BASE_FILENAME!-Main.wxs Files-!OUTPUT_BASE_FILENAME!.wxs Src-!OUTPUT_BASE_FILENAME!.wxs -ext WixUIExtension -ext WixUtilExtension -dProductSku="!PRODUCT_SKU!" -dProductMajorVersion="!PRODUCT_MAJOR_VERSION!" -dProductMinorVersion="!PRODUCT_MINOR_VERSION!" -dProductVersionString="!PRODUCT_SHORT_VERSION!" -dMSIProductVersion="!MSI_PRODUCT_VERSION!" -dProductId="!PRODUCT_ID!" -dReproDir="!REPRO_DIR!" -dSetupResourcesDir="!SETUP_RESOURCES_DIR!" -dCulture="!CULTURE!"
REM "!WIX!bin\light.exe" !MSI_VALIDATION_OPTION! Main-!OUTPUT_BASE_FILENAME!.wixobj Files-!OUTPUT_BASE_FILENAME!.wixobj Src-!OUTPUT_BASE_FILENAME!.wixobj -cc !CACHE_FOLDER! -ext WixUIExtension -ext WixUtilExtension -spdb -out "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" -loc "Lang\!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.Base.!CULTURE!.wxl" -loc "Lang\!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!PACKAGE_TYPE!.!CULTURE!.wxl" -cultures:!CULTURE!

REM Clean .cab cache for each run .. Cache is only used inside BuildSetupTranslationTransform.cmd to speed up MST generation
IF EXIST !CACHE_FOLDER! rmdir /S /Q !CACHE_FOLDER!
Expand Down Expand Up @@ -263,7 +259,7 @@ FOR %%A IN (%ARCH%) DO (

ECHO CANDLE
@ECHO ON
"!WIX!bin\candle.exe" -arch !PLATFORM! Main-!OUTPUT_BASE_FILENAME!.wxs Files-!OUTPUT_BASE_FILENAME!.wxs !ITW_WXS! -ext WixUIExtension -ext WixUtilExtension -dIcedTeaWebDir="!ICEDTEAWEB_DIR!" -dProductSku="!PRODUCT_SKU!" -dProductMajorVersion="!PRODUCT_MAJOR_VERSION!" -dProductMinorVersion="!PRODUCT_MINOR_VERSION!" -dProductVersionString="!PRODUCT_SHORT_VERSION!" -dMSIProductVersion="!MSI_PRODUCT_VERSION!" -dProductId="!PRODUCT_ID!" -dProductUpgradeCode="!PRODUCT_UPGRADE_CODE!" -dReproDir="!REPRO_DIR!" -dSetupResourcesDir="!SETUP_RESOURCES_DIR!" -dCulture="!CULTURE!" -dJVM="!PACKAGE_TYPE!"
"!WIX!bin\candle.exe" -arch !PLATFORM! !OUTPUT_BASE_FILENAME!-Main.wxs Files-!OUTPUT_BASE_FILENAME!.wxs !ITW_WXS! -ext WixUIExtension -ext WixUtilExtension -dIcedTeaWebDir="!ICEDTEAWEB_DIR!" -dProductSku="!PRODUCT_SKU!" -dProductMajorVersion="!PRODUCT_MAJOR_VERSION!" -dProductMinorVersion="!PRODUCT_MINOR_VERSION!" -dProductVersionString="!PRODUCT_SHORT_VERSION!" -dMSIProductVersion="!MSI_PRODUCT_VERSION!" -dProductId="!PRODUCT_ID!" -dProductUpgradeCode="!PRODUCT_UPGRADE_CODE!" -dReproDir="!REPRO_DIR!" -dSetupResourcesDir="!SETUP_RESOURCES_DIR!" -dCulture="!CULTURE!" -dJVM="!PACKAGE_TYPE!"
IF ERRORLEVEL 1 (
ECHO Failed to preprocesses and compiles WiX source files into object files ^(.wixobj^)
GOTO FAILED
Expand All @@ -272,7 +268,7 @@ FOR %%A IN (%ARCH%) DO (

ECHO LIGHT
@ECHO ON
"!WIX!bin\light.exe" Main-!OUTPUT_BASE_FILENAME!.wixobj Files-!OUTPUT_BASE_FILENAME!.wixobj !ITW_WIXOBJ! !MSI_VALIDATION_OPTION! -cc !CACHE_FOLDER! -ext WixUIExtension -ext WixUtilExtension -spdb -out "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" -loc "Lang\!PRODUCT_SKU!.Base.!CULTURE!.wxl" -loc "Lang\!PRODUCT_SKU!.!PACKAGE_TYPE!.!CULTURE!.wxl" -cultures:!CULTURE!
"!WIX!bin\light.exe" Main-!OUTPUT_BASE_FILENAME!.wixobj Files-!OUTPUT_BASE_FILENAME!.wixobj !ITW_WIXOBJ! !MSI_VALIDATION_OPTION! -cc !CACHE_FOLDER! -ext WixUIExtension -ext WixUtilExtension -spdb -out "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" -loc "Lang\!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.Base.!CULTURE!.wxl" -loc "Lang\!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!PACKAGE_TYPE!.!CULTURE!.wxl" -cultures:!CULTURE!
IF ERRORLEVEL 1 (
ECHO Failed to links and binds one or more .wixobj files and creates a Windows Installer database ^(.msi or .msm^)
GOTO FAILED
Expand Down Expand Up @@ -352,7 +348,7 @@ FOR %%A IN (%ARCH%) DO (
REM Remove files we do not need any longer.
DEL "Files-!OUTPUT_BASE_FILENAME!.wxs"
DEL "Files-!OUTPUT_BASE_FILENAME!.wixobj"
DEL "Main-!OUTPUT_BASE_FILENAME!.wxs"
DEL "!OUTPUT_BASE_FILENAME!-Main.wxs"
DEL "Main-!OUTPUT_BASE_FILENAME!.wixobj"
IF DEFINED ITW_WXS (
DEL !ITW_WXS!
Expand Down
42 changes: 28 additions & 14 deletions wix/Includes/OpenJDK.Variables.wxi.template
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,37 @@
<?endif?>
<?endif?>

<!-- cf https://github.com/AdoptOpenJDK/openjdk-installer/issues/137 -->
<?if $(env.PRODUCT_CATEGORY)="jre"?>
<?if $(var.ProductMajorVersion)>=9?>
<!-- Prefere Server JVM in Java 9+ x64 -->
<?define DllPath="bin\server\jvm.dll" ?>
<?else?>
<!-- Java 1.8 -->
<?if $(env.PLATFORM)="x86"?>
<!-- if x86 then client jvm -->
<?define DllPath="bin\client\jvm.dll" ?>
<?else?>
<!-- if x64 then server jvm -->
<?if $(var.JVM)="openj9" ?>
<?define Licence="license-OpenJ9.en-us.rtf" ?>
<?elseif $(var.JVM)="hotspot" ?>
<?define Licence="license-GPLv2+CE.en-us.rtf" ?>
<?else?>
<?define Licence="no licence defined for $(var.JVM)" ?>
<?endif?>

<?if $(var.JVM)="openj9"?>
<?define DllPath="bin\server\jvm.dll" ?>
<?elseif $(var.JVM)="hotspot" ?>
<!-- cf https://github.com/AdoptOpenJDK/openjdk-installer/issues/137 -->
<?if $(env.PRODUCT_CATEGORY)="jre"?>
<?if $(var.ProductMajorVersion)>=9?>
<!-- Prefere Server JVM in Java 9+ x64 -->
<?define DllPath="bin\server\jvm.dll" ?>
<?endif?>
<?else?>
<!-- Java 1.8 -->
<?if $(env.PLATFORM)="x86"?>
<!-- if x86 then client jvm -->
<?define DllPath="bin\client\jvm.dll" ?>
<?else?>
<!-- if x64 then server jvm -->
<?define DllPath="bin\server\jvm.dll" ?>
<?endif?>
<?endif?>
<?else?>
<?define DllPath="no RuntimeLib jvm.dll for JDK since Oracle does not define it" ?>
<?endif?>
<?else?>
<?define DllPath="no RuntimeLib jvm.dll for JDK since Oracle does not define it" ?>
<?define DllPath="no DllPath known for $(var.JVM)" ?>
<?endif?>

<!-- Static settings, DO NOT TOUCH or upgrades will break! -->
Expand Down
Loading

0 comments on commit a0dc17c

Please sign in to comment.