Skip to content

Commit 07855c2

Browse files
authored
Add support for on-demand JREs for JDK16+ (#2788)
Add a new argument to the build scripts: --create-jre-image. A JRE image is produced when this argument is set. It is optional for JDK16 and above. Signed-off-by: Violeta Sebe <[email protected]>
1 parent 974aae3 commit 07855c2

File tree

6 files changed

+36
-19
lines changed

6 files changed

+36
-19
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ clean out any 'bad' local git repo you already have.
134134
--create-debug-image
135135
create a debug-image archive with the debug symbols.
136136

137+
--create-jre-image
138+
create the legacy JRE image in addition to the JDK image.
139+
137140
-d, --destination <path>
138141
specify the location for the built binary, e.g. /path/.
139142
This is typically used in conjunction with -T to create a custom path

build-farm/make-adopt-build-farm.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ export BUILD_ARGS="${BUILD_ARGS} --use-jep319-certs"
213213
# Enable debug images for all platforms
214214
export BUILD_ARGS="${BUILD_ARGS} --create-debug-image"
215215

216+
# JRE images are not produced for JDK16 and above
217+
# as per https://github.com/adoptium/adoptium-support/issues/333
218+
# Enable legacy JRE images for all platforms and versions older than 16
219+
if [ "${JAVA_FEATURE_VERSION}" -lt 16 ]; then
220+
export BUILD_ARGS="${BUILD_ARGS} --create-jre-image"
221+
fi
222+
216223
echo "$PLATFORM_SCRIPT_DIR/../makejdk-any-platform.sh --clean-git-repo --jdk-boot-dir ${JDK_BOOT_DIR} --configure-args ${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --target-file-name ${FILENAME} ${TAG_OPTION} ${OPTIONS} ${BUILD_ARGS} ${VARIANT_ARG} ${JAVA_TO_BUILD}"
217224

218225
# Convert all speech marks in config args to make them safe to pass in.

configureBuild.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ processArgumentsforSpecificArchitectures() {
214214
# This is to ensure consistency with the defaults defined in setMakeArgs()
215215
if [ "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" == "${JDK8_CORE_VERSION}" ]; then
216216
make_args_for_any_platform="CONF=${build_full_name} DEBUG_BINARIES=true images"
217-
# Don't produce a JRE for JDK16 and above
218-
elif [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 16 ]; then
217+
# Don't produce a JRE
218+
elif [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "false" ]; then
219219
make_args_for_any_platform="CONF=${build_full_name} DEBUG_BINARIES=true product-images"
220220
else
221221
make_args_for_any_platform="CONF=${build_full_name} DEBUG_BINARIES=true product-images legacy-jre-image"
@@ -245,8 +245,8 @@ processArgumentsforSpecificArchitectures() {
245245
if [ "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" == "${JDK8_CORE_VERSION}" ] && isHotSpot; then
246246
jvm_variant=client
247247
make_args_for_any_platform="DEBUG_BINARIES=true images"
248-
elif [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 16 ]; then
249-
# Don't produce a JRE for JDK16 and above
248+
elif [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "false" ]; then
249+
# Don't produce a JRE
250250
jvm_variant=server,client
251251
make_args_for_any_platform="DEBUG_BINARIES=true images"
252252
else
@@ -299,15 +299,15 @@ function setMakeArgs() {
299299
if [ "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" != "${JDK8_CORE_VERSION}" ]; then
300300
case "${BUILD_CONFIG[OS_KERNEL_NAME]}" in
301301
"darwin")
302-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 16 ]; then
303-
# Skip JRE on JDK16+
302+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "false" ]; then
303+
# Skip JRE
304304
BUILD_CONFIG[MAKE_ARGS_FOR_ANY_PLATFORM]=${BUILD_CONFIG[MAKE_ARGS_FOR_ANY_PLATFORM]:-"product-images"}
305305
else
306306
BUILD_CONFIG[MAKE_ARGS_FOR_ANY_PLATFORM]=${BUILD_CONFIG[MAKE_ARGS_FOR_ANY_PLATFORM]:-"product-images mac-legacy-jre-bundle"}
307307
fi
308308
;;
309309
*)
310-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 16 ]; then
310+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "false" ]; then
311311
# Skip JRE on JDK16+
312312
BUILD_CONFIG[MAKE_ARGS_FOR_ANY_PLATFORM]=${BUILD_CONFIG[MAKE_ARGS_FOR_ANY_PLATFORM]:-"product-images"}
313313
else

makejdk-any-platform.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ specify any custom user configuration arguments.
7070
.BR \-\-clean-git-repo
7171
clean out any 'bad' local git repo you already have.
7272
.TP
73+
.BR \-\-create-jre-image
74+
create the legacy JRE image in addition to the JDK image.
75+
.TP
7376
.BR \-\-create-source-archive
7477
create an archive of the sources which got used to build OpenJDK
7578
.TP

