-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
288 lines (244 loc) · 6.59 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
buildscript {
repositories {
maven {
name 'Beanification'
url 'https://maven.tamaized.com/releases/'
}
}
dependencies {
classpath "tamaized:beanification:${minecraft_version}-${beanification_version}:gradle"
}
}
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
// Version List: https://projects.neoforged.net/neoforged/ModDevGradle
id 'net.neoforged.moddev' version "${mdg_version}"
id "com.dorongold.task-tree" version "4.0.0"
id 'com.gradleup.shadow' version '8.3.3'
id 'io.github.0ffz.github-packages' version '1.+'
}
apply plugin: 'tamaized.beanification'
configurations {
shade
}
shadowJar {
archiveClassifier.set('')
configurations = [project.configurations.shade]
relocate 'tamaized.beanification', "tamaized.${project.mod_id}.beanification"
relocate 'tamaized.regutil', "tamaized.${project.mod_id}.regutil"
}
def secrets = new Properties()
def secretsFile = file('secrets.properties')
if (secretsFile.exists()) {
secretsFile.withInputStream {
stream -> secrets.load(stream)
}
fileTree("secrets").matching {
include "**/*.properties"
}.each {
File file ->
file.withInputStream {
stream -> secrets.load(stream)
}
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
version = "${project.minecraft_version}-${project.mod_major_version}." + (hasProperty("CIVersion") ? CIVersion : mod_version)
group = "tamaized.${project.mod_id}"
base {
archivesName = "Voidscape"
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation,-this-escape" << "-Werror"
options.encoding = 'UTF-8'
}
sourceSets {
data {
compileClasspath += main.compileClasspath + main.output
java {
srcDirs = ['src/main/java', 'src/data/java']
}
resources {
srcDirs = ['src/main/resources']
}
}
dataForPublishing {
compileClasspath += data.compileClasspath
java {
srcDirs = ['src/data/java']
}
}
}
configurations {
dataImplementation.extendsFrom implementation
}
neoForge {
def mod_id = project.mod_id
version = project.neoforge_version
validateAccessTransformers = true
addModdingDependenciesTo sourceSets.data
mods {
"${mod_id}" {
it.sourceSet this.sourceSets.main
}
"${mod_id}-data" {
it.sourceSet this.sourceSets.main
it.sourceSet this.sourceSets.data
}
}
def mainMod = mods."${project.mod_id}"
def dataMod = mods."${project.mod_id}-data"
unitTest {
enable()
testedMod = mainMod
}
runs {
configureEach {
gameDirectory = project.file('run')
systemProperty 'forge.logging.console.level', 'debug'
logLevel = org.slf4j.event.Level.DEBUG
loadedMods = [mainMod]
}
client {
client()
systemProperty 'forge.enabledGameTestNamespaces', mod_id
programArguments.addAll '--username', secrets.getProperty("username") ?: 'Dev', secrets.getProperty("uuid") ? '--uuid' : '', secrets.getProperty("uuid") ?: ''
}
server {
server()
systemProperty 'forge.enabledGameTestNamespaces', mod_id
programArgument '--nogui'
}
data {
data()
gameDirectory = project.file('run-data')
programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
sourceSet = this.sourceSets.data
loadedMods = [dataMod]
}
}
}
repositories {
maven {
name 'Jared\'s Maven' // JEI
url 'https://maven.blamejared.com/'
}
maven {
name 'Tama\'s Maven' // Beanification, RegUtil
url 'https://maven.tamaized.com/releases/'
}
maven {
name 'Modrinth\'s Maven' // EnderIO
url "https://api.modrinth.com/maven"
}
maven githubPackage.invoke("The-Aether-Team/The-Aether")
}
dependencies {
runtimeOnly "mezz.jei:jei-${project.base_minecraft_version}-neoforge:${project.jei_version}"
// runtimeOnly fg.deobf("maven.modrinth:enderio:6.0.18-alpha")
// runtimeOnly fg.deobf("com.aetherteam.aether:aether:1.20.1-1.0.0-beta.1.2-neoforge")
def beanification = "tamaized:beanification:${project.minecraft_version}-${project.beanification_version}"
implementation beanification
shade beanification
testImplementation "${beanification}:tests"
testCompileOnly "${beanification}:test-sources"
def reg = "tamaized:regutil:${project.minecraft_version}-${project.regutil_version}"
implementation reg
shade reg
testImplementation group: 'net.neoforged', name: 'testframework', version: project.neoforge_version
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.10.3'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.3'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.12.0'
}
test {
useJUnitPlatform()
testLogging {
events "failed"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
processResources {
def version = project.version
doLast {
filesMatching("META-INF/neoforge.mods.toml") {
expand([
'file': ['jarVersion': "${version}"]
])
}
}
}
jar {
manifest {
attributes([
"Specification-Title" : "Voidscape",
"Specification-Vendor" : "Tamaized",
"Specification-Version" : "${version}",
"Implementation-Title" : project.name,
"Implementation-Version" : "${version}",
"Implementation-Vendor" : "Tamaized",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
def mavenUser = hasProperty("CIMUser") ? CIMUser : secrets.getProperty("maven_username")
def mavenToken = hasProperty("CIMToken") ? CIMToken : secrets.getProperty("maven_password")
publishing {
publications {
create('mavenJava', MavenPublication) {
afterEvaluate {
artifact this.project.jar
artifact this.project.sourceJar
artifact this.project.dataJar
artifact this.project.dataSourceJar
}
groupId 'tamaized'
artifactId this.project.mod_id
}
}
repositories {
maven {
url "https://maven.tamaized.com/releases"
credentials {
username mavenUser
password mavenToken
}
}
}
}
tasks.register('sourceJar', Jar) {
dependsOn 'classes'
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
tasks.register('dataJar', Jar) {
dependsOn 'classes'
from sourceSets.dataForPublishing.output
archiveClassifier = 'data'
}
tasks.register('dataSourceJar', Jar) {
dependsOn 'classes'
from sourceSets.dataForPublishing.allSource
archiveClassifier = 'data-sources'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
build.dependsOn shadowJar