Files
envelope/launcher/build.gradle

74 lines
1.7 KiB
Groovy

import java.util.jar.Attributes
plugins {
alias catalog.plugins.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 project(path: ":loader", configuration: 'embed')
}
java {
modularity.inferModulePath = true
}
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")
}
}
artifacts {
tar tarTaskProvider
}
compileJava11 {
options.javaModuleMainClass = 'net.woggioni.envelope.Launcher'
options.compilerArgs += ['--add-reads', 'net.woggioni.envelope=ALL-UNNAMED']
}
multiReleaseJar {
patchModule('net.woggioni.envelope', project(':common').jar.archiveFile
.map(RegularFile.&getAsFile).map(File.&toString))
}