-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbuild.gradle
217 lines (180 loc) · 5.07 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
plugins {
id 'java-library'
id 'application'
id 'maven-publish'
id "checkstyle"
id 'com.diffplug.spotless'
id 'org.openjfx.javafxplugin'
id 'org.gradlex.extra-java-module-info'
id 'com.gradleup.shadow'
id 'eclipse'
id 'me.modmuss50.mod-publish-plugin' version '0.8.4'
}
repositories {
mavenCentral()
maven {
name = "Fabric"
url = 'https://maven.fabricmc.net/'
}
}
group = 'net.fabricmc'
base {
archivesName = 'matcher'
}
def ENV = System.getenv()
checkstyle {
configFile = project.file("checkstyle.xml")
toolVersion = project.checkstyle_version
}
spotless {
lineEndings = com.diffplug.spotless.LineEnding.UNIX
java {
removeUnusedImports()
importOrder('java.', 'javax.', '', 'net.fabricmc.', 'matcher.')
indentWithTabs()
trimTrailingWhitespace()
}
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}
javafx {
version = javafx_version
modules = [ 'javafx.controls', 'javafx.web' ]
// Don't include native binaries via the plugin,
// since it will only include those for the current OS.
// The full set of native libraries gets shadowed a few lines beneath.
configuration = 'compileOnly'
}
def platforms = [
"linux",
"mac",
"mac-aarch64",
"win"
]
def fxModules = [
"javafx-base",
"javafx-graphics",
"javafx-controls",
"javafx-web",
"javafx-media"
]
configurations {
platforms.each { platform ->
register(platform)
}
}
dependencies {
api "org.ow2.asm:asm:${asm_version}"
api "org.ow2.asm:asm-tree:${asm_version}"
api "org.slf4j:slf4j-api:${slf4j_version}"
api "net.fabricmc:mapping-io:${mappingio_version}"
implementation "org.ow2.asm:asm-commons:${asm_version}"
implementation "org.ow2.asm:asm-util:${asm_version}"
implementation "com.github.javaparser:javaparser-core:${javaparser_version}"
implementation "net.fabricmc:cfr:${fabric_cfr_version}"
implementation "org.vineflower:vineflower:${vineflower_version}"
implementation "org.bitbucket.mstrobel:procyon-compilertools:${procyon_version}"
implementation ("io.github.skylot:jadx-core:${jadx_version}") {
exclude group: 'com.android.tools.build', module: 'aapt2-proto'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
implementation ("io.github.skylot:jadx-java-input:${jadx_version}") {
exclude group: 'com.android.tools.build', module: 'aapt2-proto'
exclude group: 'io.github.skylot', module: 'raung-disasm'
}
runtimeOnly "org.tinylog:tinylog-impl:${tinylog_version}"
runtimeOnly "org.tinylog:slf4j-tinylog:${tinylog_version}"
platforms.each {platform ->
fxModules.each {module ->
add(platform, "org.openjfx:${module}:${javafx_version}:${platform}") {
transitive = false
}
}
}
}
extraJavaModuleInfo {
failOnMissingModuleInfo.set(false) // because of transitive dependencies
// CFR
automaticModule("net.fabricmc:cfr", "cfr")
// Vineflower
automaticModule("org.vineflower:vineflower", "org.vineflower.vineflower")
// Procyon
automaticModule("org.bitbucket.mstrobel:procyon-compilertools", "procyon.compilertools")
// JADX
automaticModule("io.github.skylot:jadx-core", "jadx.core")
automaticModule("io.github.skylot:jadx-java-input", "jadx.plugins.java_input")
}
application {
mainModule = 'matcher'
mainClass = 'matcher.Main'
}
jar {
processResources.exclude('tinylog-dev.properties')
}
// Disable the default shadowJar task
shadowJar {
enabled = false
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
platforms.forEach { platform ->
def platformJar = tasks.register(platform + "Jar", ShadowJar) {
archiveClassifier = platform
from sourceSets.named('main').map { it.output }
configurations.add(project.configurations.getByName(platform))
configurations.add(project.configurations.runtimeClasspath)
exclude 'META-INF/*.RSA'
exclude 'META-INF/*.SF'
manifest {
attributes 'Main-Class': 'matcher.Main'
}
}
tasks.named('assemble') {
dependsOn platformJar
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
if (ENV.MAVEN_URL) {
repositories.maven {
name = "fabric"
url = ENV.MAVEN_URL
credentials {
username = ENV.MAVEN_USERNAME
password = ENV.MAVEN_PASSWORD
}
}
}
}
}
// Publish the fat platform specific jars to GitHub releases
publishMods {
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
type = STABLE
dryRun = providers.environmentVariable("GITHUB_TOKEN").map { false }.getOrElse(true)
file = jar.archiveFile
platforms.forEach { platform ->
additionalFiles.from tasks.named(platform + "Jar", ShadowJar).map { it.archiveFile }
}
github {
accessToken = providers.environmentVariable("GITHUB_TOKEN")
repository = providers.environmentVariable("GITHUB_REPOSITORY").getOrElse("FabricMC/dryrun")
commitish = providers.environmentVariable("GITHUB_REF_NAME").getOrElse("dryrun")
}
}