-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
executable file
·241 lines (205 loc) · 7.57 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.DeterminizingTask
import baritone.gradle.task.ProguardTask
import net.fabricmc.loom.task.RemapJarTask
import java.util.stream.Collectors
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'com.jfrog.artifactory' version '4.21.0'
id 'org.ajoberstar.grgit' version '3.1.1'
id 'com.github.breadmoirai.github-release' version '2.2.12'
id 'maven-publish'
}
group project.maven_group
version project.mod_version
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16
options.encoding = "UTF-8" // allow emoji in comments :^)
}
sourceSets {
api {
compileClasspath += main.compileClasspath
}
main {
compileClasspath += api.output
}
test {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
launch {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
testmod {
compileClasspath += launch.compileClasspath + launch.runtimeClasspath + launch.output
runtimeClasspath += launch.compileClasspath + launch.runtimeClasspath + launch.output
}
schematica_api {
compileClasspath += main.compileClasspath
}
main {
compileClasspath += schematica_api.output
}
}
loom {
runs {
testmodClient {
client()
name = "Testmod Client"
source sourceSets.testmod
}
testmodServer {
server()
name = "Testmod Server"
source sourceSets.testmod
}
gametest {
inherit testmodServer
name "Game Test"
// Enable the gametest runner
vmArg "-Dfabric-api.gametest"
vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml"
runDir "build/gametest"
}
autoTestServer {
inherit testmodServer
name "Auto Test Server"
vmArg "-Dfabric.autoTest"
}
}
}
check.dependsOn(runGametest)
repositories {
mavenCentral()
maven {
name = "Ladysnake Mods"
url = 'https://ladysnake.jfrog.io/artifactory/mods'
content {
includeGroup 'io.github.ladysnake'
includeGroupByRegex 'io\\.github\\.onyxstudios.*'
}
}
maven {
url = 'https://maven.jamieswhiteshirt.com/libs-release/'
content {
includeGroup 'com.jamieswhiteshirt'
}
}
mavenLocal()
}
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings "net.fabricmc:yarn:${yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
implementation 'com.google.code.findbugs:jsr305:3.0.2'
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
modImplementation "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:${cca_version}"
modImplementation "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${cca_version}"
modImplementation "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-world:${cca_version}"
modImplementation "com.jamieswhiteshirt:reach-entity-attributes:${reach_version}"
compileOnly "com.demonwav.mcdev:annotations:1.0"
testImplementation 'junit:junit:4.12'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.api.allSource
}
task testmodJar(type: Jar, dependsOn: testmodClasses) {
archiveBaseName.set('Otomaton')
archiveClassifier.set('dev')
filesMatching('fabric.mod.json') {
expand 'version': project.version
}
}
task remapTestmodJar(type: RemapJarTask, dependsOn: project.testmodJar) {
archiveBaseName.set('Otomaton')
input.set(testmodJar.archiveFile)
addNestedDependencies.set(false)
}
processLaunchResources {
inputs.property "version", project.version
filesMatching('fabric.mod.json') {
expand "version": project.version
}
}
javadoc {
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
options.linkSource true
options.encoding "UTF-8" // allow emoji in comments :^)
source = sourceSets.api.allJava
classpath += sourceSets.api.compileClasspath
}
// skidded from fabric-example-mod (comments and all)
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release.set(16)
}
jar {
from sourceSets.launch.output, sourceSets.api.output
preserveFileTimestamps = false
reproducibleFileOrder = true
manifest {
attributes(
'MixinConfigs': 'mixins.automatone.json',
'Implementation-Title': 'Automatone',
'Implementation-Version': project.version
)
}
}
remapJar.configure {
it.classifier = 'remapped'
}
// skidded from ProguardTask
task determinizeBuiltJar(type: DeterminizingTask) {
input.set(remapJar.archiveFile)
archiveClassifier.set('unoptimized')
}
task proguard(type: ProguardTask, dependsOn: determinizeBuiltJar) {
input.set(determinizeBuiltJar.archiveFile)
archiveClassifier.set('optimized')
url 'https://github.com/Guardsquare/proguard/releases/download/v7.1.0-beta1/proguard-7.1.0-beta1.zip'
extract 'proguard-7.1.0-beta1/lib/proguard.jar'
afterEvaluate {
def mappedMods = project.configurations.modCompileClasspathMapped.resolvedConfiguration.files
classpath project.files(loom.minecraftMappedProvider.intermediaryJar)
classpath project.files(project.configurations.modCompileClasspath.resolvedConfiguration.resolvedArtifacts
.stream()
.map{it.file}
.collect(Collectors.toList())
)
classpath project.files(sourceSets.launch.runtimeClasspath.files.stream()
.filter { it.isFile() }
// remove remapped jars, the intermediary versions are included above
.filter{!loom.minecraftMappedProvider.mappedJar.equals(it) && !mappedMods.contains(it) }
.collect(Collectors.toList())
)
}
}
task createDist(type: CreateDistTask, dependsOn: proguard) {
input proguard.archiveFile
}
build.finalizedBy(createDist)
apply from: 'release.gradle'