sbin/build.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,8 @@ removingUnnecessaryFiles() {
753753
rm -rf "${jdkTargetPath}" || true
754754
mv "${jdkPath}" "${jdkTargetPath}"
755755

756-
# Don't produce a JRE for JDK16 and above
757-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -lt 16 ]; then
756+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "true" ]; then
757+
# Produce a JRE
758758
if [ -d "$(ls -d ${BUILD_CONFIG[JRE_PATH]})" ]; then
759759
echo "moving $(ls -d ${BUILD_CONFIG[JRE_PATH]}) to ${jreTargetPath}"
760760
rm -rf "${jreTargetPath}" || true
@@ -1284,8 +1284,7 @@ copyFreeFontForMacOS() {
12841284
local jdkTargetPath=$(getJdkArchivePath)
12851285
makeACopyOfLibFreeFontForMacOSX "${jdkTargetPath}" "${BUILD_CONFIG[COPY_MACOSX_FREE_FONT_LIB_FOR_JDK_FLAG]}"
12861286

1287-
# Don't produce a JRE for JDK16 and above
1288-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -lt 16 ]; then
1287+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "true" ]; then
12891288
local jreTargetPath=$(getJreArchivePath)
12901289
makeACopyOfLibFreeFontForMacOSX "${jreTargetPath}" "${BUILD_CONFIG[COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG]}"
12911290
fi
@@ -1295,8 +1294,7 @@ setPlistForMacOS() {
12951294
local jdkTargetPath=$(getJdkArchivePath)
12961295
setPlistValueForMacOS "${jdkTargetPath}" "jdk"
12971296

1298-
# Don't produce a JRE for JDK16 and above
1299-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -lt 16 ]; then
1297+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "true" ]; then
13001298
local jreTargetPath=$(getJreArchivePath)
13011299
setPlistValueForMacOS "${jreTargetPath}" "jre"
13021300
fi
@@ -1306,8 +1304,7 @@ addNoticeFile() {
13061304
local jdkTargetPath=$(getJdkArchivePath)
13071305
createNoticeFile "${jdkTargetPath}" "jdk"
13081306

1309-
# Don't produce a JRE for JDK16 and above
1310-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -lt 16 ]; then
1307+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "true" ]; then
13111308
local jreTargetPath=$(getJreArchivePath)
13121309
createNoticeFile "${jreTargetPath}" "jre"
13131310
fi
@@ -1363,8 +1360,8 @@ addInfoToReleaseFile() {
13631360
echo "ADDING J9 TAG"
13641361
addJ9Tag
13651362
fi
1366-
# Don't produce a JRE for JDK16 and above
1367-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -lt 16 ]; then
1363+
1364+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "true" ]; then
13681365
echo "MIRRORING TO JRE"
13691366
mirrorToJRE
13701367
fi
@@ -1490,8 +1487,8 @@ mirrorToJRE() {
14901487

14911488
addImageType() {
14921489
echo -e IMAGE_TYPE=\"JDK\" >>"$PRODUCT_HOME/release"
1493-
# Don't produce a JRE for JDK16 and above
1494-
if [ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -lt 16 ]; then
1490+
1491+
if [ "${BUILD_CONFIG[CREATE_JRE_IMAGE]}" == "true" ]; then
14951492
echo -e IMAGE_TYPE=\"JRE\" >>"$JRE_HOME/release"
14961493
fi
14971494
}

sbin/common/config_init.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ COPY_MACOSX_FREE_FONT_LIB_FOR_JDK_FLAG
4848
COPY_MACOSX_FREE_FONT_LIB_FOR_JRE_FLAG
4949
COPY_TO_HOST
5050
CREATE_DEBUG_IMAGE
51+
CREATE_JRE_IMAGE
5152
CREATE_SOURCE_ARCHIVE
5253
CUSTOM_CACERTS
5354
CROSSCOMPILE
@@ -236,6 +237,9 @@ function parseConfigurationArguments() {
236237
"--create-debug-image" )
237238
BUILD_CONFIG[CREATE_DEBUG_IMAGE]="true";;
238239

240+
"--create-jre-image" )
241+
BUILD_CONFIG[CREATE_JRE_IMAGE]=true;;
242+
239243
"--create-source-archive" )
240244
BUILD_CONFIG[CREATE_SOURCE_ARCHIVE]=true;;
241245

@@ -452,6 +456,9 @@ function configDefaults() {
452456
# The default behavior of whether we want to create a separate debug symbols archive
453457
BUILD_CONFIG[CREATE_DEBUG_IMAGE]="false"
454458

459+
# The default behavior of whether we want to create the legacy JRE
460+
BUILD_CONFIG[CREATE_JRE_IMAGE]="false"
461+
455462
# The default behavior of whether we want to create a separate source archive
456463
BUILD_CONFIG[CREATE_SOURCE_ARCHIVE]="false"
457464

0 commit comments

Comments
 (0)