added old executable-jar plugin prototype (excluded from build)
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
import java.util.jar.Attributes
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath project(":multi-release-jar")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
ext.setProperty("jpms.module.name", "net.woggioni.executable.jar")
|
||||
|
||||
apply plugin: 'net.woggioni.gradle.multi-release-jar'
|
||||
|
||||
configurations {
|
||||
embedded
|
||||
compileOnly.extendsFrom(embedded)
|
||||
@@ -10,12 +21,20 @@ configurations {
|
||||
|
||||
dependencies {
|
||||
embedded project(path: ":executable-jar:executable-jar-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([
|
||||
@@ -29,13 +48,17 @@ jar {
|
||||
|
||||
tasks.register("tar", Tar) {
|
||||
archiveFileName = "${project.name}.tar"
|
||||
from(sourceSets.main.output)
|
||||
from {
|
||||
configurations.named('embedded').map {
|
||||
it.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,4 +67,4 @@ tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile) {
|
||||
String path = project(":executable-jar:executable-jar-common").extensions.getByType(JavaPluginExtension).sourceSets.named("main").get().output.asPath
|
||||
options.compilerArgs.addAll(["--patch-module", "net.woggioni.executable.jar=$path"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user