mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-11 19:14:11 +00:00
60 lines
2.1 KiB
Groovy
60 lines
2.1 KiB
Groovy
import org.gradle.api.tasks.compile.JavaCompile
|
|
import org.gradle.api.artifacts.component.ComponentIdentifier
|
|
|
|
configurations {
|
|
packedXz
|
|
}
|
|
|
|
dependencies {
|
|
packedXz('org.tukaani:xz:1.10')
|
|
}
|
|
|
|
def originalJar = tasks.named('jar', Jar)
|
|
sourceSets {
|
|
packedBootstrap {
|
|
java.srcDir('packaging/xz/src/main/java')
|
|
compileClasspath = files(originalJar.flatMap { it.archiveFile }) + configurations.packedXz
|
|
}
|
|
packedBootstrapTest {
|
|
java.srcDir('packaging/xz/src/test/java')
|
|
compileClasspath += sourceSets.packedBootstrap.output + sourceSets.packedBootstrap.compileClasspath
|
|
runtimeClasspath += sourceSets.packedBootstrap.output + sourceSets.packedBootstrap.compileClasspath
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
packedBootstrapTestImplementation('junit:junit:4.13.2')
|
|
}
|
|
|
|
tasks.named('compilePackedBootstrapJava', JavaCompile).configure {
|
|
dependsOn(originalJar)
|
|
}
|
|
|
|
tasks.register('packedBootstrapTest', Test) {
|
|
group = 'verification'
|
|
testClassesDirs = sourceSets.packedBootstrapTest.output.classesDirs
|
|
classpath = sourceSets.packedBootstrapTest.runtimeClasspath
|
|
}
|
|
|
|
tasks.register('packedJar', PackedJar) {
|
|
group = 'build'
|
|
description = 'Builds a Bukkit jar with an embedded XZ runtime payload.'
|
|
dependsOn(tasks.named('verifyBukkitArtifact'), tasks.named('packedBootstrapClasses'), configurations.nativeRuntime)
|
|
inputJar.set(originalJar.flatMap { it.archiveFile })
|
|
bootstrapClasses.from(sourceSets.packedBootstrap.output.classesDirs)
|
|
decoderJars.from(configurations.packedXz)
|
|
nativeArtifacts.set(providers.provider {
|
|
Map<ComponentIdentifier, File> resolved = new LinkedHashMap<>()
|
|
configurations.nativeRuntime.incoming.artifacts.artifacts.each { artifact ->
|
|
resolved.put(artifact.id.componentIdentifier, artifact.file)
|
|
}
|
|
PackedJar.resolveNativeArtifacts(resolved)
|
|
})
|
|
outputJar.set(layout.buildDirectory.file(originalJar.flatMap { it.archiveFileName }
|
|
.map { String name -> "libs/${name.replaceFirst(/\.jar$/, '-xz.jar')}" }))
|
|
}
|
|
|
|
tasks.named('check').configure {
|
|
dependsOn(tasks.named('packedBootstrapTest'))
|
|
}
|