Skip to content

Latest commit

 

History

History
280 lines (255 loc) · 13.1 KB

README.md

File metadata and controls

280 lines (255 loc) · 13.1 KB

WiX examples with OpenJDK distribution

WiX Toolset Directory openjdk-examples\ contains WiX examples written by ourself to create an OpenJDK Windows installer.

The mission of the Eclipse Adoptium project is to provide an open and reproducible build and test system for OpenJDK source across multiple platforms.

That includes the development of a WiX installer (see GitHub project adoptium/installer) configurable for various OpenJDK implementations.

OpenJDK

Project OpenJDK is derived from the WiX installer developed in the project adoptium/installer.

🔎 Localization and resource files are the same as well as the source file src\Main.wxs but we do not have a source file src\Fragments.wxs as in the Adoptium project. GUID values are stored in a separate file named app\OpenJDK-11.0.13_8.txt (directory app\ is ignored by git) and inserted into the generated WiX file target\src_gen\Fragments.wxs before calling the candle tool (compiler).

The project directory is organized as follows :

> cd
Y:\openjdk-examples\OpenJDK
 
> tree /f . | findstr /v /b [a-z]00download.txtbuild.bat
├───app
│   ├───OpenJDK-11.0.13_8
│   │      (files extracted from OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.zip)
│   ├───OpenJDK-17.0.1_12
│   │      (files extracted from OpenJDK17U-jdk_x64_windows_hotspot_17.0.1_12.zip)
│   └───OpenJDK-8u312b07(files extracted from OpenJDK11U-jdk_x64_windows_hotspot_8u312b07.zip)OpenJDK-11.0.13_8.txtOpenJDK-17.0.1_12.txtOpenJDK-8u312b07.txt
└───srcIncludes.wxiMain.wxs
    ├───localizationsOpenJDK.Base.en-us.wxlOpenJDK.Base.fr-fr.wxlOpenJDK.hotspot.en-us.wxlOpenJDK.hotspot.fr-fr.wxlOpenJDK.openj9.en-us.wxlOpenJDK.openj9.fr-fr.wxl
    └───resources
            license-GPLv2+CE.en-us.rtf
            license-OpenJ9.en-us.rtf
            logo.ico
            wix-banner.bmp
            wix-dialog.bmp

🔎 Command build.bat reads the build configuration from file build.properties 1, e.g.

> type build.properties
PRODUCT_MAJOR_VERSION=11
PRODUCT_MINOR_VERSION=0
PRODUCT_MAINTENANCE_VERSION=13
PRODUCT_PATCH_VERSION=0
PRODUCT_BUILD_NUMBER=8
PRODUCT_UPGRADE_CODE=<guid-for-version-11>
# ARCH=x64|x86-32|arm64 or all "x64 x86-32 arm64"
ARCH=x64
# JVM=hotspot|openj9|dragonwell or both JVM=hotspot openj9
JVM=hotspot
# PRODUCT_CATEGORY=jre|jdk (only one at a time)
PRODUCT_CATEGORY=jdk
# Add -sval option to light.exe to skip MSI/MSM validation and skip smoke.exe )
SKIP_MSI_VALIDATION=true
#
BUNDLE_ICEDTEAWEB=false

Command build.bat link 2 generates the OpenJDK 11 Windows installer with file name OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi 3 based on the properties defined in file build.properties.

> build -verbose clean link
Delete directory "target"
Generate auxiliary file "target\src_gen\Fragments.wxs.txt"
Saved 497 component identifiers to file "target\src_gen\Fragments.cid.txt"
ECHO is off.
Execute PS1 script "target\replace.ps1"
Compiling 2 WiX source files to directory "target"
Create Windows installer "target\OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi"

The output directory target\ looks as follows :

> dir /a-d /b target
candle_opts.txt
candle_sources.txt
Fragments.wixobj
light_opts.txt
Main.wixobj
OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi
OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi.md5
OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi.sha256
OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.wixpdb
replace.ps1

Figures 1.1 to 1.4 below illustrate the dialog windows of our OpenJDK 11 Windows installer while figures 1.5 and 1.6 show the updated user environment after the successful execution of the Windows installer.

Figure 1.1 - Welcome
(OpenJDK 11 installer).
 
Figure 1.2 - Custom setup
(OpenJDK 11 installer).
Figure 1.3 - Ready
(OpenJDK 11 installer).
 
Figure 1.4 - Completed installation
(OpenJDK 11 installer).
Figure 1.5 - OpenJDK 11 directory
(Program Files folder).
 
Figure 1.6 - Uninstall
(Settings window).

Footnotes

[1] Configuration file build.properties

We can adapt the properties as follow in order to create an OpenJDK 17 Windows installer :
# OpenJDK 17.0.1.12
PRODUCT_MAJOR_VERSION=17
PRODUCT_MINOR_VERSION=0
PRODUCT_MAINTENANCE_VERSION=1
PRODUCT_PATCH_VERSION=0
PRODUCT_BUILD_NUMBER=12
PRODUCT_UPGRADE_CODE=<guid-for-version-17>
Similarly we can adapt the properties as follows to create an OpenJDK 1.8 Windows installer :
# OpenJDK 1.8 (aka 8u312b07)
PRODUCT_MAJOR_VERSION=8
PRODUCT_MINOR_VERSION=0
PRODUCT_MAINTENANCE_VERSION=312
PRODUCT_PATCH_VERSION=0
PRODUCT_BUILD_NUMBER=07
PRODUCT_UPGRADE_CODE=<guid-for-version-8>

[2] Batch file build.bat

Command build.bat help displays the batch file options and subcommands :
> build help
Usage: build { <option> | <subcommand> }
 
  Options:
    -debug       show commands executed by this script
    -timer       display total execution time
    -verbose     display progress messages
 
  Subcommands:
    clean        delete generated files
    help         display this help message
    install      execute Windows installer OpenJDK
    link         create Windows installer from WXS/WXI/WXL files
    remove       remove installed program (same as uninstall)
    uninstall    remove installed program

[3] File naming conventions

For instance the name of file OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi can be decomposed as follows (see also the Swagger descriptions of the OpenAPI UI):
Name part Description Values
OpenJDK Product SKU OpenJDK
11 Product major version 8, 11, 17
U Update release U
jdk Product category jdk, jre
x64 Target architecture aarch64, arm64, ppc64, s390x, x64, x86_32
windows Target platform aix, alpine-linux,arm_linux, linux, mac, windows
hotspot JVM variant hotspot, openj9, dragonwell
11.0.13_8
 
8u312b07
Product version <major>.<minor>.<maintenance>_<build>
NB. prior to Java 10 written :
<major>u<maintenance>b<build>
msi File extension msi, zip

mics/December 2023