-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
48 lines (40 loc) · 1.13 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
plugins {
kotlin("jvm") version "2.0.0"
}
repositories {
mavenCentral()
}
kotlin {
jvmToolchain(21)
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
}
task("fatJar", Jar::class) {
group = project.name
archiveBaseName = project.name
manifest.attributes["Manifest-Version"] = "1.0"
manifest.attributes["Main-Class"] = "parallelZip.MainJava"
manifest.attributes["Add-Opens"] = "java.base/java.util.zip java.base/java.io"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
with(tasks.jar.get())
}
task<JavaExec>("runJava") {
configure("MainJava")
}
task<JavaExec>("runKotlin") {
configure("MainKotlin")
}
task<JavaExec>("runSequential") {
configure("Sequential")
}
fun JavaExec.configure(name: String) {
group = project.name
mainClass = "parallelZip.$name"
classpath = sourceSets["main"].runtimeClasspath
jvmArguments = listOf(
"--add-opens=java.base/java.util.zip=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED"
)
}