-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.gradle
103 lines (87 loc) · 3.08 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
import org.gradle.internal.os.OperatingSystem
/*
Aliases for shadowJar:
./gradlew shadowJar
./gradlew fatJar
Aliases for runShadow:
./gradlew runShadow -P cp=package.ClassName
./gradlew execute -P cp=package.ClassName
Run unit tests and generate docfx docs
./gradlew test
./gradlew generateApiDocs
*/
plugins {
id("application")
id("com.github.johnrengelman.shadow").version("7.1.0")
}
tasks.wrapper {
gradleVersion = "7.3.1"
distributionType = Wrapper.DistributionType.BIN
}
group = "com.GwgCommunity"
version = "1.0-SNAPSHOT"
sourceCompatibility = 11
targetCompatibility = 11
repositories { mavenCentral() }
ext.junitVersion = "4.13.2"
ext.lwjglVersion = "3.3.0"
ext.jomlVersion = "1.10.4"
/* ext.lwjglNatives */ switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
def osArch = System.getProperty("os.arch")
ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64")
? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}"
: "natives-linux"
break
case OperatingSystem.MAC_OS:
ext.lwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos"
break
case OperatingSystem.WINDOWS:
def osArch = System.getProperty("os.arch")
ext.lwjglNatives = osArch.contains("64")
? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
: "natives-windows-x86"
break
}
dependencies {
testImplementation("junit:junit:$junitVersion")
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
implementation("org.lwjgl:lwjgl")
implementation("org.lwjgl:lwjgl-glfw")
implementation("org.lwjgl:lwjgl-openal")
implementation("org.lwjgl:lwjgl-opengl")
implementation("org.lwjgl:lwjgl-stb")
runtimeOnly("org.lwjgl:lwjgl::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-glfw::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-openal::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-opengl::$lwjglNatives")
runtimeOnly("org.lwjgl:lwjgl-stb::$lwjglNatives")
implementation("org.joml:joml:$jomlVersion")
}
application {
if (!project.hasProperty("cp")) {
ext.cp = "scenes.TopDownDemo"
}
mainClass = "${cp}"
if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
applicationDefaultJvmArgs = ["-XstartOnFirstThread"]
}
}
test {
useJUnit()
testLogging.events("passed", "skipped", "failed")
}
tasks.register("generateApiDocs", Javadoc) {
it.title = ""
it.options.noTimestamp(false)
it.source(sourceSets.main.allJava)
it.classpath = configurations.runtimeClasspath
it.options.encoding("UTF-8")
it.destinationDir = file("build/generated-files")
it.options.addStringOption("doclet", "com.microsoft.doclet.DocFxDoclet")
it.options.docletpath = [file("lib/docfx-doclet-1.0-SNAPSHOT-jar-with-dependencies.jar")]
it.dependsOn(build)
}
// aliases
tasks.register("fatJar") { it.dependsOn(tasks.shadowJar) }
tasks.register("execute") { it.dependsOn(tasks.runShadow) }