-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
274 lines (242 loc) · 10.5 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
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7.+'
id 'net.darkhax.curseforgegradle' version '1.1.25'
id 'com.modrinth.minotaur' version '2.+'
id 'com.github.breadmoirai.github-release' version '2.4.1'
id 'io.github.yuuki1293.changelog' version '1.1.1'
}
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: mapping_channel, version: mapping_version
copyIdeResources = true
runs {
configureEach {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
property 'forge.enabledGameTestNamespaces', mod_id
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
}
server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}
gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}
data {
workingDirectory project.file('run-data')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven {
name = 'GTCEu Maven'
url = 'https://maven.gtceu.com'
content {
includeGroup 'com.gregtechceu.gtceu'
}
}
maven {
name = "Mod Maven"
url = "https://modmaven.dev/"
content {
includeGroup 'appeng'
includeGroup 'mezz.jei'
}
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
content {
includeGroup 'dev.emi'
}
}
maven {
name = "Registrate"
url = "https://maven.tterrag.com/"
content {
includeGroup 'com.tterrag.registrate'
}
}
maven {
name = "firstdarkdev"
url = "https://maven.firstdarkdev.xyz/snapshots"
content {
includeGroup 'com.lowdragmc.ldlib'
}
}
maven {
name = "Curse Maven"
url = "https://www.cursemaven.com"
content {
includeGroup 'curse.maven'
}
}
mavenLocal()
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' // Mixin
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1")
implementation jarJar("io.github.llamalad7:mixinextras-forge:0.4.1") {
jarJar.ranged(it, "[0.4.1,)")
}
implementation fg.deobf("com.gregtechceu.gtceu:gtceu-${minecraft_version}:${gtm_version}") { transitive = false } // GregTech CEu: Modern
implementation fg.deobf("appeng:appliedenergistics2-forge:${ae2_version}") // AE2
implementation fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}") // JEI
compileOnly fg.deobf("dev.emi:emi-forge:${emi_version}:api") // EMI
runtimeOnly fg.deobf("dev.emi:emi-forge:${emi_version}") // EMI
compileOnly fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}") // Registrate
compileOnly fg.deobf("com.lowdragmc.ldlib:ldlib-forge-${minecraft_version}:${ldlib_version}") { transitive = false } // ldlib
// implementation fg.deobf('net.pedroksl.adcanced_ae:AdvancedAE-0.3.3-1.20.1:0.3.3-1.20.1') // Advanced AE
compileOnly fg.deobf("curse.maven:extendedae-892005:${exae_version}") // Extended AE
runtimeOnly fg.deobf("curse.maven:extendedae-892005:${exae_version}")
runtimeOnly fg.deobf("curse.maven:glodium-957920:${glodium_version}")
runtimeOnly fg.deobf("curse.maven:applied-flux-965012:${appflux_version}") // Applied Flux
runtimeOnly fg.deobf("curse.maven:mae2-1028068:${mae2_version}") // MAE2
runtimeOnly fg.deobf("curse.maven:jade-324717:${jade_version}") // Jade
}
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version : forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors : mod_authors, mod_description: mod_description,
ae2_version_range : ae2_version_range, gtm_version_range: gtm_version_range
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
mixin {
add sourceSets.main, 'mixins.pccard.refmap.json'
config 'mixins.pccard.json'
mixin.debug = true
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
finalizedBy 'reobfJar'
}
publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
def changelogText = changelog.text
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
group = "publishing"
apiToken = System.getenv('CURSEFORGE_API_KEY') ?: 'XXX'
def mainFile = upload(1150540, jar)
mainFile.releaseType = project.version_type
mainFile.changelog = changelogText
mainFile.changelogType = 'markdown'
mainFile.displayName = "${rootProject.name} ${project.version}"
mainFile.addGameVersion(project.minecraft_version)
mainFile.addJavaVersion('Java 17')
mainFile.addRequirement('applied-energistics-2', 'gregtechceu-modern')
mainFile.addOptional('ex-pattern-provider', 'modern-ae2-additions', 'jei', 'emi')
mainFile.addModLoader('forge')
}
modrinth {
var modrinthToken = System.getenv('MODRINTH_TOKEN') ?: 'XXX'
token = modrinthToken
// Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private!
projectId = 'C3Mtqx9z' // This can be the project ID or the slug. Either will work!
versionNumber = project.version as String
versionName = "${rootProject.name} ${project.version}"
// You don't need to set this manually. Will fail if Modrinth has this version already
versionType = project.version_type // This is the default -- can also be `beta` or `alpha`
uploadFile = jar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = [project.minecraft_version] // Must be an array, even with only one version
loaders = ['forge'] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
changelog = changelogText
dependencies {
required.project 'ae2'
required.project 'gregtechceu-modern'
optional.project 'extended-ae'
optional.project 'modern-ae2-additions'
optional.project 'jei'
optional.project 'emi'
}
}
githubRelease {
token System.getenv('GITHUB_API_KEY') ?: 'XXX' // This is your personal access token with Repo permissions
// You get this from your user settings > developer settings > Personal Access Tokens
owner 'yuuki1293' // default is the last part of your group. Eg group: 'com.github.breadmoirai" => owner: "breadmoirai"
repo 'ProgrammedCircuitCard' // by default this is set to your project name
tagName "v${project.version}" // by default this is set to "v${project.version}"
targetCommitish '1.20.1' // by default this is set to "main"
releaseName "${rootProject.name} ${project.version}" // Release title, by default this is the same as the tagName
generateReleaseNotes false // Generate release notes automatically, if true and body is present, body will be prepended, if name is not given, one will be generated by the tag
body changelogText // by default this is empty
draft true // by default this is true
prerelease false // by default this is false
releaseAssets jar // this points to which files you want to upload as assets with your release, by default this is empty
allowUploadToExisting.set false // Setting this to true will allow this plugin to upload artifacts to a release if it found an existing one. If overwrite is set to true, this option is ignored.
overwrite false // by default false; if set to true, will delete an existing release with the same tag and name
dryRun false // by default false; you can use this to see what actions would be taken without making a release
apiEndpoint 'https://api.github.com' // should only change for github enterprise users
client // This is the okhttp client used for http requests
}
task uploadAll {
group = "publishing"
description = "Uploads the mod to CurseForge, Modrinth, and GitHub releases."
if (isUnreleasedIncluded()) {
logger.error("Remove 'Unreleased' in CHANGELOG.")
} else {
dependsOn publishCurseForge, 'modrinth', 'githubRelease'
}
}
boolean isUnreleasedIncluded() {
def changelogFile = file("CHANGELOG.md")
if (changelogFile.exists()) {
def changelogContent = changelogFile.text
return changelogContent.contains("Unreleased")
}
return false
}