74 lines
1.9 KiB
Groovy
74 lines
1.9 KiB
Groovy
import java.util.jar.Attributes
|
|
|
|
plugins {
|
|
id "net.woggioni.gradle.multi-release-jar"
|
|
}
|
|
|
|
ext.setProperty("jpms.module.name", "net.woggioni.envelope")
|
|
|
|
configurations {
|
|
embedded {
|
|
visible = false
|
|
canBeConsumed = false
|
|
}
|
|
compileOnly.extendsFrom(embedded)
|
|
tar {
|
|
visible = true
|
|
canBeConsumed = true
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
embedded project(path: ":common", configuration: 'archives')
|
|
embedded group: "net.woggioni", name: "xclassloader", version: getProperty("version.xclassloader")
|
|
}
|
|
|
|
java {
|
|
modularity.inferModulePath = true
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
javaCompiler = javaToolchains.compilerFor {
|
|
languageVersion = JavaLanguageVersion.of(16)
|
|
}
|
|
options.forkOptions.jvmArgs << "--illegal-access=permit"
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes([
|
|
(Attributes.Name.SPECIFICATION_TITLE) : "envelope-launcher",
|
|
(Attributes.Name.SEALED) : true
|
|
].collectEntries {
|
|
[it.key.toString(), it.value.toString()]
|
|
})
|
|
}
|
|
}
|
|
|
|
Provider<Tar> tarTaskProvider = tasks.register("tar", Tar) {
|
|
archiveFileName = "${project.name}.tar"
|
|
from(project.tasks.named(JavaPlugin.JAR_TASK_NAME)
|
|
.flatMap(Jar.&getArchiveFile)
|
|
.map(RegularFile.&getAsFile)
|
|
.map(project.&zipTree))
|
|
from(configurations.named('embedded').map {
|
|
it.collect {
|
|
it.isDirectory() ? it : zipTree(it)
|
|
}
|
|
}) {
|
|
exclude("**/module-info.class")
|
|
exclude("META-INF/MANIFEST.MF")
|
|
}
|
|
}
|
|
|
|
tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile) {
|
|
doFirst {
|
|
String path = project(":common").extensions.getByType(JavaPluginExtension).sourceSets.named("main").get().output.asPath
|
|
options.compilerArgs.addAll(["--patch-module", "net.woggioni.envelope=$path"])
|
|
}
|
|
}
|
|
|
|
artifacts {
|
|
tar tarTaskProvider
|
|
} |