diff --git a/.gitignore b/.gitignore
index 76c56349a..9e6e14aaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,7 +49,7 @@ certum.jks
/src/main/resources/org/terasology/launcher/icons/
# Ignore version info file(s)
-src/main/resources/org/terasology/launcher/version/
+/src/main/resources/org/terasology/launcher/version/
# Ignore generated Web API sources
web-api-client/
diff --git a/build.gradle b/build.gradle
index 83d54d2e9..f86ef4e4e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,8 +46,6 @@ plugins {
}
apply from: "./config/gradle/jre.gradle"
-// TODO salvage useful bits and remove this
-//apply from: "./config/gradle/bundles.gradle"
apply from: "./config/gradle/quality.gradle"
apply from: "./config/gradle/swagger.gradle"
@@ -164,6 +162,8 @@ task createVersionInfoFile {
processResources.dependsOn createVersionInfoFile
jar {
+ //TODO we only use this name because the `.exe` start scripts require the JAR to be named 'TerasologyLauncher.jar'
+ jar.archiveFileName = "${project.name}.jar"
// replace development "logback.xml" with productive "logback_jar.xml"
exclude "logback.xml"
rename('logback_jar.xml', 'logback.xml')
diff --git a/buildres/linux/TerasologyLauncher.run b/buildres/linux/TerasologyLauncher.run
new file mode 100755
index 000000000..472d3c6a6
--- /dev/null
+++ b/buildres/linux/TerasologyLauncher.run
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+echo "Starting TerasologyLauncher from './bin/TerasologyLauncher'"
+sh ./bin/TerasologyLauncher
diff --git a/bundles/macosx/Info.plist b/buildres/mac/Info.plist
similarity index 88%
rename from bundles/macosx/Info.plist
rename to buildres/mac/Info.plist
index 40255db5f..0360450ef 100644
--- a/bundles/macosx/Info.plist
+++ b/buildres/mac/Info.plist
@@ -5,7 +5,7 @@
CFBundleDisplayName
Terasology
CFBundleExecutable
- terasologylauncher.command
+ TerasologyLauncher
CFBundleIconFile
terasology.icns
diff --git a/bundles/macosx/Resources/terasology.icns b/buildres/mac/Resources/terasology.icns
similarity index 100%
rename from bundles/macosx/Resources/terasology.icns
rename to buildres/mac/Resources/terasology.icns
diff --git a/src/dist/TerasologyLauncher.x86.exe b/buildres/windows32/TerasologyLauncher.x86.exe
similarity index 100%
rename from src/dist/TerasologyLauncher.x86.exe
rename to buildres/windows32/TerasologyLauncher.x86.exe
diff --git a/src/dist/TerasologyLauncher.x64.exe b/buildres/windows64/TerasologyLauncher.x64.exe
similarity index 100%
rename from src/dist/TerasologyLauncher.x64.exe
rename to buildres/windows64/TerasologyLauncher.x64.exe
diff --git a/bundles/linux/run_linux.sh b/bundles/linux/run_linux.sh
deleted file mode 100644
index 1bf7c2eb0..000000000
--- a/bundles/linux/run_linux.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-cd "$(dirname "$0")"
-jre/bin/java -Xms128m -Xmx512m -jar lib/TerasologyLauncher.jar
-
diff --git a/bundles/macosx/MacOS/terasologylauncher.command b/bundles/macosx/MacOS/terasologylauncher.command
deleted file mode 100644
index 16b271db0..000000000
--- a/bundles/macosx/MacOS/terasologylauncher.command
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-cd "$(dirname "$0")/../Resources/"
-jre/bin/java -Xms128m -Xmx512m -jar lib/TerasologyLauncher.jar
diff --git a/config/gradle/bundles.gradle b/config/gradle/bundles.gradle
deleted file mode 100644
index 2686c0517..000000000
--- a/config/gradle/bundles.gradle
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2016 MovingBlocks
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-enum Bundle {
- win32,
- win64,
- linux32,
- linux64,
- macosx;
-
- File jreArchive
-}
-
-task buildBundles {}
-
-task unzipBundle(type: Copy) {
- destinationDir buildDir
- from (zipTree("${projectDir}/build/distributions/TerasologyLauncher.zip"))
-}
-
-def launcherDir = "${buildDir}/TerasologyLauncher/"
-
-Bundle.each { arch ->
- arch.jreArchive = new File("${projectDir}/jres/${arch}.zip")
-
- def zipBase = ""
- // Rebase everything in the zip file for MacOS X
- if (arch == Bundle.macosx) {
- zipBase = "TerasologyLauncher.app/Contents/Resources/"
- }
-
- def buildBundleTask = task("zip" + arch.name().capitalize(), type: Zip) {
- dependsOn unzipBundle
- archiveName "TerasologyLauncher-${arch}.zip"
- destinationDir new File("${buildDir}/bundles/")
- from(zipTree(arch.jreArchive)) {
- into "${zipBase}jre"
- }
- from(launcherDir) {
- // Platform independent files
- exclude "*.exe"
- exclude "bin"
- into zipBase
- }
- /*
- Copy only the files relevant to the platform we are bundling the JRE for.
- I.e only copy 32-bit natives for windows if we bundle the 32-bit JRE.
- */
- if (arch == Bundle.win32) {
- from (launcherDir) {
- include "TerasologyLauncher.x86.exe"
- rename { "TerasologyLauncher.exe" }
- }
- } else if (arch == Bundle.win64) {
- from (launcherDir) {
- include "TerasologyLauncher.x64.exe"
- rename { "TerasologyLauncher.exe" }
- }
- } else if (arch == Bundle.linux32) {
- from ("bundles/linux") {
- include "run_linux.sh"
- rename { "terasology_launcher.sh" }
- fileMode 755
- }
- } else if (arch == Bundle.linux64) {
- from ("bundles/launchers") {
- include "run_linux.sh"
- rename { "terasology_launcher.sh" }
- fileMode 755
- }
- } else if (arch == Bundle.macosx) {
- from ("bundles/macosx") {
- include "**/*"
- into "TerasologyLauncher.app/Contents"
- }
- }
- }
-
- buildBundles.dependsOn buildBundleTask
-}
diff --git a/config/gradle/jre.gradle b/config/gradle/jre.gradle
index 67d32ce1a..30d5a1736 100644
--- a/config/gradle/jre.gradle
+++ b/config/gradle/jre.gradle
@@ -16,7 +16,7 @@
// Uses Bellsoft Liberica JRE
def jreVersion = '8u212'
-def jreUrlBase = "https://download.bell-sw.com/java/$jreVersion/bellsoft-jre$jreVersion"
+def jreUrlBase = "https://download.bell-sw.com/java/${jreVersion}/bellsoft-jre${jreVersion}"
def jreUrlFilenames = [
Linux64 : 'linux-amd64.tar.gz',
Linux32 : 'linux-i586.tar.gz',
@@ -36,67 +36,81 @@ task createRelease() {
}
task downloadJreAll {
- group 'Download'
- description 'Downloads JRE for all platforms'
+ group 'JRE'
+ description 'Downloads JREs for all platforms'
+}
+
+task unpackJreAll {
+ group 'JRE'
+ description 'Unpack JREs for all platforms'
+}
+
+def unpack(file) {
+ copySpec {
+ from((file.name.endsWith(".zip")) ? zipTree(file) : tarTree(file) ) {
+ eachFile { fcd ->
+ fcd.relativePath = new RelativePath(
+ true, fcd.relativePath.segments.drop(1))
+ }
+ includeEmptyDirs = false
+ }
+ }
}
jreUrlFilenames.each { os, file ->
- def packedJre = new File("$projectDir/jre/$file")
- def unpackedJre = new File("$buildDir/jre/$os")
- def downloadTask = task("downloadJre$os") {
- group 'Download'
+ def downloadTask = task "downloadJre${os}"(type: Download) {
+ group 'JRE'
description "Downloads JRE for $os"
- doFirst {
- download {
- src "$jreUrlBase-$file"
- dest packedJre
- overwrite false
- }
- }
+ src "${jreUrlBase}-${file}"
+ dest "${projectDir}/jre/${file}"
+ overwrite false
+ }
- doLast {
- // Unpack the JRE
- if (!unpackedJre.exists()) {
- unpackedJre.mkdirs()
- copy {
- from(file.endsWith("zip")
- ? zipTree(packedJre)
- : tarTree(packedJre)) {
- eachFile { fcd ->
- fcd.relativePath = new RelativePath(
- true, fcd.relativePath.segments.drop(1))
- }
- includeEmptyDirs = false
- }
- into unpackedJre
- }
- }
- }
+ def unpackTask = task "unpackJre${os}"(type: Copy) {
+ group 'JRE'
+ description "Unpack JRE for ${os} to distribution sources"
+ dependsOn downloadTask
+
+ with unpack(downloadTask.dest)
+ into "${buildDir}/jre/${os}"
}
- def distName = os.toLowerCase()
distributions {
- "$distName" {
+ def distName = os.toLowerCase()
+ def distBase = distName.replaceAll("\\d", "") // drop '32' or '64'
+
+ "${distName}" {
contents {
with distributions.main.contents
+
into('jre') {
- from unpackedJre
+ from unpackTask
}
+
+ from("${projectDir}/buildres/${distBase}")
+ from("${projectDir}/buildres/${distName}")
}
}
}
- def zipTask = tasks.named("${distName}DistZip").get()
- def tarTask = tasks.named("${distName}DistTar").get()
-
downloadJreAll.dependsOn downloadTask
- zipTask.dependsOn downloadTask
- zipTask.description "Bundles the project with a JRE for $os"
- tarTask.dependsOn downloadTask
- tarTask.description "Bundles the project with a JRE for $os"
- createRelease.dependsOn zipTask
+ unpackJreAll.dependsOn unpackTask
+
+ createRelease.dependsOn "assemble${os}Dist"
+}
+
+distributions {
+ mac {
+ contents {
+ into 'TerasologyLauncher.app/Contents'
+ exclude '**/*.bat'
+ eachFile { details ->
+ details.path = details.path.toString().replaceAll("(Contents)/bin/(.+)", "\$1/MacOS/\$2")
+ }
+ }
+ }
}
/**
diff --git a/src/dist/TerasologyLauncher.exe b/src/dist/TerasologyLauncher.exe
deleted file mode 100644
index 5d40d8d1b..000000000
Binary files a/src/dist/TerasologyLauncher.exe and /dev/null differ