mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-03 11:26:38 -04:00
53 lines
1.0 KiB
Groovy
53 lines
1.0 KiB
Groovy
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
|
|
}
|
|
|