-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
49 lines (40 loc) · 1.06 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
plugins {
id("java")
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
java.sourceCompatibility = JavaVersion.VERSION_16
java.targetCompatibility = JavaVersion.VERSION_16
open class CustomJavaExec : JavaExec()
{
override fun getJavaVersion(): JavaVersion {
return JavaVersion.VERSION_16
}
}
fun getLauncher(): String {
var launcherTask = project("launcher").getTasksByName("linkDebug", false).first()
for (f in launcherTask.outputs.files.files)
{
if (f.name.contains("launcher"))
return f.absolutePath
}
throw Exception("Couldn't find custom launcher executable")
}
tasks.register<CustomJavaExec>("LaunchWithCustomLauncher")
{
group = "run"
classpath = sourceSets.main.get().runtimeClasspath
mainClass.set("org.example.Main")
setExecutable(file(getLauncher()))
dependsOn("launcher::build")
}