diff --git a/build.gradle b/build.gradle index 2d7ffd5cd4..d16963fe99 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ def javaHome = System.getProperty('java.home') def vmVersion = "0.3.2" def dirRuntimeJars = 'jars' // we'll store mod and lib stuff in here + allprojects { apply plugin: 'java' @@ -251,11 +252,14 @@ build { task prePack(type:Exec) { dependsOn ':aion_api:cleanPack' dependsOn ':aion_api:build' - if (project.hasProperty('noGui')) { - environment "noGui", "true" + + if(findProject(":modGui") != null && gradle.useGui) { + dependsOn ':modGui:setupAionRootProject'; + environment "useGui", "true" } commandLine 'bash', 'script/prepack.sh' } + task postPack(type:Exec) { commandLine 'sh', 'script/postpack.sh' } /** Replaces `ant pack_build` */ @@ -277,9 +281,6 @@ task pack(type: Tar) { into('/aion/') { from dirWorkspace include 'aion.sh' - if (!project.hasProperty('noGui')) { - include 'aion_gui.sh' - } } into('/aion/native') { from dirNative diff --git a/gradle.properties b/gradle.properties index 50611691d0..a696b84724 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,3 +2,6 @@ org.gradle.java.home=/usr/lib/jvm/jdk-11.0.1 org.gradle.daemon=true org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=4g -XX:ReservedCodeCacheSize=1024m org.gradle.parallel=false + +# Uncomment to include modGui in build +# modGuiPath=modGui diff --git a/aion_gui.sh b/modGui/aion_gui.sh similarity index 100% rename from aion_gui.sh rename to modGui/aion_gui.sh diff --git a/modGui/build.gradle b/modGui/build.gradle index ef3b936834..f3e69acff6 100644 --- a/modGui/build.gradle +++ b/modGui/build.gradle @@ -1,4 +1,3 @@ - ext.moduleName = 'aion.gui' test.dependsOn copyNativeLibsForModuleTests clean.dependsOn deleteNativeLibs @@ -15,6 +14,7 @@ buildscript { apply plugin: 'com.google.osdetector' ext.platform = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os +apply plugin: "de.undercouch.download" //version: '3.4.3' sourceSets { main { @@ -30,7 +30,6 @@ sourceSets { } dependencies { - compile project(':modLogger') compile project(':modMcf') compile project(':modAionImpl') @@ -75,3 +74,36 @@ integTest { systemProperty "prism.order", "sw" systemProperty "prism.text", "t2k" } + +task fetchJavaFxRuntime(type: Download) { + onlyIfModified + overwrite false + src "http://gluonhq.com/download/javafx-11-jmods-linux" + dest "${buildDir}/jfx/openjfx-11_linux-x64_bin-jmods.zip" +} + +task unzipJavaFxRuntime(type: Copy) { + dependsOn fetchJavaFxRuntime + + def outDir = file("${buildDir}/pack"); + from zipTree(fetchJavaFxRuntime.dest) + into outDir + + rootProject.tasks['prePack'].configure { + def jfxOutputDir = '/javafx-jmods-11' // the dir that Zip file is expected to extract to + environment "JAVAFX_PATH", outDir.canonicalPath + jfxOutputDir + environment "JAVAFX_MODULES", + "javafx.graphics,javafx.controls,javafx.base,javafx.fxml,javafx.swing" + } +} + +task copyShellScripts(type: Copy) { + def aionGuiSh = file("aion_gui.sh"); + rootProject.tasks['pack'].configure { + from aionGuiSh into('/aion/') + } +} + +task setupAionRootProject { + dependsOn unzipJavaFxRuntime, copyShellScripts +} diff --git a/script/prepack.sh b/script/prepack.sh index b5bce569e2..c5bc3f872f 100755 --- a/script/prepack.sh +++ b/script/prepack.sh @@ -10,8 +10,8 @@ API_PATH="${PACK_PATH}/clientAPI" SCRIPT_PATH="${PACK_PATH}/script" JDK_VER="11.0.1" JDK_TYPE="openjdk" -JAVAFX_PATH="${PACK_PATH}/javafx" -JAVAFX_VER="javafx-jmods-11" +#JAVAFX_PATH="${PACK_PATH}/javafx" +#JAVAFX_VER="javafx-jmods-11" DEFAULT_NETWORK="mainnet" if [ ! -d "$PACK_PATH" ]; then @@ -25,19 +25,12 @@ if [ ! -d "$JDK_PATH" ]; then mv "${PACK_PATH}/jdk-${JDK_VER}" $JDK_PATH fi -# download javafx if can't find the javafx env -if [ "$noGui" != "true" ] && [ ! -d "$JAVAFX_PATH" ]; then - wget -c http://gluonhq.com/download/javafx-11-jmods-linux -O openjfx-11_linux-x64_bin-jmods.zip - unzip openjfx-11_linux-x64_bin-jmods.zip -d $PACK_PATH - mv "${PACK_PATH}/${JAVAFX_VER}" $JAVAFX_PATH -fi - module_path=$JDK_PATH/jmods add_modules="java.base,java.xml,java.logging,java.management,jdk.unsupported,jdk.sctp" # generate aion runtime -if [ "$noGui" != "true" ]; then +if [ "$useGui" = "true" ]; then module_path="$module_path:$JAVAFX_PATH" - add_modules="$add_modules,javafx.graphics,javafx.controls,javafx.base,javafx.fxml,javafx.swing" + add_modules="$add_modules,$JAVAFX_MODULES" fi if [ ! -d "$JDK_RT" ]; then $JDK_PATH/bin/jlink --module-path $module_path --add-modules $add_modules \ diff --git a/settings.gradle b/settings.gradle index 0612932970..a4187dd8c6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,10 +15,15 @@ include 'modAionBase', 'modAion', 'modAionImpl', 'aion_api', 'modBoot' -if (!hasProperty('noGui')) { - include 'modGui' -} - project(":aion_fastvm/modFastVM").name = "aion_fastvm" +// only build and distribute modGui only if explicitly specified +if (hasProperty('modGuiPath') && !modGuiPath.empty) { + include modGuiPath + project(':' + modGuiPath).name = "modGui" + gradle.ext.useGui = true; +} else { + gradle.ext.useGui = false; +} +