-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
238 lines (195 loc) · 6.29 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
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'idea'
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
id 'net.neoforged.moddev' version '2.0.76'
id "me.modmuss50.mod-publish-plugin" version "0.8.3"
}
group = 'dev.ftb.mods'
version = '21.1'
def buildNumber = project.providers.environmentVariable("BUILD_NUMBER").getOrElse("0-dev.1")
version = version + "." + buildNumber
base {
archivesName = mod_id
}
apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/publishing.gradle"
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
neoForge {
version = project.mod_loader_version
parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
client()
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
logLevel = org.slf4j.event.Level.DEBUG
}
}
mods {
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}
configurations {
runtimeClasspath.extendsFrom localRuntime
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenCentral()
maven {
url = "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
url = "https://maven.ftb.dev/releases"
content {
includeGroup("dev.ftb.mods")
includeGroup("net.rocketplatform.game.client.mod")
}
}
maven {
url = "https://maven.architectury.dev"
content {
includeGroup("dev.architectury")
}
}
// flatfile libs
flatDir(dir: 'libs')
}
dependencies {
implementation "curse.maven:bisecthosting-server-integration-menu-neoforge-1084468:${bisecthosting_version}"
implementation "net.rocketplatform.game.client.mod:rgp-client:${ftb_worlds_version}+mc${minecraft_version}"
runtimeOnly "dev.ftb.mods:ftb-library-neoforge:${ftb_library_version}"
implementation "curse.maven:fancymenu-367706:${fancy_menu_version}"
// Deps
runtimeOnly "curse.maven:konkrete-410295:${fancy_menu_konkrete_version}"
runtimeOnly "curse.maven:melody-938643:${fancy_menu_melody_version}"
}
processResources {
var replaceProperties = [
mod_version: project.version,
minecraft_version : project.properties.minecraft_version,
minecraft_version_range: project.properties.minecraft_version_range,
neo_version : project.properties.mod_loader_version,
neo_version_range : project.properties.mod_loader_version_range,
loader_version_range : project.properties.loader_version_range,
]
inputs.properties replaceProperties
filesMatching('META-INF/neoforge.mods.toml') {
expand replaceProperties
}
}
publishing {
publications {
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
if (ftbPublishing.ftbToken) {
maven {
url ftbPublishing.ftbURL
credentials {
username = ftbPublishing.ftbUser
password = ftbPublishing.ftbToken
}
}
}
}
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
def createChangelog() {
def commitHistory = file("COMMIT_HISTORY")
if (!commitHistory.exists()) {
return ""
}
def line = commitHistory.readLines()
Map<String, List<String>> changes = [
"added" : [],
"fixed" : [],
"changed": [],
"removed": [],
]
def reading = false
for (def commit : line) {
if (commit.startsWith("Commit:")) {
reading = true
continue
}
if (commit.startsWith("commit")) {
reading = false
continue
}
if (!reading) {
continue
}
commit = commit.trim()
if (commit.empty) {
continue
}
if (commit.startsWith("feat: ")) changes.get("added") << commit.substring(6)
if (commit.startsWith("fix: ")) changes.get("fixed") << commit.substring(5)
if (commit.startsWith("chore: ")) changes.get("changed") << commit.substring(7)
if (commit.startsWith("refactor: ")) changes.get("changed") << commit.substring(10)
if (commit.startsWith("removed: ")) changes.get("removed") << commit.substring(9)
}
def changelog = ""
def changesKeys = changes.keySet()
for (def key : changesKeys) {
def changeList = changes[key]
if (changeList.size() > 0) {
changelog += "### ${key.capitalize()}\n\n"
for (def change : changeList) {
// Titlecase the change
change = change.substring(0, 1).toUpperCase() + change.substring(1)
change = change.trim()
if (change.split(" ").size() == 1) {
// Skip single word changes as these almost always are not useful
continue
}
changelog += "- $change\n"
}
}
changelog += "\n"
}
def output = changelog.trim()
if (output.empty) {
return "No changelog provided"
}
return output
}
publishMods {
def cfToken = providers.environmentVariable("CURSEFORGE_KEY")
dryRun = !cfToken.isPresent()
changelog = createChangelog()
file = jar.archiveFile
displayName = "[NEOFORGE] FTB Promoter ${project.version}"
modLoaders.add("neoforge")
type = stability == "alpha" ? ALPHA : (stability == "beta" ? BETA : STABLE)
curseforge {
accessToken = cfToken.isPresent() ? cfToken.get() : ""
minecraftVersions.add(minecraft_version)
projectId = curseforge_id
optional('fancymenu')
optional('bisecthosting-server-integration-menu-neoforge')
}
}