Added an experimental JDK wrapper

This commit is contained in:
493msi 2020-09-17 20:52:35 +02:00
parent b341e7cfa3
commit 504e1884fa
4 changed files with 152 additions and 12 deletions

4
.gitignore vendored
View File

@ -6,6 +6,7 @@
/.project
# Ignore IDEA project files
/.idea
/*/.idea
*.log
@ -16,4 +17,5 @@
.gradle
# Ignore Gradle build output directory
build
/build
/*/build

View File

@ -1,5 +1,15 @@
import org.gradle.internal.os.OperatingSystem
plugins {
id "me.filippov.gradle.jvm.wrapper" version "0.9.3"
}
jvmWrapper {
linuxJvmUrl = "https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz"
macJvmUrl = "https://corretto.aws/downloads/latest/amazon-corretto-11-x64-macos-jdk.tar.gz"
windowsJvmUrl = "https://corretto.aws/downloads/latest/amazon-corretto-11-x64-windows-jdk.zip"
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
@ -13,8 +23,15 @@ project.ext.isPrerelease = true
project.ext.prereleaseName = "alpha"
project.ext.prerealeaseUpdate = 2
allprojects {
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
project.ext.lwjglVersion = "3.2.3"
project.ext.jomlVersion = "1.9.25"
project.ext.steamworks4jVersion = "1.8.0"
project.ext.steamworks4jServerVersion = "1.8.0"
group = "cz.tefek"
version = isPrerelease ?
@ -30,16 +47,6 @@ allprojects {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
subprojects {
apply plugin: 'maven-publish'
project.ext.lwjglVersion = "3.2.3"
project.ext.jomlVersion = "1.9.25"
project.ext.steamworks4jVersion = "1.8.0"
project.ext.steamworks4jServerVersion = "1.8.0"
publishing {
publications {

70
gradlew vendored
View File

@ -83,6 +83,76 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# GRADLE JVM WRAPPER START MARKER
BUILD_DIR=$APP_HOME/build
if [ "$darwin" = "true" ]; then
JVM_TEMP_FILE=$BUILD_DIR/jvm-macosx-x64.tar.gz
JVM_URL=https://corretto.aws/downloads/latest/amazon-corretto-11-x64-macos-jdk.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/gradle-jvm/amazon-corretto-11-x64-macos-jdk-378f50
elif [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then
JVM_TEMP_FILE=$BUILD_DIR/jvm-windows-x64.zip
JVM_URL=https://d3pxv6yz143wms.cloudfront.net/11.0.4.11.1/amazon-corretto-11.0.4.11.1-windows-x64.zip
JVM_TARGET_DIR=$BUILD_DIR/amazon-corretto-11-x64-windows-jdk-f3b61a
else
JVM_TEMP_FILE=$BUILD_DIR/jvm-linux-x64.tar.gz
JVM_URL=https://corretto.aws/downloads/latest/amazon-corretto-11-x64-linux-jdk.tar.gz
JVM_TARGET_DIR=$BUILD_DIR/gradle-jvm/amazon-corretto-11-x64-linux-jdk-e264c4
fi
set -e
if [ -e "$JVM_TARGET_DIR/.flag" ] && [ -n "$(ls "$JVM_TARGET_DIR")" ] && [ "x$(cat "$JVM_TARGET_DIR/.flag")" = "x${JVM_URL}" ]; then
# Everything is up-to-date in $JVM_TARGET_DIR, do nothing
true
else
warn "Downloading $JVM_URL to $JVM_TEMP_FILE"
rm -f "$JVM_TEMP_FILE"
mkdir -p "$BUILD_DIR"
if command -v curl >/dev/null 2>&1; then
if [ -t 1 ]; then CURL_PROGRESS="--progress-bar"; else CURL_PROGRESS="--silent --show-error"; fi
# shellcheck disable=SC2086
curl $CURL_PROGRESS --output "${JVM_TEMP_FILE}" "$JVM_URL"
elif command -v wget >/dev/null 2>&1; then
if [ -t 1 ]; then WGET_PROGRESS=""; else WGET_PROGRESS="-nv"; fi
wget $WGET_PROGRESS -O "${JVM_TEMP_FILE}" "$JVM_URL"
else
die "ERROR: Please install wget or curl"
fi
warn "Extracting $JVM_TEMP_FILE to $JVM_TARGET_DIR"
rm -rf "$JVM_TARGET_DIR"
mkdir -p "$JVM_TARGET_DIR"
if [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then
unzip "$JVM_TEMP_FILE" -d "$JVM_TARGET_DIR"
else
tar -x -f "$JVM_TEMP_FILE" -C "$JVM_TARGET_DIR"
fi
rm -f "$JVM_TEMP_FILE"
echo "$JVM_URL" >"$JVM_TARGET_DIR/.flag"
fi
JAVA_HOME=
for d in "$JVM_TARGET_DIR" "$JVM_TARGET_DIR"/* "$JVM_TARGET_DIR"/Contents/Home "$JVM_TARGET_DIR"/*/Contents/Home; do
if [ -e "$d/bin/java" ]; then
JAVA_HOME="$d"
fi
done
if [ '!' -e "$JAVA_HOME/bin/java" ]; then
die "Unable to find bin/java under $JVM_TARGET_DIR"
fi
# Make it available for child processes
export JAVA_HOME
set +e
# GRADLE JVM WRAPPER END MARKER
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then

61
gradlew.bat vendored
View File

@ -35,6 +35,67 @@ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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 GRADLE JVM WRAPPER START MARKER
setlocal
set BUILD_DIR=%APP_HOME%build\
set JVM_TARGET_DIR=%BUILD_DIR%gradle-jvm\amazon-corretto-11-x64-windows-jdk-f3b61a\
set JVM_TEMP_FILE=jvm-windows-x64.zip
set JVM_URL=https://corretto.aws/downloads/latest/amazon-corretto-11-x64-windows-jdk.zip
set POWERSHELL=%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
if not exist "%JVM_TARGET_DIR%" MD "%JVM_TARGET_DIR%"
if not exist "%JVM_TARGET_DIR%.flag" goto downloadAndExtractJvm
set /p CURRENT_FLAG=<"%JVM_TARGET_DIR%.flag"
if "%CURRENT_FLAG%" == "%JVM_URL%" goto continueWithJvm
:downloadAndExtractJvm
CD "%BUILD_DIR%"
if errorlevel 1 goto fail
echo Downloading %JVM_URL% to %BUILD_DIR%%JVM_TEMP_FILE%
if exist "%JVM_TEMP_FILE%" DEL /F "%JVM_TEMP_FILE%"
"%POWERSHELL%" -nologo -noprofile -Command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; (New-Object Net.WebClient).DownloadFile('%JVM_URL%', '%JVM_TEMP_FILE%')"
if errorlevel 1 goto fail
RMDIR /S /Q "%JVM_TARGET_DIR%"
if errorlevel 1 goto fail
MKDIR "%JVM_TARGET_DIR%"
if errorlevel 1 goto fail
CD "%JVM_TARGET_DIR%"
if errorlevel 1 goto fail
echo Extracting %BUILD_DIR%%JVM_TEMP_FILE% to %JVM_TARGET_DIR%
"%POWERSHELL%" -nologo -noprofile -command "Set-StrictMode -Version 3.0; $ErrorActionPreference = \"Stop\"; Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('..\\..\\%JVM_TEMP_FILE%', '.');"
if errorlevel 1 goto fail
DEL /F "..\..\%JVM_TEMP_FILE%"
if errorlevel 1 goto fail
echo %JVM_URL%>"%JVM_TARGET_DIR%.flag"
if errorlevel 1 goto fail
:continueWithJvm
set JAVA_HOME=
for /d %%d in ("%JVM_TARGET_DIR%"*) do if exist "%%d\bin\java.exe" set JAVA_HOME=%%d
if not exist "%JAVA_HOME%\bin\java.exe" (
echo Unable to find java.exe under %JVM_TARGET_DIR%
goto fail
)
endlocal & set JAVA_HOME=%JAVA_HOME%
@rem GRADLE JVM WRAPPER END MARKER
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome