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

Substrate changes to support Windows native build (vmone for Windows) #1288

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
32 changes: 16 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Substrate Build
on:
push:
branches:
- master
- '*'
pull_request:
branches:
- master
Expand All @@ -14,14 +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"
- os: windows-latest
ARCH: "x86_64"
steps:
- name: Install packages (Linux)
if: runner.os == 'Linux'
Expand Down Expand Up @@ -83,16 +83,16 @@ jobs:
- name: Build project
run: ./gradlew -i build -x test

- name: Deploy Snapshot
if: runner.os == 'Linux' && github.ref == 'refs/heads/master'
run: ./gradlew publish -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# - name: Deploy Snapshot
# if: runner.os == 'Linux' && github.ref == 'refs/heads/master'
# run: ./gradlew publish -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD
# env:
# SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
# SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

- name: Draft release
if: runner.os == 'Linux' && github.ref == 'refs/heads/master'
# Drafts your next Release notes as Pull Requests are merged into "master"
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Draft release
# if: runner.os == 'Linux' && github.ref == 'refs/heads/master'
# # Drafts your next Release notes as Pull Requests are merged into "master"
# uses: release-drafter/release-drafter@v5
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
200 changes: 100 additions & 100 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,100 +1,100 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
103 changes: 103 additions & 0 deletions run-tests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
@echo off

rem Removing 'out' directory
rmdir /S /Q out

set JAVAFX_PLATFORM=win
set JAVAFX_VERSION=13.0.1

set JAVAFX_STATIC_PLATFORM=win-x86_64
set JAVAFX_STATIC_VERSION=14-ea+gvm1

echo Downloading JavaFX %JAVAFX_VERSION%-%JAVAFX_PLATFORM% jars...
mkdir libs\javafx
for %%j in (base controls graphics) do (
if not exist libs\javafx\javafx-%%j-%JAVAFX_VERSION%-%JAVAFX_PLATFORM%.jar (
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=org.openjfx:javafx-%%j:%JAVAFX_VERSION%:jar:%JAVAFX_PLATFORM%
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy -Dartifact=org.openjfx:javafx-%%j:%JAVAFX_VERSION%:jar:%JAVAFX_PLATFORM% -DoutputDirectory=libs\javafx
)
)
echo Downloading JavaFX jars completed!

echo Downloading JavaFX static SDK %JAVAFX_STATIC_VERSION%-%JAVAFX_STATIC_PLATFORM%...
mkdir libs\javafxstatic
if not exist libs\javafxstatic\openjfx-%JAVAFX_STATIC_VERSION%-%JAVAFX_STATIC_PLATFORM%-static.zip (
powershell -Command "Invoke-WebRequest -OutFile libs\javafxstatic\openjfx-%JAVAFX_STATIC_VERSION%-%JAVAFX_STATIC_PLATFORM%-static.zip https://download2.gluonhq.com/substrate/javafxstaticsdk/openjfx-%JAVAFX_STATIC_VERSION%-%JAVAFX_STATIC_PLATFORM%-static.zip"
tar -xf libs\javafxstatic\openjfx-%JAVAFX_STATIC_VERSION%-%JAVAFX_STATIC_PLATFORM%-static.zip -C libs\javafxstatic
)
echo Downloading JavaFX static SDK completed!

echo Downloading substrate dependencies...
mkdir libs\substrate
if not exist libs\substrate\dd-plist-1.22.jar (
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=com.googlecode.plist:dd-plist:1.22
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy -Dartifact=com.googlecode.plist:dd-plist:1.22 -DoutputDirectory=libs\substrate
)
if not exist libs\substrate\jnr-ffi-2.1.11.jar (
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=com.github.jnr:jnr-ffi:2.1.11
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy -Dartifact=com.github.jnr:jnr-ffi:2.1.11 -DoutputDirectory=libs\substrate
)
if not exist libs\substrate\bcpkix-jdk15on-1.49.jar (
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=org.bouncycastle:bcpkix-jdk15on:1.49
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy -Dartifact=org.bouncycastle:bcpkix-jdk15on:1.49 -DoutputDirectory=libs\substrate
)
if not exist libs\substrate\bcprov-jdk15on-1.49.jar (
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get -Dartifact=org.bouncycastle:bcprov-jdk15on:1.49
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy -Dartifact=org.bouncycastle:bcprov-jdk15on:1.49 -DoutputDirectory=libs\substrate
)
echo Downloading substrate dependencies completed!

