-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
165 lines (143 loc) · 4.86 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
plugins {
id "java"
id "idea"
id "eclipse"
id "maven-publish"
id "com.github.johnrengelman.shadow" version "5.0.0"
id "org.cadixdev.licenser" version "0.6.1"
}
group "dev.architectury"
def isSnapshot = System.getenv("PR_NUM") != null
def runNumber = (System.getenv("GITHUB_RUN_NUMBER") == null ? "9999" : System.getenv("GITHUB_RUN_NUMBER"))
if (!isSnapshot) {
version = base_version + "." + runNumber
} else {
version = base_version + "-PR." + System.getenv("PR_NUM") + "." + runNumber
}
logger.lifecycle(":building architectury transformer v${version}")
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
repositories {
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.fabricmc.net/" }
mavenCentral()
}
sourceSets {
agent
runtime {
compileClasspath += sourceSets.main.runtimeClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath
compileClasspath += sourceSets.agent.runtimeClasspath
runtimeClasspath += sourceSets.agent.runtimeClasspath
}
}
license {
header = rootProject.file("HEADER")
ext {
name = "architectury"
year = "2020, 2021, 2022"
}
include "**/*.java"
}
dependencies {
implementation "dev.architectury:tiny-remapper:1.1.0"
implementation "net.fabricmc:tiny-mappings-parser:0.2.2.14"
implementation "org.ow2.asm:asm:9.6"
implementation "org.ow2.asm:asm-commons:9.6"
implementation "org.ow2.asm:asm-tree:9.6"
implementation "org.ow2.asm:asm-util:9.6"
implementation "com.google.guava:guava:29.0-jre"
implementation "com.google.code.gson:gson:2.8.5"
implementation "dev.architectury:refmap-remapper:1.0.5"
compileOnly "org.jetbrains:annotations:23.0.0"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier "sources"
from sourceSets.main.allSource
}
task agentJar(type: Jar) {
classifier "agent"
manifest {
attributes(
"Premain-Class": "dev.architectury.transformer.agent.TransformerAgent",
"Agent-Class": "dev.architectury.transformer.agent.TransformerAgent",
"Can-Redefine-Classes": true,
"Can-Retransform-Classes": true,
"Automatic-Module-Name": "dev.architectury.transformer.agent"
)
}
from sourceSets.agent.output
}
task agentSourcesJar(type: Jar, dependsOn: classes) {
classifier "agent-sources"
from sourceSets.agent.allSource
}
task runtimeJar(type: Jar, dependsOn: shadowJar) {
classifier "runtime"
manifest {
attributes(
"Main-Class": "dev.architectury.transformer.TransformerRuntime",
"Implementation-Version": project.version,
"Automatic-Module-Name": "dev.architectury.transformer.runtime"
)
}
from {
sourceSets.runtime.output + zipTree(shadowJar.archiveFile)
}
}
task runtimeSourcesJar(type: Jar, dependsOn: classes) {
classifier "runtime-sources"
from sourceSets.runtime.allSource
}
jar {
classifier "raw"
}
shadowJar {
relocate "net.fabricmc", "dev.architectury.transformer.shadowed.impl.net.fabricmc"
relocate "org.objectweb", "dev.architectury.transformer.shadowed.impl.org.objectweb"
relocate "org.checkerframework", "dev.architectury.transformer.shadowed.impl.org.checkerframework"
relocate "org.zeroturnaround", "dev.architectury.transformer.shadowed.impl.org.zeroturnaround"
relocate "org.slf4j", "dev.architectury.transformer.shadowed.impl.org.slf4j"
relocate "com.google", "dev.architectury.transformer.shadowed.impl.com.google"
relocate "javax.annotation", "dev.architectury.transformer.shadowed.impl.javax.annotation"
relocate "dev.architectury.tinyremapper", "dev.architectury.transformer.shadowed.impl.dev.architectury.tinyremapper"
relocate "dev.architectury.refmapremapper", "dev.architectury.transformer.shadowed.impl.dev.architectury.refmapremapper"
configurations = [project.configurations.runtimeClasspath]
classifier "shadow"
exclude "module-info.class"
}
task mainJar(type: Jar, dependsOn: shadowJar) {
from zipTree(shadowJar.archiveFile)
}
build.dependsOn mainJar
build.dependsOn runtimeJar
publishing {
publications {
main(MavenPublication) {
artifact(mainJar)
artifact(sourcesJar)
}
runtime(MavenPublication) {
artifact(runtimeJar)
artifact(runtimeSourcesJar)
}
agent(MavenPublication) {
artifact(agentJar)
artifact(agentSourcesJar)
}
}
repositories {
if (System.getenv("MAVEN_PASS") != null) {
maven {
url = "https://deploy.shedaniel.me/"
credentials {
username = "shedaniel"
password = System.getenv("MAVEN_PASS")
}
}
}
}
}