diff --git a/build.gradle b/build.gradle index eadfcf82..c6351ba8 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ buildscript { plugins { id 'java' + id 'org.beryx.runtime' version '1.11.2' } group 'games.rednblack' @@ -45,10 +46,11 @@ task packTextures { } } -project.ext.mainClassName = "games.rednblack.editor.Main" +mainClassName = "games.rednblack.editor.Main" project.ext.assetsDir = new File("assets/"); +def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT) -task run(dependsOn: classes, type: JavaExec) { +task runHyperLap2D(dependsOn: classes, type: JavaExec) { main = project.mainClassName classpath = sourceSets.main.runtimeClasspath standardInput = System.in @@ -65,8 +67,13 @@ task dist(type: Jar) { manifest { attributes 'Main-Class': project.mainClassName } + + destinationDirectory = file("$buildDir/lib") } +jpackageImage.dependsOn dist +jpackage.dependsOn dist + dependencies { implementation "com.badlogicgames.gdx:gdx:$gdxVersion" implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" @@ -96,3 +103,31 @@ dependencies { testImplementation group: 'junit', name: 'junit', version: '4.12' } + +runtime { + javaHome.set(System.getProperty("java.home")) + options = ['--strip-debug', + '--compress', '2', + '--no-header-files', + '--no-man-pages', + '--strip-native-commands', + '--vm', 'server'] + modules = ['java.base', + 'java.desktop', + 'jdk.unsupported'] + distDir = file(buildDir) + + jpackage { + mainJar = dist.archiveFileName.get() + if (osName.contains('windows')) { + imageOptions = ["--icon", file("icons/icon.ico")] + installerType = 'msi' + } else if (osName.contains('linux')) { + imageOptions = ["--icon", file("icons/icon.png")] + installerType = 'deb' + } else if (osName.contains('mac')) { + imageOptions = ["--icon", file("icons/icon.icns")] + installerType = 'dmg' + } + } +} \ No newline at end of file diff --git a/icons/icon.ico b/icons/icon.ico new file mode 100644 index 00000000..8fe4c915 Binary files /dev/null and b/icons/icon.ico differ diff --git a/icons/icon.png b/icons/icon.png new file mode 100644 index 00000000..ff85f7d2 Binary files /dev/null and b/icons/icon.png differ diff --git a/plugin-9patch/build.gradle b/plugin-9patch/build.gradle index 15c2b922..8ec7eca5 100644 --- a/plugin-9patch/build.gradle +++ b/plugin-9patch/build.gradle @@ -26,4 +26,6 @@ dependencies { task dist(type: Jar) { from files(sourceSets.main.output.classesDirs) from files(sourceSets.main.output.resourcesDir) + + destinationDirectory = file("../build/lib/plugins") } \ No newline at end of file diff --git a/plugin-performance/build.gradle b/plugin-performance/build.gradle index 15c2b922..8ec7eca5 100644 --- a/plugin-performance/build.gradle +++ b/plugin-performance/build.gradle @@ -26,4 +26,6 @@ dependencies { task dist(type: Jar) { from files(sourceSets.main.output.classesDirs) from files(sourceSets.main.output.resourcesDir) + + destinationDirectory = file("../build/lib/plugins") } \ No newline at end of file diff --git a/plugin-skin-composer/build.gradle b/plugin-skin-composer/build.gradle index cc159238..7ae0818c 100644 --- a/plugin-skin-composer/build.gradle +++ b/plugin-skin-composer/build.gradle @@ -28,4 +28,6 @@ dependencies { task dist(type: Jar) { from files(sourceSets.main.output.classesDirs) from files(sourceSets.main.output.resourcesDir) + + destinationDirectory = file("../build/lib/plugins") } \ No newline at end of file diff --git a/plugin-tiled/build.gradle b/plugin-tiled/build.gradle index 39a38e3f..a6cad1d0 100644 --- a/plugin-tiled/build.gradle +++ b/plugin-tiled/build.gradle @@ -40,5 +40,7 @@ project.ext.assetsDir = new File("assets/pack"); task dist(type: Jar) { from files(sourceSets.main.output.classesDirs) from files(sourceSets.main.output.resourcesDir) - from files(project.assetsDir); + from files(project.assetsDir) + + destinationDirectory = file("../build/lib/plugins") } \ No newline at end of file