Skip to content

Commit

Permalink
Update Substrate to use latest GraalVM (JDK 23) and JavaFX 24-ea (#1273)
Browse files Browse the repository at this point in the history
* Update targets for JavaFX 24-ea, remove clibs, update cap cache files

* fix for linux

* fix font issue on Android

* fix for dependencies setup

* unneeded property

* bump javafx static version

* fix android property

* Changes for static libs

* Add support for vmone downloads

* copy libs

* Use JDK21 and disable windows runner for now

* set java23

* change run API to get all logs

* Process feedback

* check status code

* fixes for staticlib
  • Loading branch information
jperedadnr authored Sep 6, 2024
1 parent 0004727 commit f93489a
Show file tree
Hide file tree
Showing 49 changed files with 445 additions and 868 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest] # windows-latest]
include:
- os: ubuntu-latest
ARCH: "x86_64"
- os: macos-latest
ARCH: "aarch64"
# - os: windows-latest
# ARCH: "x86_64"
steps:
- name: Install packages (Linux)
if: runner.os == 'Linux'
Expand All @@ -34,6 +41,9 @@ jobs:

- name: Setup Gluon's GraalVM
uses: gluonhq/setup-graalvm@master
with:
jdk: 'java23'
arch: ${{ matrix.ARCH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -44,10 +54,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java 11
uses: actions/setup-java@v1
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
fetch-depth: 5
persist-credentials: false

- name: Setup Java 11
uses: actions/setup-java@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
43 changes: 33 additions & 10 deletions src/main/java/com/gluonhq/substrate/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
package com.gluonhq.substrate;

import java.nio.file.Path;
import java.util.Locale;

public class Constants {

Expand Down Expand Up @@ -73,7 +74,34 @@ public enum Profile {
IOS_SIM, // (x86_64-apple-ios)
ANDROID, // (aarch64-linux-android);
WEB // (x86_64-web-web)
};
}

public enum VMONE_TARGET {
X86_64_LINUX_LINUX("linux-x64"),
AARCH64_LINUX_LINUX("linux-aarch64"),
X86_64_APPLE_DARWIN("macos-x64"),
AARCH64_APPLE_DARWIN("macos-aarch64"),
X86_64_MICROSOFT_WINDOWS("windows-x64"),
AARCH64_MICROSOFT_WINDOWS("windows-aarch64"),
ARM64_APPLE_IOS("ios-macos-aarch64"),
X86_64_APPLE_IOS("ios-macos-x64"),
AARCH64_LINUX_ANDROID("android-linux-aarch64"),
X86_64_WEB_WEB("no-op");

private final String target;

VMONE_TARGET(String target) {
this.target = target;
}

public String getTarget() {
return target;
}

public static VMONE_TARGET fromTriplet(String triplet) {
return valueOf(triplet.toUpperCase(Locale.ROOT).replaceAll("-", "_"));
}
}

/**
* Supported hosts
Expand Down Expand Up @@ -106,20 +134,16 @@ public enum Profile {
public static final String PROFILE_LINUX_AARCH64 = "linux-aarch64";
public static final String PROFILE_WEB = "web";

public static final String DEFAULT_JAVA_STATIC_SDK_VERSION = "18-ea+prep18-9";
public static final String DEFAULT_JAVA_STATIC_SDK_VERSION11 = "11-ea+10";
public static final String DEFAULT_JAVAFX_STATIC_SDK_VERSION = "21-ea+11.2";
public static final String DEFAULT_JAVA_STATIC_SDK_VERSION = "24-1";
public static final String DEFAULT_JAVAFX_STATIC_SDK_VERSION = "24-ea+7.1";
public static final String DEFAULT_JAVAFX_JS_SDK_VERSION = "18-internal+0-2021-09-02-165800";
public static final String DEFAULT_SYSROOT_VERSION = "20210424";
public static final String DEFAULT_CLIBS_VERSION = "27";
public static final String DEFAULT_JAVASDK_PATH = "staticjdk";
public static final String DEFAULT_JAVASDK_PATH11 = "labs-staticjdk";

/**
* Supported GraalVM versions
*/
public static final String GRAALVM_MIN_VERSION = "22.1";
public static final String GRAALVM_JAVA_MIN_VERSION = "11.0";
public static final String GRAALVM_MIN_VERSION = "23";
public static final String GRAALVM_JAVA_MIN_VERSION = "21.0";

/**
* Paths
Expand Down Expand Up @@ -191,7 +215,6 @@ public enum Profile {
public static final String RESOURCE_ARCH_FILE = "resourceconfig-${archOs}.json";

public static final String JNI_JAVA_FILE = "jniconfig-java.json";
public static final String JNI_JAVA_FILE11 = "jniconfig-java11.json";
public static final String JNI_JAVAFXSW_FILE = "jniconfig-javafxsw.json";
public static final String JNI_ARCH_FILE = "jniconfig-${archOs}.json";

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/gluonhq/substrate/SubstrateDispatcher.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Gluon
* Copyright (c) 2019, 2024, Gluon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -326,11 +326,11 @@ private static void executeRunStep(SubstrateDispatcher dispatcher) {
if (expected != null) {
Logger.logInfo(logTitle("RUN TASK (with expected)"));

String response = dispatcher.targetConfiguration.run();
if (expected.equals(response)) {
List<String> responses = dispatcher.targetConfiguration.run();
if (responses.contains(expected)) {
Logger.logInfo("Run ended successfully, the output: " + expected + " matched the expected result.");
} else {
Logger.logSevere("Run failed, expected output: " + expected + ", output: " + response);
Logger.logSevere("Run failed, expected output: " + expected + ", output: " + responses);
System.exit(1);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Gluon
* Copyright (c) 2019, 2024, Gluon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -163,9 +163,7 @@ public Version getGraalVersion() {
*/
public String getJavaStaticSdkVersion() {
return Optional.ofNullable(publicConfig.getJavaStaticSdkVersion())
.orElse(usesJDK11() ?
Constants.DEFAULT_JAVA_STATIC_SDK_VERSION11 :
Constants.DEFAULT_JAVA_STATIC_SDK_VERSION);
.orElse(Constants.DEFAULT_JAVA_STATIC_SDK_VERSION);
}

/**
Expand Down Expand Up @@ -211,12 +209,11 @@ public Path getDefaultJavaStaticPath() {
return Constants.USER_SUBSTRATE_PATH
.resolve("javaStaticSdk")
.resolve(getJavaStaticSdkVersion())
.resolve(getTargetTriplet().getOsArch())
.resolve(usesJDK11() ? Constants.DEFAULT_JAVASDK_PATH11 : Constants.DEFAULT_JAVASDK_PATH);
.resolve(getTargetTriplet().getOsArch());
}

private Path getDefaultJavaStaticLibsPath() {
return getDefaultJavaStaticPath().resolve("lib").resolve("static");
return getDefaultJavaStaticPath().resolve("lib");
}

/**
Expand Down
30 changes: 1 addition & 29 deletions src/main/java/com/gluonhq/substrate/model/Triplet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Gluon
* Copyright (c) 2019, 2024, Gluon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -218,34 +218,6 @@ public String getOsArch2() {
return this.os+"-"+myarch;
}

/**
*
* On iOS/iOS-sim, Android and Linux-AArch64, it returns a string
* with a valid version for clibs, for other OSes returns an empty string
* @return
*/
public String getClibsVersion() {
if (OS_IOS.equals(getOs()) || OS_ANDROID.equals(getOs()) ||
(OS_LINUX.equals(getOs()) && ARCH_AARCH64.equals(getArch()))) {
return "-ea+" + Constants.DEFAULT_CLIBS_VERSION;
}
return "";
}
/**
*
* On iOS/iOS-sim, Android and Linux-AArch64, it returns a string
* with a valid path for clibs, for other OSes returns an empty string
*
* @return
*/
public String getClibsVersionPath() {
if (OS_IOS.equals(getOs()) || OS_ANDROID.equals(getOs()) ||
(OS_LINUX.equals(getOs()) && ARCH_AARCH64.equals(getArch()))) {
return Constants.DEFAULT_CLIBS_VERSION;
}
return "";
}

@Override
public String toString() {
return arch + '-' + vendor + '-' + os;
Expand Down
Loading

0 comments on commit f93489a

Please sign in to comment.