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

Isolate modGui and its build logic #744

Merged
merged 1 commit into from
Dec 17, 2018
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
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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` */
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
36 changes: 34 additions & 2 deletions modGui/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

ext.moduleName = 'aion.gui'
test.dependsOn copyNativeLibsForModuleTests
clean.dependsOn deleteNativeLibs
Expand All @@ -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 {
Expand All @@ -30,7 +30,6 @@ sourceSets {
}

dependencies {

compile project(':modLogger')
compile project(':modMcf')
compile project(':modAionImpl')
Expand Down Expand Up @@ -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
}
15 changes: 4 additions & 11 deletions script/prepack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down
13 changes: 9 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}