-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
140 lines (118 loc) · 4.64 KB
/
build.gradle
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import me.shedaniel.staticmixin.tasks.MixinPatchTask
plugins {
id "java"
id "idea"
id "eclipse"
id "maven-publish"
id "java-gradle-plugin"
id "org.cadixdev.licenser" version "0.6.1"
id "com.github.johnrengelman.shadow" version "7.0.0"
id "me.shedaniel.static-mixin" version "1.0.+"
}
group "me.shedaniel"
def runNumber = System.getenv("GITHUB_RUN_NUMBER") ?: "9999"
version = base_version + "." + runNumber
logger.lifecycle(":building architectury-mixin v${version}")
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 8
}
repositories {
maven { url "https://maven.architectury.dev/" }
maven { url "https://repo.spongepowered.org/repository/maven-public/" }
gradlePluginPortal()
}
license {
header = rootProject.file("HEADER")
ext {
name = "Mixin"
organization = "architectury, FabricMC, SpongePowered"
year = "2019, 2020, 2021"
}
include "**/*.java"
}
def patchingVersions = ["0.8.2", "0.8.4", "0.8.5", "0.8.7"]
dependencies {
compileOnly "me.shedaniel:static-mixin:1.0.+"
def asm_version = '9.2'
compileOnly "org.ow2.asm:asm:$asm_version"
compileOnly "org.ow2.asm:asm-analysis:$asm_version"
compileOnly "org.ow2.asm:asm-commons:$asm_version"
compileOnly "org.ow2.asm:asm-tree:$asm_version"
compileOnly "org.ow2.asm:asm-util:$asm_version"
}
jar {
archiveClassifier = "raw"
}
sourceSets {
mixincommon {
compileClasspath += sourceSets.main.compileClasspath
dependencies.add(compileClasspathConfigurationName, "org.spongepowered:mixin:0.8.4")
}
}
task patchMixin(type: MixinPatchTask, dependsOn: "jar") {
}
patchingVersions.each { version ->
def name = "mixin" + version.replace('.', '_')
def sourceSet = sourceSets.create(name)
sourceSet.compileClasspath += sourceSets.main.compileClasspath
sourceSet.compileClasspath += sourceSets.mixincommon.output
def mixin = "org.spongepowered:mixin:" + version
def mixinDep = dependencies.add(sourceSet.compileClasspathConfigurationName, mixin)
def patchMixin = tasks.register("patchMixin" + version.replace('.', '_'), MixinPatchTask.class) {
classpath.from(sourceSet.output + sourceSets.mixincommon.output + sourceSet.compileClasspath)
from(sourceSet.output + sourceSets.mixincommon.output + configurations.detachedConfiguration(dependencies.create(mixin)).files.collect { zipTree(it) })
mixinConfig name + ".mixin.json"
archiveVersion = version
archiveClassifier = "patched"
group "patch"
}
def shadowPatchMixin = tasks.register("shadowPatchedMixin" + version.replace('.', '_'), ShadowJar.class) {
dependsOn patchMixin
relocate "me.shedaniel.staticmixin", "dev.architectury.patchedmixin.staticmixin"
from((patchMixin.get().outputs.files + project.configurations.detachedConfiguration(dependencies.create("me.shedaniel.static-mixin:static-mixin-runtime:1.0.+")).files).collect { zipTree(it) }) {
exclude "META-INF/*.SF", "META-INF/*.RSA", "META-INF/*.DSA"
}
archiveVersion = version
group "patch"
}
assemble.dependsOn shadowPatchMixin.get()
}
def runtimeDeps = [
[group: "com.google.code.gson", artifact: "gson", version: "2.2.4"],
[group: "com.google.guava", artifact: "guava", version: "21.0"]
]
publishing {
publications {
patchingVersions.each { version ->
create("mixin" + version.replace('.', '_'), MavenPublication) {
groupId "dev.architectury"
artifactId "mixin-patched"
it.version version + "." + runNumber
artifact(this.tasks.getByName("shadowPatchedMixin" + version.replace('.', '_')))
pom.withXml {
def containerNode = asNode().appendNode("dependencies")
for (def dep in runtimeDeps) {
def node = containerNode.appendNode("dependency")
node.appendNode("groupId", dep.group)
node.appendNode("artifactId", dep.artifact)
node.appendNode("version", dep.version)
node.appendNode("scope", "runtime")
}
}
}
}
}
repositories {
if (System.getenv("MAVEN_PASS") != null) {
maven {
url = "https://deploy.shedaniel.me/"
credentials {
username = "shedaniel"
password = System.getenv("MAVEN_PASS")
}
}
}
}
}