-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
74 lines (61 loc) · 2.41 KB
/
build.gradle.kts
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
// Gradle script to build the snap-jolt project
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
application // to build JVM applications
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<JavaCompile>().all { // Java compile-time options:
options.compilerArgs.add("-Xdiags:verbose")
options.compilerArgs.add("-Xlint:unchecked")
options.encoding = "UTF-8"
options.setDeprecation(true) // to provide detailed deprecation warnings
}
// Register tasks to run specific applications:
tasks.register<JavaExec>("HelloWorld") {
description = "Runs the HelloWorld app."
mainClass = "com.github.stephengold.snapjolt.HelloWorld"
}
val os = DefaultNativePlatform.getCurrentOperatingSystem()
tasks.withType<JavaExec>().all { // Java runtime options:
classpath = sourceSets.main.get().getRuntimeClasspath()
enableAssertions = true
if (os.isMacOsX()) {
jvmArgs("-XstartOnFirstThread") // required for GLFW on macOS
}
}
application {
mainClass = "com.github.stephengold.snapjolt.HelloWorld"
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "seconds") // to disable caching of snapshots
}
val btf = "DebugSp"
dependencies {
implementation(libs.jolt.jni.linux64)
runtimeOnly(variantOf(libs.jolt.jni.linux64){ classifier(btf) })
runtimeOnly(variantOf(libs.jolt.jni.linuxarm32hf){ classifier(btf) })
runtimeOnly(variantOf(libs.jolt.jni.linuxarm64){ classifier(btf) })
runtimeOnly(variantOf(libs.jolt.jni.macosx64){ classifier(btf) })
runtimeOnly(variantOf(libs.jolt.jni.macosxarm64){ classifier(btf) })
runtimeOnly(variantOf(libs.jolt.jni.windows64){ classifier(btf) })
implementation(libs.jsnaploader)
}
// Register cleanup tasks:
tasks.named("clean") {
dependsOn("cleanDLLs", "cleanDyLibs", "cleanLogs", "cleanSOs")
}
tasks.register<Delete>("cleanDLLs") { // extracted Windows native libraries
delete(fileTree(".").matching{ include("*.dll") })
}
tasks.register<Delete>("cleanDyLibs") { // extracted macOS native libraries
delete(fileTree(".").matching{ include("*.dylib") })
}
tasks.register<Delete>("cleanLogs") { // JVM crash logs
delete(fileTree(".").matching{ include("hs_err_pid*.log") })
}
tasks.register<Delete>("cleanSOs") { // extracted Linux and Android native libraries
delete(fileTree(".").matching{ include("*.so") })
}