-
Notifications
You must be signed in to change notification settings - Fork 49
/
build.gradle.kts
97 lines (96 loc) · 3.1 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
plugins {
java
application
kotlin("jvm") version "1.9.22"
id("org.beryx.runtime") version "1.13.1" apply false
}
repositories {
mavenCentral()
}
subprojects {
apply(plugin = "java")
apply(plugin = "application")
apply(plugin = "kotlin")
group = "com.lightcrafts"
version = rootProject.file("lightcrafts/version.txt").readText().trim().substringBefore('~')
application {
applicationName = "LightZone"
applicationDefaultJvmArgs += listOf(
"--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED",
"-Xmx512m",
)
}
repositories {
maven(url = "https://maven.geotoolkit.org/")
mavenCentral()
}
dependencies {
annotationProcessor("org.jetbrains:annotations:24.0.1")
annotationProcessor("org.projectlombok:lombok:1.18.26")
compileOnly("org.jetbrains:annotations:24.0.1")
compileOnly("org.projectlombok:lombok:1.18.30")
implementation(files("${project.rootDir}/lightcrafts/lib/jai-lightzone-1.1.3.0.jar"))
testCompileOnly("org.jetbrains:annotations:24.0.1")
testImplementation(kotlin("test"))
testImplementation("io.kotest:kotest-runner-junit5:5.8.0")
testImplementation("org.assertj:assertj-core:3.11.1")
testImplementation(platform("org.junit:junit-bom:5.10.1"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.junit.jupiter:junit-jupiter-params")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
val os = System.getProperty("os.name").lowercase()
val MAKE = with(os) {
when {
startsWith("sun") -> "gmake"
endsWith("bsd") -> "gmake"
else -> "make"
}
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs = listOf("-h", file("javah").absolutePath)
}
test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
workingDir = file("products")
}
run.get().workingDir = file("products")
register<Exec> ("products") {
commandLine(MAKE, "-C", "products", "-j")
}
register<Exec> ("cleanProducts") {
commandLine(MAKE, "-C", "products", "-j", "-s", "clean")
}
getByName("build") {
dependsOn("products")
}
getByName("clean") {
dependsOn("cleanProducts")
}
if (file("jnisrc").exists()) {
register<Exec> ("jni") {
dependsOn("classes")
commandLine(MAKE, "-C", "jnisrc")
}
register<Exec> ("cleanJni") {
commandLine(MAKE, "-C", "jnisrc", "-j", "-s", "distclean")
}
getByName("build") {
dependsOn("jni")
}
getByName("clean") {
dependsOn("cleanJni")
}
}
}
}