plugins { //TODO temporary, 2.0 should release proper soon id 'org.beryx.runtime' version '2.0.0-rc.1' } [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' java.sourceCompatibility = java.targetCompatibility = appJavaCompatibility ext.appMainClass = "com.shatteredpixel.shatteredpixeldungeon.desktop.DesktopLauncher" application.mainClass = appMainClass processResources { from new File(project(':core').projectDir, "/src/main/assets") from new File(project(':desktop').projectDir,"/src/main/assets") } def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT) tasks.register('debug', JavaExec) { classpath = sourceSets.main.runtimeClasspath ignoreExitValue = true mainClass = appMainClass systemProperty 'Specification-Title', appName systemProperty 'Implementation-Title', appPackageName systemProperty 'Specification-Version', appVersionName + "-INDEV" systemProperty 'Implementation-Version', appVersionCode if (osName.contains('mac')) { jvmArgs '-XstartOnFirstThread' } } tasks.register('release', Jar) { //FIXME this is now needed as of gradle 7.0, due to our weird sourceSets setup. Should see if there's a better way to do this setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) from sourceSets.main.output dependsOn configurations.runtimeClasspath from { configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) } } manifest { attributes 'Main-Class': appMainClass attributes 'Specification-Title': appName attributes 'Implementation-Title': appPackageName attributes 'Specification-Version': appVersionName attributes 'Implementation-Version': appVersionCode } } installDist.dependsOn release startScripts.dependsOn release jpackageImage.dependsOn release runtime { modules = ['java.base', 'java.desktop', 'jdk.unsupported', 'jdk.crypto.cryptoki', 'jdk.management'] options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages', '--strip-native-commands', '--vm', 'server'] jpackage { mainClass = appMainClass appVersion = (appVersionName =~ /\d+\.\d+\.\d+/)[0] imageName = appName } if (osName.contains('windows')) { //May work on Windows 7 (2009), but that's old enough that I'm only officially supporting Windows 10 (2015) targetPlatform("win") { jdkHome = jdkDownload("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_x64_windows_hotspot_17.0.16_8.zip") javaHome = file("./build/jdks/win/jdk-17.0.16+8").getAbsolutePath() jpackage { jpackageHome = file("./build/jdks/win/jdk-17.0.16+8") imageOptions = ["--icon", file("./src/main/assets/icons/windows.ico"), "--java-options", "-XX:+IgnoreUnrecognizedVMOptions"] } } } else if (osName.contains('linux')) { //May work on glibc 2.12 (2010), but that's old enough that I'm only officially supporting glibc 2.17 (2012) targetPlatform("linux") { jdkHome = jdkDownload("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.16_8.tar.gz") javaHome = file("./build/jdks/linux/jdk-17.0.16+8").getAbsolutePath() jpackage { jpackageHome = file("./build/jdks/linux/jdk-17.0.16+8") imageOptions = ["--icon", file("./src/main/assets/icons/icon_256.png"), "--java-options", "-XX:+IgnoreUnrecognizedVMOptions"] } } } else if (osName.contains('mac')) { //This JDK officially supports MacOS 12 (2021), but internals suggest support for 10.12 (2016) targetPlatform("mac") { jdkHome = jdkDownload("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_x64_mac_hotspot_17.0.16_8.tar.gz") javaHome = file("./build/jdks/mac/jdk-17.0.16+8/Contents/Home/").getAbsolutePath() jpackage { jpackageHome = file("./build/jdks/mac/jdk-17.0.16+8/Contents/Home/") imageOptions = ["--icon", file("./src/main/assets/icons/mac.icns"), "--java-options", "-XstartOnFirstThread", "--java-options", "-XX:+IgnoreUnrecognizedVMOptions", //append .apple because com.shatteredpixel.shatteredpixeldungeon was taken =( "--mac-package-identifier", appPackageName + ".apple"] } } } } dependencies { implementation project(':core') implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion" //we use LWJGL tinyFD directly to display crash messages implementation "org.lwjgl:lwjgl-tinyfd:3.3.3" implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows" implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-macos" implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-macos-arm64" implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-linux" implementation "org.lwjgl:lwjgl-tinyfd:3.3.3:natives-linux-arm64" implementation project(':services:updates:githubUpdates') implementation project(':services:news:shatteredNews') }