echo Compiling substrate...
set SUBSTRATE_SOURCES=
for /r %%f in (src\main\java\*.java) do (
set SUBSTRATE_SOURCES=!SUBSTRATE_SOURCES! %%f
)

set SUBSTRATE_MODULE_PATH=
for /r %%f in (libs\substrate\*.jar) do (
if "%SUBSTRATE_MODULE_PATH%"=="" (
set SUBSTRATE_MODULE_PATH=%%f
) else (
set SUBSTRATE_MODULE_PATH=%%f;%SUBSTRATE_MODULE_PATH%
)
)
javac -source 11 -target 11 -d out\substrate -g -proc:none -XDuseUnsharedTable=true --module-path %SUBSTRATE_MODULE_PATH% %SUBSTRATE_SOURCES%
echo Substrate compilation done!

echo Compiling test HelloWorld...
set TEST_HELLOWORLD_SOURCES=
for /r %%f in (test-project\helloWorld\src\main\java\*.java) do (
set TEST_HELLOWORLD_SOURCES=!TEST_HELLOWORLD_SOURCES! %%f
)
javac -source 11 -target 11 -d out\helloWorld -g -proc:none -XDuseUnsharedTable=true %TEST_HELLOWORLD_SOURCES%
echo Test HelloWorld compilation done!

echo Running test HelloWorld...
java -classpath %SUBSTRATE_MODULE_PATH%;out\substrate;src\main\resources ^
-Dimagecp="%cd%\out\helloWorld" ^
-Dgraalvm=%GRAALVM_HOME% ^
-Dmainclass=com.gluonhq.substrate.test.Main ^
com.gluonhq.substrate.SubstrateDispatcher
echo Test HelloWorld completed

echo Compiling test HelloFX...
set TEST_HELLOFX_SOURCES=
for /r %%f in (test-project\helloFX\src\main\java\*.java) do (
set TEST_HELLOFX_SOURCES=!TEST_HELLOFX_SOURCES! %%f
)
set TEST_HELLOFX_MODULE_PATH=
for /r %%f in (libs\javafx\*.jar) do (
set TEST_HELLOFX_MODULE_PATH=!cd!\%%f;%TEST_HELLOFX_MODULE_PATH%
)
javac -source 11 -target 11 -d out\helloFX -g -proc:none -XDuseUnsharedTable=true --module-path %TEST_HELLOFX_MODULE_PATH% --add-modules javafx.controls %TEST_HELLOFX_SOURCES%
echo Test HelloFX compilation done!

echo Running test HelloFX...
java -classpath %SUBSTRATE_MODULE_PATH%;out\substrate;src\main\resources ^
-Dimagecp="%cd%\out\helloFX;%TEST_HELLOFX_MODULE_PATH%" ^
-Dgraalvm=%GRAALVM_HOME% ^
-Dmainclass=com.gluonhq.substrate.test.Main ^
-Djavafxsdk=libs\javafxstatic\sdk ^
-Dprism.sw=true ^
com.gluonhq.substrate.SubstrateDispatcher
echo Test HelloFX completed
2 changes: 1 addition & 1 deletion src/main/java/com/gluonhq/substrate/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static VMONE_TARGET fromTriplet(String triplet) {
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 = "24-2";
public static final String DEFAULT_JAVA_STATIC_SDK_VERSION = "24-4";
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";
Expand Down
Loading