forked from 00-Evan/shattered-pixel-dungeon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
126 lines (110 loc) · 5.38 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
plugins {
id 'org.beryx.runtime' version '1.12.7'
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceCompatibility = targetCompatibility = appJavaCompatibility
ext.appMainClass = "com.shatteredpixel.shatteredpixeldungeon.desktop.DesktopLauncher"
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)
task debug(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
ignoreExitValue = true
main = appMainClass
systemProperty 'Specification-Title', appName
systemProperty 'Implementation-Title', appPackageName
systemProperty 'Specification-Version', appVersionName + "-INDEV"
systemProperty 'Implementation-Version', appVersionCode
if (osName.contains('mac')) {
jvmArgs '-XstartOnFirstThread'
}
}
task release(type: 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')) {
targetPlatform("win") {
jdkHome = jdkDownload("https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_x64_windows_hotspot_16.0.1_9.zip")
javaHome = file("./build/jdks/win/jdk-16.0.1+9").getAbsolutePath()
jpackage {
jpackageHome = file("./build/jdks/win/jdk-16.0.1+9")
imageOptions = ["--icon", file("./src/main/assets/icons/windows.ico"),
"--java-options", "-XX:+IgnoreUnrecognizedVMOptions"]
}
}
} else if (osName.contains('linux')) {
targetPlatform("linux") {
jdkHome = jdkDownload("https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_x64_linux_hotspot_16.0.1_9.tar.gz")
javaHome = file("./build/jdks/linux/jdk-16.0.1+9").getAbsolutePath()
jpackage {
jpackageHome = file("./build/jdks/linux/jdk-16.0.1+9")
imageOptions = ["--icon", file("./src/main/assets/icons/icon_256.png"),
"--java-options", "-XX:+IgnoreUnrecognizedVMOptions"]
}
}
} else if (osName.contains('mac')) {
targetPlatform("mac") {
jdkHome = jdkDownload("https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_x64_mac_hotspot_16.0.1_9.tar.gz")
javaHome = file("./build/jdks/mac/jdk-16.0.1+9/Contents/Home/").getAbsolutePath()
jpackage {
jpackageHome = file("./build/jdks/mac/jdk-16.0.1+9/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",
"--mac-package-name", "ShattererdPD"]
}
}
}
}
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:debugUpdates')
implementation project(':services:news:shatteredNews')
}