Skip to content

Commit

Permalink
Allow vendors to specify custom templates without changing GUID (#949)
Browse files Browse the repository at this point in the history
* base commit for msft branding

* fixed feature and branding names in msft openjdk templates

* Fixed CRLF in en-us msft template

* Set 'microsoft' to be acceptable jvm string

* Set 'microsoft' to be acceptable jvm string in comments

* Now using TEMPLATE_NAME var
  • Loading branch information
jmjaffe37 authored Jul 12, 2024
1 parent 0fa43c7 commit d97ef10
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 14 deletions.
35 changes: 22 additions & 13 deletions wix/Build.OpenJDK_generic.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REM PRODUCT_PATCH_VERSION=0
REM PRODUCT_BUILD_NUMBER=28
REM MSI_PRODUCT_VERSION=11.0.0.28
REM ARCH=x64|x86-32|x86|arm64 or all "x64 x86-32 arm64"
REM JVM=hotspot|openj9|dragonwell or both JVM=hotspot openj9
REM JVM=hotspot|openj9|dragonwell|microsoft or both JVM=hotspot openj9
REM PRODUCT_CATEGORY=jre|jdk (only one at a time)
REM SKIP_MSI_VALIDATION=true (Add -sval option to light.exe to skip MSI/MSM validation and skip smoke.exe )
REM UPGRADE_CODE_SEED=thisIsAPrivateSecretSeed ( optional ) for upgradable MSI (If none, new PRODUCT_UPGRADE_CODE is generate for each run)
Expand Down Expand Up @@ -53,10 +53,13 @@ IF %ERRORLEVEL% == 1 (
REM Update to handle the change of build variant until implications
REM of setting this to Temurin can be evaluated
IF "%JVM%" == "temurin" SET JVM=hotspot
@REM Microsoft update to handle similar situation
IF "%JVM%" == "microsoft" SET TEMPLATE_NAME=microsoft
IF "%JVM%" == "microsoft" SET JVM=hotspot

powershell -ExecutionPolicy Bypass -File "%~dp0\helpers\Validate-Input.ps1" ^
-toValidate '%JVM%' ^
-validInputs "hotspot,openj9,dragonwell,openj9 hotspot,hotspot openj9" ^
-validInputs "hotspot,openj9,dragonwell,microsoft,openj9 hotspot,hotspot openj9" ^
-delimiter ","

IF %ERRORLEVEL% == 1 (
Expand Down Expand Up @@ -120,7 +123,12 @@ FOR %%A IN (%ARCH%) DO (
FOR %%J IN (%JVM%) DO (
SET PACKAGE_TYPE=%%J
SET PLATFORM=%%A
ECHO Generate OpenJDK setup "!PACKAGE_TYPE!" for "!PLATFORM!" platform "!PRODUCT_CATEGORY!"

@REM TEMPLATE_NAME is only used to allow vendors to have their own
@REM custom templates without changing their GUID.
IF NOT DEFINED TEMPLATE_NAME SET TEMPLATE_NAME=!PACKAGE_TYPE!

ECHO Generate OpenJDK setup "!TEMPLATE_NAME!" for "!PLATFORM!" platform "!PRODUCT_CATEGORY!"
ECHO ****************************************************
SET CULTURE=en-us
SET LANGIDS=1033
Expand All @@ -132,12 +140,12 @@ FOR %%A IN (%ARCH%) DO (
SET SETUP_RESOURCES_DIR=.\Resources

FOR %%P IN (
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!PACKAGE_TYPE!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!PACKAGE_TYPE!\!FOLDER_PLATFORM!\jdk%PRODUCT_MAJOR_VERSION%u%PRODUCT_MAINTENANCE_VERSION%-b%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!PACKAGE_TYPE!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%+%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!PACKAGE_TYPE!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%+%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!PACKAGE_TYPE!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%.%PRODUCT_PATCH_VERSION%+%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!-Latest\!PACKAGE_TYPE!\!FOLDER_PLATFORM!\jdk-!PRODUCT_SHORT_VERSION!
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!TEMPLATE_NAME!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!TEMPLATE_NAME!\!FOLDER_PLATFORM!\jdk%PRODUCT_MAJOR_VERSION%u%PRODUCT_MAINTENANCE_VERSION%-b%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!TEMPLATE_NAME!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%+%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!TEMPLATE_NAME!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%+%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!\!TEMPLATE_NAME!\!FOLDER_PLATFORM!\jdk-%PRODUCT_MAJOR_VERSION%.%PRODUCT_MINOR_VERSION%.%PRODUCT_MAINTENANCE_VERSION%.%PRODUCT_PATCH_VERSION%+%PRODUCT_BUILD_NUMBER%
!PRODUCT_SKU!-Latest\!TEMPLATE_NAME!\!FOLDER_PLATFORM!\jdk-!PRODUCT_SHORT_VERSION!
) DO (
SET REPRO_DIR=.\SourceDir\%%P
IF "!PRODUCT_CATEGORY!" == "jre" (
Expand All @@ -157,9 +165,9 @@ FOR %%A IN (%ARCH%) DO (
:CONTINUE
ECHO Source dir used : !REPRO_DIR!

IF NOT DEFINED OUTPUT_BASE_FILENAME SET OUTPUT_BASE_FILENAME=!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!-!PRODUCT_CATEGORY!_!FOLDER_PLATFORM!_windows_!PACKAGE_TYPE!-!PRODUCT_FULL_VERSION!
IF NOT DEFINED OUTPUT_BASE_FILENAME SET OUTPUT_BASE_FILENAME=!PRODUCT_SKU!!PRODUCT_MAJOR_VERSION!-!PRODUCT_CATEGORY!_!FOLDER_PLATFORM!_windows_!TEMPLATE_NAME!-!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, *.Base.*.wxl.template *.!JVM!.*.wxl.template,*.wxs.template') DO (
FOR /f %%i IN ('dir /s /b *.wxi.template, *.Base.*.wxl.template *.!TEMPLATE_NAME!.*.wxl.template,*.wxs.template') DO (
SET INPUT_FILE=%%~ni
REM Prevent concurrency issues if multiple builds are running in parallel.
SET OUTPUT_FILE=%WORKDIR%!OUTPUT_BASE_FILENAME!-!INPUT_FILE:.template=%!
Expand Down Expand Up @@ -294,7 +302,7 @@ FOR %%A IN (%ARCH%) DO (
-d JVM="!PACKAGE_TYPE!" ^
-cc !CACHE_FOLDER! ^
-loc "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.Base.!CULTURE!.wxl" ^
-loc "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!PACKAGE_TYPE!.!CULTURE!.wxl" ^
-loc "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!TEMPLATE_NAME!.!CULTURE!.wxl" ^
-out "ReleaseDir\!OUTPUT_BASE_FILENAME!.msi" ^
-culture !CULTURE! ^
-pdbtype none
Expand Down Expand Up @@ -376,13 +384,14 @@ FOR %%A IN (%ARCH%) DO (
REM Remove files we do not need any longer.
DEL "%WORKDIR%!OUTPUT_BASE_FILENAME!-Files.wxs"
DEL "%WORKDIR%!OUTPUT_BASE_FILENAME!-Main.wxs"
DEL "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.%JVM%.*.wxl"
DEL "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!TEMPLATE_NAME!.*.wxl"
DEL "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.Base.*.wxl"
DEL "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.Variables.wxi"
IF DEFINED ITW_WXS (
DEL !ITW_WXS!
)
RMDIR /S /Q !CACHE_FOLDER!
SET TEMPLATE_NAME=
)
SET ITW_WXS=
)
Expand Down
2 changes: 1 addition & 1 deletion wix/BuildSetupTranslationTransform.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ wix build -arch !PLATFORM! ^
-d JVM="!PACKAGE_TYPE!" ^
-cc !CACHE_FOLDER! ^
-loc "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.Base.!CULTURE!.wxl" ^
-loc "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!PACKAGE_TYPE!.!CULTURE!.wxl" ^
-loc "%WORKDIR%!OUTPUT_BASE_FILENAME!-!PRODUCT_SKU!.!TEMPLATE_NAME!.!CULTURE!.wxl" ^
-out "ReleaseDir\!OUTPUT_BASE_FILENAME!.!CULTURE!.msi" ^
-culture !CULTURE! ^
-pdbtype none
Expand Down
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.de-de.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="de-de" Codepage="1252" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.en-us.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.es-es.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="es-es" Codepage="1252" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.fr-fr.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="fr-fr" Codepage="1252" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.ja-jp.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="ja-jp" Codepage="932" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.zh-cn.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="zh-cn" Codepage="936" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>
8 changes: 8 additions & 0 deletions wix/Lang/OpenJDK.microsoft.zh-tw.wxl.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="zh-tw" Codepage="950" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Microsoft does not currently support JREs -->
<String Id="JDKFeatureMainName" Value="{vendor_branding}" />
<String Id="JDKFeatureMainDescription" Value="{vendor_branding} " />
<String Id="JDKProductName" Value="{vendor_branding} " />
<String Id="JDKPackageDescription" Value="{vendor_branding}" />
</WixLocalization>

0 comments on commit d97ef10

Please sign in to comment.