Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.1] Fixes version parsing for WARNING situations #444

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 52 additions & 11 deletions .github/workflows/buildJDK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ jobs:
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1
echo ${JAVA_HOME}
${JAVA_HOME}/bin/java --version
- name: Use python 3.10
# The minimum supported version is 3.9 see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel JDK
run: |
${JAVA_HOME}/bin/java -ea build.java --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tar.gz
Expand Down Expand Up @@ -134,11 +139,12 @@ jobs:
path: mandrel-java21-linux-amd64.tarxz

build-and-test-on-mac:
name: MacOS Build and test ${{ matrix.mandrel-ref }} branch/tag
runs-on: macos-latest
name: ${{ matrix.os }} Build and test ${{ matrix.mandrel-ref }} branch/tag
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, macos-13]
mandrel-ref: [mandrel/23.1]
steps:
- uses: actions/checkout@v3
Expand All @@ -152,7 +158,7 @@ jobs:
with:
repository: graalvm/mx.git
fetch-depth: 1
ref: 6.45.0
ref: 6.52.0
path: ${{ github.workspace }}/mx
- uses: actions/cache@v3
with:
Expand All @@ -166,28 +172,51 @@ jobs:
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven-
- name: Get runner architecture
id: arch
run: |
export ARCH=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]' | sed 's/arm64/aarch64/')
echo "ARCH=${ARCH}"
echo "ARCH=${ARCH}" >> "$GITHUB_OUTPUT"
- name: Get latest OpenJDK 21 with static libs
env:
ARCH: ${{ steps.arch.outputs.ARCH }}
run: |
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/mac/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/mac/x64/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/mac/${ARCH}/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/21/ea/mac/${ARCH}/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz
mkdir -p ${JAVA_HOME}
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1
# work-around for https://github.com/adoptium/temurin-build/issues/3602
pushd ${MAC_JAVA_HOME}
if [ -e lib/static/darwin-arm64 ]; then
mv lib/static/darwin-arm64 lib/static/darwin-amd64
if [[ -e lib/static/darwin-arm64 ]]; then
if [[ "$ARCH" == "x64" ]]; then
mv lib/static/darwin-arm64 lib/static/darwin-amd64
else
mv lib/static/darwin-arm64 lib/static/darwin-${ARCH}
fi
fi
popd
echo ${MAC_JAVA_HOME}
${MAC_JAVA_HOME}/bin/java --version
- name: Use python 3.10
# mx uses distutils which is no longer available in python 3.12 which is the default in macos-latest
# use 3.10 instead (the minimum supported version is 3.9) see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel JDK
id: build
env:
ARCH: ${{ steps.arch.outputs.ARCH }}
run: |
export JAVA_HOME=${MAC_JAVA_HOME}
${MAC_JAVA_HOME}/bin/java -ea build.java --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tar.gz
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export ARCHIVE_NAME="mandrel-java21-darwin-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java21-darwin-amd64.tar.gz
export ARCH=$( echo ${ARCH} | sed 's/x64/amd64/' )
export ARCHIVE_NAME="mandrel-java21-darwin-${ARCH}-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java21-darwin-${ARCH}.tar.gz
echo "ARCH=${ARCH}" >> "$GITHUB_OUTPUT"
- name: Smoke tests
run: |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
Expand Down Expand Up @@ -226,9 +255,11 @@ jobs:
diff java.txt native.txt
- name: Upload Mandrel build
uses: actions/upload-artifact@v3
env:
ARCH: ${{ steps.build.outputs.ARCH }}
with:
name: mandrel-java21-darwin-amd64-test-build
path: mandrel-java21-darwin-amd64.tar.gz
name: mandrel-java21-darwin-${ARCH}-test-build
path: mandrel-java21-darwin-${ARCH}.tar.gz

build-and-test-on-windows:
name: Windows Build and test ${{ matrix.mandrel-ref }} branch/tag
Expand Down Expand Up @@ -274,6 +305,11 @@ jobs:
Move-Item -Path "$Env:temp\jdk-*\lib\static" -Destination $Env:JAVA_HOME\lib\
Remove-Item -Recurse "$Env:temp\jdk-*"
& $Env:JAVA_HOME\bin\java -version
- name: Use python 3.10
# The minimum supported version is 3.9 see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Expand Down Expand Up @@ -393,6 +429,11 @@ jobs:
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1
echo ${JAVA_HOME}
${JAVA_HOME}/bin/java --version
- name: Use python 3.10
# The minimum supported version is 3.9 see https://github.com/graalvm/mx/issues/249
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build Mandrel JDK
run: |
# Build the Java bits
Expand Down
23 changes: 18 additions & 5 deletions build.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
Expand Down Expand Up @@ -39,6 +36,9 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

public class build
{
static final Logger logger = LogManager.getLogger(build.class);
Expand Down Expand Up @@ -353,8 +353,21 @@ else if (archiveName.endsWith("zip") && !IS_WINDOWS)

private static String getMandrelVersion(FileSystem fs, OperatingSystem os, Path mandrelRepo)
{
String mandrelVersion = os.exec(Mx.mandrelVersion(fs.mxHome(), fs.mandrelRepo()), true).get(0);

final Pattern startsWithNumber = Pattern.compile("^\\d.*");
String mandrelVersion = null;
final List<String> o = os.exec(Mx.mandrelVersion(fs.mxHome(), fs.mandrelRepo()), true);
for (String s : o)
{
logger.info("mx's graalvm-version output: " + s);
if (mandrelVersion == null && startsWithNumber.matcher(s).matches())
{
mandrelVersion = s;
}
}
if (mandrelVersion == null)
{
throw new RuntimeException("Could not determine Mandrel version from mx graalvm-version output");
}
if (mandrelVersion.endsWith("-dev"))
{
final Tasks.Exec command = Tasks.Exec.of(Arrays.asList("git", "rev-parse", "--short", "HEAD"), mandrelRepo);
Expand Down
Loading