Skip to content

Commit

Permalink
Update build-scripts to enable hotspot & temurin jdk(head) version br…
Browse files Browse the repository at this point in the history
…anch builds (#3852)

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Enable building jdk23+ jdk(head) version branches

Signed-off-by: Andrew Leonard <[email protected]>

* Update sbin/common/common.sh

Co-authored-by: Stewart X Addison <[email protected]>

---------

Signed-off-by: Andrew Leonard <[email protected]>
Co-authored-by: Stewart X Addison <[email protected]>
  • Loading branch information
andrew-m-leonard and sxa authored Jun 17, 2024
1 parent 21e479e commit 182047c
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 31 deletions.
33 changes: 29 additions & 4 deletions configureBuild.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# shellcheck disable=SC1091
# shellcheck disable=SC1091,SC2155
# ********************************************************************************
# Copyright (c) 2018 Contributors to the Eclipse Foundation
#
Expand Down Expand Up @@ -170,6 +170,7 @@ setVariablesForConfigure() {
setRepository() {

local suffix
local githubRepoName=$(getOpenjdkGithubRepoName "${BUILD_CONFIG[OPENJDK_FOREST_NAME]}")

# Location of Extensions for OpenJ9 project
if [[ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_OPENJ9}" ]]; then
Expand Down Expand Up @@ -200,12 +201,12 @@ setRepository() {
|| [ "${BUILD_CONFIG[OPENJDK_CORE_VERSION]}" == "${JDK11_CORE_VERSION}" ]; then
suffix="openjdk/riscv-port-${BUILD_CONFIG[OPENJDK_FOREST_NAME]}"
else
suffix="openjdk/${BUILD_CONFIG[OPENJDK_FOREST_NAME]}"
suffix="openjdk/${githubRepoName}"
fi
elif [[ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_TEMURIN}" ]]; then
suffix="adoptium/${BUILD_CONFIG[OPENJDK_FOREST_NAME]}"
suffix="adoptium/${githubRepoName}"
else
suffix="openjdk/${BUILD_CONFIG[OPENJDK_FOREST_NAME]}"
suffix="openjdk/${githubRepoName}"
fi

local repository
Expand All @@ -219,6 +220,30 @@ setRepository() {
repository="$(echo "${repository}" | awk '{print tolower($0)}')"

BUILD_CONFIG[REPOSITORY]="${BUILD_CONFIG[REPOSITORY]:-${repository}}"

echo "Using source repository ${BUILD_CONFIG[REPOSITORY]}"
}

# Given a forest_name (eg.jdk23), return the corresponding repository name
getOpenjdkGithubRepoName() {
local forest_name="$1"
local repoName=""

# "Update" versions are currently in a repository with the name of the forest
if [[ ${forest_name} == *u ]]; then
repoName="${forest_name}"
else
local featureNumber=$(echo "${forest_name}" | tr -d "[:alpha:]")

# jdk-23+ stabilisation versions are within the jdk(head) repository
if [[ "${featureNumber}" -ge 23 ]]; then
repoName="jdk"
else
repoName="${forest_name}"
fi
fi

echo "${repoName}"
}

# Specific architectures need to have special build settings
Expand Down
48 changes: 48 additions & 0 deletions sbin/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@
# shellcheck disable=SC2155
# shellcheck disable=SC2153
function setOpenJdkVersion() {
# forest_name represents the JDK version with "u" suffix for an "update version"
#
# It no longer relates directly to the openjdk repository name, as the jdk(head) repository
# now has version branches for jdk-23+
#
# Format: jdkNN[u]
#
local forest_name=$1

echo "Setting version based on forest_name=${forest_name}"

# The argument passed here have actually very strict format of jdk8, jdk8u..., jdk
# the build may fail later if this is not honoured.
# If your repository has a different name, you can use --version or build from dir/snapshot
Expand Down Expand Up @@ -81,6 +90,45 @@ function setOpenJdkVersion() {
# feature number e.g. 11
BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]=${featureNumber}

# Set default branch based on JDK forest and feature number
setBranch
}

# Set the default BUILD_CONFIG[BRANCH] for the jdk version being built
# For "hotspot" and "Temurin" builds of non-"u" jdk-23+ the branch is dev_<version>
function setBranch() {

# Which repo branch to build, e.g. dev by default for temurin, "openj9" for openj9
local branch="master"
local adoptium_mirror_branch="dev"

# non-u (and non-tip) jdk-23+ hotspot and adoptium version source is within a "version" branch in the "jdk" repository
if [[ ${BUILD_CONFIG[OPENJDK_FOREST_NAME]} != *u ]] && [[ ${BUILD_CONFIG[OPENJDK_FOREST_NAME]} != "jdk" ]] && [[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 23 ]]; then
branch="jdk${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}"
adoptium_mirror_branch="dev_jdk${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}"
fi

if [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_TEMURIN}" ]; then
branch="${adoptium_mirror_branch}"
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_OPENJ9}" ]; then
branch="openj9";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_DRAGONWELL}" ]; then
branch="master";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_FAST_STARTUP}" ]; then
branch="master";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_CORRETTO}" ]; then
branch="develop";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_BISHENG}" ]; then
if [ "${BUILD_CONFIG[OS_ARCHITECTURE]}" == "riscv64" ] ; then
branch="risc-v"
else
branch="master"
fi
fi

BUILD_CONFIG[BRANCH]=${BUILD_CONFIG[BRANCH]:-$branch}

echo "Default branch set to BUILD_CONFIG[BRANCH]=${BUILD_CONFIG[BRANCH]}"
}

function crossPlatformRealPath() {
Expand Down
27 changes: 0 additions & 27 deletions sbin/common/config_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,33 +393,6 @@ function parseConfigurationArguments() {
*) echo >&2 "Invalid build.sh option: ${opt}"; exit 1;;
esac
done

setBranch
}

function setBranch() {

# Which repo branch to build, e.g. dev by default for temurin, "openj9" for openj9
local branch="master"
if [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_TEMURIN}" ]; then
branch="dev"
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_OPENJ9}" ]; then
branch="openj9";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_DRAGONWELL}" ]; then
branch="master";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_FAST_STARTUP}" ]; then
branch="master";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_CORRETTO}" ]; then
branch="develop";
elif [ "${BUILD_CONFIG[BUILD_VARIANT]}" == "${BUILD_VARIANT_BISHENG}" ]; then
if [ "${BUILD_CONFIG[OS_ARCHITECTURE]}" == "riscv64" ] ; then
branch="risc-v"
else
branch="master"
fi
fi

BUILD_CONFIG[BRANCH]=${BUILD_CONFIG[BRANCH]:-$branch}
}

# Set the local dir if used
Expand Down

0 comments on commit 182047c

Please sign in to comment.