Use Gradle Kotlin DSL
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
version '1.0'
|
||||
|
||||
dependencies {
|
||||
compileOnly project.files("lib/modlauncher-4.1.0.jar")
|
||||
}
|
||||
|
||||
compileJava {
|
||||
sourceCompatibility = 8
|
||||
targetCompatibility = 8
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Created-By': 'Copyright(c) 2013-2020 huangyuhui.',
|
||||
'Implementation-Version': project.version
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
version = "1.0"
|
||||
|
||||
dependencies {
|
||||
compileOnly(project.files("lib/modlauncher-4.1.0.jar"))
|
||||
}
|
||||
|
||||
tasks.compileJava {
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
manifest {
|
||||
attributes(
|
||||
"Created-By" to "Copyright(c) 2013-2020 huangyuhui.",
|
||||
"Implementation-Version" to project.version
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
version '1.0'
|
||||
|
||||
sourceSets.create("agent") {
|
||||
java {
|
||||
srcDir 'src/main/agent'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.0-beta9'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
sourceCompatibility = 8
|
||||
targetCompatibility = 8
|
||||
|
||||
doLast {
|
||||
FileTree tree = fileTree('build/classes/java')
|
||||
tree.include '**/*.class'
|
||||
tree.each {
|
||||
RandomAccessFile rf = new RandomAccessFile(it, "rw")
|
||||
rf.seek(7) // major version
|
||||
rf.write(50) // java 6
|
||||
rf.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task agentJar(type: Jar) {
|
||||
dependsOn(tasks.compileJava)
|
||||
|
||||
baseName = 'log4j-patch-agent'
|
||||
|
||||
manifest {
|
||||
attributes 'Premain-Class': 'org.glavo.log4j.patch.agent.Log4jAgent'
|
||||
}
|
||||
|
||||
from(sourceSets.agent.output)
|
||||
from(sourceSets.main.output) {
|
||||
includeEmptyDirs = false
|
||||
|
||||
eachFile {
|
||||
it.path = "org/glavo/log4j/patch/agent/${it.name}.bin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
enabled = false
|
||||
dependsOn agentJar
|
||||
}
|
||||
|
||||
53
minecraft/libraries/log4j-patch/build.gradle.kts
Normal file
53
minecraft/libraries/log4j-patch/build.gradle.kts
Normal file
@@ -0,0 +1,53 @@
|
||||
import java.io.RandomAccessFile
|
||||
|
||||
version = "1.0"
|
||||
|
||||
sourceSets.create("agent") {
|
||||
java {
|
||||
srcDir("src/main/agent")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.apache.logging.log4j:log4j-core:2.0-beta9")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
sourceCompatibility = "1.8"
|
||||
targetCompatibility = "1.8"
|
||||
|
||||
doLast {
|
||||
val tree = fileTree(destinationDirectory)
|
||||
tree.include("**/*.class")
|
||||
tree.exclude("module-info.class")
|
||||
tree.forEach {
|
||||
RandomAccessFile(it, "rw").use { rf ->
|
||||
rf.seek(7) // major version
|
||||
rf.write(50) // java 6
|
||||
rf.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val agentJar = tasks.create<Jar>("agentJar") {
|
||||
dependsOn(tasks.compileJava)
|
||||
|
||||
archiveBaseName.set("log4j-patch-agent")
|
||||
|
||||
manifest {
|
||||
attributes("Premain-Class" to "org.glavo.log4j.patch.agent.Log4jAgent")
|
||||
}
|
||||
|
||||
from(sourceSets["agent"].output)
|
||||
from(sourceSets["main"].output) {
|
||||
includeEmptyDirs = false
|
||||
eachFile { path = "org/glavo/log4j/patch/agent/$name.bin" }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
enabled = false
|
||||
dependsOn(agentJar)
|
||||
}
|
||||
Reference in New Issue
Block a user