aboutsummaryrefslogtreecommitdiff
path: root/target/build.gradle.kts
blob: 7ffdde98727af7e9ba36675e0b49edce9b02e60f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
plugins {
    java
    id("com.github.johnrengelman.shadow") version "7.1.2"
}

java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(11))
}


val shadowOnly: Configuration by configurations.creating {
    attributes {
        this.attribute(org.gradle.api.attributes.java.TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11)
    }
}
repositories {
    mavenCentral()
    maven("https://maven.architectury.dev/")
    maven("https://repository.ow2.org/nexus/content/repositories/releases/")
}

dependencies {
    shadowOnly(implementation("org.ow2.asm:asm:9.4")!!)
    shadowOnly(implementation("org.ow2.asm:asm-commons:9.4")!!)
    shadowOnly("dev.architectury:architectury-pack200:0.1.3")
}
tasks.withType(Jar::class) {
    manifest {
        attributes.apply {
            this["Premain-Class"] = "moe.nea.modernjava.target.Pack200Retransformer"
        }
    }
}

tasks.shadowJar {
    archiveClassifier.set("")
    configurations = listOf(shadowOnly)
    relocate("org.objectweb.asm", "moe.nea.modernjava.asm")
    // relocate("dev.architectury.pack200.java", "java.util.jar")
}
tasks.jar {
    archiveClassifier.set("thin")
}
tasks.assemble.get().dependsOn(tasks.shadowJar)