-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
325 lines (286 loc) · 11.1 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
plugins {
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'net.darkhax.curseforgegradle' version '1.+'
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.71.8'
id 'com.modrinth.minotaur' version '2.+'
id 'io.freefair.lombok' version '6.3.0'
}
repositories {
maven {
// location of the maven that hosts Mantle and JEI files
name = 'Progwml6 maven'
url = 'https://dvs1.progwml6.com/files/maven'
}
maven { // TOP
name 'McJty maven'
url "https://maven.k-4u.nl"
}
maven { // CraftTweaker, Immersive Engineering, JEI
name 'BlameJared Maven'
url 'https://maven.blamejared.com'
}
flatDir {
dirs 'libs'
}
maven {
name = "Curse Maven"
url = "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/wendall911/SurvivalistEssentials")
credentials {
username = project.githubusername
password = project.githubtoken
}
}
maven {
// Patchouli && Provider
name = "Blame Jared"
url = "https://maven.blamejared.com"
}
}
group = 'com.github.wendall911.tinkersurvival'
version = "${minecraft_version}-${mod_version}"
archivesBaseName = "${mod_name}"
def mcversion = "${minecraft_version}"
def modid = "${modid}"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '17'
minecraft {
mappings channel: "${mappings_channel}", version: "${mappings_version}-${minecraft_version}"
runs {
client {
workingDirectory project.file("run").canonicalPath
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
tinkersurvival {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
tinkersurvival {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
args '--mod', 'tinkersurvival',
'--all',
'--output', file('src/generated/resources/'),
'--existing', file('src/main/resources/'),
'--existing', file('src/generated/resources')
mods {
tinkersurvival {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("slimeknights.mantle:Mantle:${minecraft_version}-${mantle_version}")
implementation fg.deobf("slimeknights.tconstruct:TConstruct:${minecraft_version}-${tic_version}")
implementation fg.deobf("com.github.wendall911.survivalistessentials:survivalistessentials:${se_version}") {
transitive = false
}
implementation fg.deobf("com.github.wendall911.homeostatic:homeostatic:${homeostatic_version}") {
transitive = false
}
implementation fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")
implementation fg.deobf("xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}")
implementation fg.deobf("curse.maven:chargedcharms-682683:${chargedcharms_version}")
if (System.getenv('DATA_GEN') == null) {
//Include some examples here for testing other mods
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
runtimeOnly fg.deobf("mcjty.theoneprobe:theoneprobe:${minecraft_short_version}-${probe_version}") {
transitive = false
}
runtimeOnly fg.deobf("curse.maven:botania-225643:${botania_version}")
runtimeOnly fg.deobf("curse.maven:immersiveengineering-231951:${ie_version}")
runtimeOnly fg.deobf("curse.maven:sol_carrot-277616:${sol_carrot_version}")
runtimeOnly fg.deobf("curse.maven:titanium-287342:${titanium_version}")
runtimeOnly fg.deobf("curse.maven:sushigocrafting-452500:${sushigocrafting_version}")
runtimeOnly fg.deobf("curse.maven:culinary_construct-296676:${culinary_construct_version}")
runtimeOnly fg.deobf("curse.maven:architectury-419699:${architectury_version}")
runtimeOnly fg.deobf("curse.maven:bmo-567709:${bmo_version}")
}
else {
runtimeOnly fg.deobf("curse.maven:create-328085:${create_version}")
}
runtimeOnly fg.deobf("curse.maven:curios-309927:${curios_version}")
runtimeOnly fg.deobf("curse.maven:comforts-276951:${comforts_version}")
implementation fg.deobf(fileTree(dir: 'libs', include: '*.jar'))
}
def commonManifest = {
attributes 'FMLAT': 'tinkersurvival_at.cfg'
}
jar {
manifest {
attributes([
"Specification-Title": mod_name,
"Specification-Vendor": "${mod_author}",
"Specification-Version": "${archiveVersion}",
"Implementation-Title": "${mod_name}",
"Implementation-Version": "${archiveVersion}",
"Implementation-Vendor" :"${mod_author}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [ 'version': version,
'issue_tracker': issue_tracker, 'license': license, 'modid': modid, 'display_name': display_name,
'description': description, 'display_url': display_url, 'update_url': update_url, 'authors': authors,
'credits': credits, 'logo_file': logo_file, 'minecraft_version_range': minecraft_version_range,
'forge_version_range': forge_version_range, "loader_version_range": loader_version_range,
'se_version': se_version
]
processResources {
duplicatesStrategy(DuplicatesStrategy.FAIL)
inputs.properties replaceProperties
exclude '.cache'
replaceProperties.put 'project', project
filesMatching(resourceTargets) {
expand replaceProperties
}
}
jar.finalizedBy('reobfJar', 'signJar')
def updates = tasks.register("generateUpdates", Copy) {
it.outputs.upToDateWhen {
false
}
it.from("./files/templates/") {
include 'updates.json'
expand 'mod_version': mod_version
}
it.into 'files/'
}
def changelogFile = 'build/libs/' + project.getName() + '-' + version + '-changelog.txt'
task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
if (project.hasProperty('tscurseApiKey')) {
apiToken = project.tscurseApiKey
def mainFile = upload(project.tscurseId, file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
mainFile.changelog = file(changelogFile)
mainFile.addJavaVersion('Java 17')
mainFile.addModLoader('Forge')
mainFile.releaseType = "${release_type}"
"${release_versions}".split(',').each {
mainFile.addGameVersion("${it}")
}
mainFile.addRequirement('mantle')
mainFile.addRequirement('tinkers-construct')
mainFile.addRequirement('survivalist-essentials')
mainFile.addOptional('configured')
mainFile.addOptional('catalogue')
mainFile.addOptional('fruit-trees')
mainFile.addOptional('quark')
mainFile.addOptional('biomes-o-plenty')
mainFile.addOptional('all-you-can-eat')
mainFile.addOptional('water-source')
mainFile.addOptional('sushigocrafting')
mainFile.addOptional('botania')
mainFile.addOptional('ars-nouveau')
mainFile.addOptional('exnihilosequentia')
mainFile.addOptional('the-undergarden')
mainFile.addOptional('dynamictrees')
mainFile.addOptional('oh-the-biomes-youll-go')
mainFile.addOptional('the-twilight-forest')
mainFile.addOptional('ecologics')
mainFile.addOptional('alexs-mobs')
mainFile.addOptional('betteranimalsplus')
mainFile.addOptional('malum')
mainFile.addOptional('ice-and-fire-dragons')
mainFile.addOptional('psi')
}
}
tasks.curseforge.dependsOn build
modrinth {
if (project.hasProperty('tsModrinthId')) {
token = project.modrinthKey
projectId = project.tsModrinthId
version = getVersion()
versionType = "${release_type}"
if (file(changelogFile).exists()) {
changelog = file(changelogFile).text
}
uploadFile = file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")
gameVersions = "${release_versions}".split(",") as List<String>
dependencies {
required.project 'mantle'
required.project 'tinkers-construct'
required.project 'survivalist-essentials'
optional.project 'quark'
optional.project 'allyoucaneat'
optional.project 'botania'
optional.project 'exnihilosequentia'
optional.project 'dynamictrees'
optional.project 'biomesyougo'
optional.project 'ecologics'
optional.project 'psi'
}
}
}
tasks.modrinth.dependsOn build
task changelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
file = new File(changelogFile);
templateContent = file('files/templates/changelog.mustache').getText('UTF-8');
fromRepo = file("$projectDir");
toRef = "HEAD";
fromRef = "${minecraft_version}-${last_mod_version}";
}
tasks.build.dependsOn('changelog', 'generateUpdates')
// Jar Signing
import net.minecraftforge.gradle.common.tasks.SignJar
task signJar(type: SignJar, dependsOn: jar) {
dependsOn 'reobfJar'
// Skip the task if our secret data isn't available
onlyIf {
project.hasProperty('keyStore')
}
keyStore = project.keyStore // This needs to be a path to the keystore file
alias = project.keyStoreAlias
storePass = project.keyStorePass
keyPass = project.keyStoreKeyPass
inputFile = jar.archiveFile
outputFile = jar.archiveFile
}
publishing {
repositories {
maven {
name = 'GitHubPackages'
url = uri(maven_url)
credentials {
username = project.githubusername
password = project.githubtoken
}
}
}
publications {
gpr(MavenPublication) {
artifactId = modid
from(components.java)
}
}
}