-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle.kts
103 lines (86 loc) · 2.69 KB
/
build.gradle.kts
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
dependencies {
classpath("com.guardsquare:proguard-gradle:7.3.2")
}
}
plugins {
`java-library`
id("com.github.johnrengelman.shadow") version "8.1.1"
}
allprojects {
apply(plugin = "java-library")
group = "com.llamalad7"
version = "0.5.0-beta.4"
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}
tasks.withType<Javadoc> {
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}
tasks.withType<Jar> {
dependsOn(":expressions:generateGrammarSource")
}
}
val library by configurations.creating {
configurations.compileOnly.get().extendsFrom(this)
}
val shade by configurations.creating {
configurations.compileOnly.get().extendsFrom(this)
}
val shadeOnly by configurations.creating
dependencies {
library(mixin())
library(asm())
shadeOnly(antlrRuntime())
shade(apacheCommons())
shadeOnly(project("mixin-versions"))
shade("com.google.code.gson:gson:2.11.0")
shade("com.github.zafarkhaja:java-semver:0.10.2")
shade(project("expressions").also { it.isTransitive = false })
}
tasks.named<ShadowJar>("shadowJar") {
configurations = listOf(shade, shadeOnly)
archiveClassifier = "fat"
relocate("org.apache.commons.lang3", "com.llamalad7.mixinextras.lib.apache.commons")
relocate("org.antlr.v4", "com.llamalad7.mixinextras.lib.antlr")
relocate("com.google.gson", "com.llamalad7.mixinextras.lib.gson")
relocate("com.google.errorprone", "com.llamalad7.mixinextras.lib.errorprone")
relocate("com.github.zafarkhaja.semver", "com.llamalad7.mixinextras.lib.semver")
exclude("META-INF/maven/**/*", "META-INF/*.txt", "META-INF/proguard/*", "META-INF/LICENSE")
from("LICENSE") {
rename { "${it}_MixinExtras" }
}
}
val proguardFile by extra { file("build/libs/mixinextras-$version.jar") }
val proguardJar = createProGuardTask(
"proguardJar",
tasks.shadowJar.get().archiveFile.get().asFile,
proguardFile,
"proguard.conf"
).apply {
dependsOn(tasks.shadowJar)
tasks.build.get().dependsOn(this)
}
val shrunkProguardFile by extra { file("build/libs/mixinextras-$version-shrunk.jar") }
val shrunkProguardJar = createProGuardTask(
"shrunkJar",
proguardFile,
shrunkProguardFile,
"proguard-shrink.conf"
).apply {
dependsOn(proguardJar)
tasks.build.get().dependsOn(this)
doLast {
decompressJar(shrunkProguardFile)
}
}
tasks.named<Jar>("jar") {
archiveClassifier = "slim"
}