-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.gradle
More file actions
268 lines (230 loc) · 8.44 KB
/
build.gradle
File metadata and controls
268 lines (230 loc) · 8.44 KB
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
buildscript {
dependencies {
classpath 'org.kohsuke:github-api:1.135'
}
repositories {
mavenCentral()
}
}
plugins {
id 'fabric-loom' version '1.13.0-bta'
id 'java'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
}
import org.gradle.internal.os.OperatingSystem
import java.nio.file.Files
project.ext.lwjglVersion = "3.3.3"
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.ext.lwjglNatives = "natives-linux"
break
case OperatingSystem.WINDOWS:
project.ext.lwjglNatives = "natives-windows"
break
case OperatingSystem.MAC_OS:
project.ext.lwjglNatives = "natives-macos"
}
group = project.mod_group
archivesBaseName = project.mod_name
version = project.mod_version
loom {
noIntermediateMappings()
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${project.bta_channel}/v${project.bta_version}/manifest.json")
}
repositories {
mavenCentral()
maven {
name = 'Babric'
url = 'https://maven.glass-launcher.net/babric'
}
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'SignalumMavenInfrastructure'
url = 'https://maven.thesignalumproject.net/infrastructure'
}
maven {
name = 'SignalumMavenReleases'
url = 'https://maven.thesignalumproject.net/releases'
}
ivy {
url = "https://github.com/Better-than-Adventure"
patternLayout {
artifact "[organisation]/releases/download/[revision]/[module]-bta-[revision].jar"
m2compatible = true
}
metadataSources { artifact() }
}
ivy {
url = "https://downloads.betterthanadventure.net/bta-client/${project.bta_channel}/"
patternLayout {
artifact "/v[revision]/client.jar"
m2compatible = true
}
metadataSources { artifact() }
}
ivy {
url = "https://downloads.betterthanadventure.net/bta-server/${project.bta_channel}/"
patternLayout {
artifact "/v[revision]/server.jar"
m2compatible = true
}
metadataSources { artifact() }
}
ivy {
url = "https://piston-data.mojang.com"
patternLayout {
artifact "v1/[organisation]/[revision]/[module].jar"
m2compatible = true
}
metadataSources { artifact() }
}
}
dependencies {
// Minecraft
minecraft "::${project.bta_version}"
mappings loom.layered() {}
// Catalyst Modules
include(implementation(project(path: ":catalyst-core", configuration: "namedElements")))
include(implementation(project(path: ":catalyst-energy", configuration: "namedElements")))
include(implementation(project(path: ":catalyst-fluids", configuration: "namedElements")))
include(implementation(project(path: ":catalyst-multiblocks", configuration: "namedElements")))
include(implementation(project(path: ":catalyst-multipart", configuration: "namedElements")))
include(implementation(project(path: ":catalyst-effects", configuration: "namedElements")))
// Fabric loader + b1.7.3
modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" // https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Helper library
modImplementation("turniplabs:halplibe:${project.halplibe_version}")
modImplementation("turniplabs:modmenu-bta:${project.mod_menu_version}")
// Misc required libraries
implementation "org.slf4j:slf4j-api:1.8.0-beta4"
implementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0"
implementation 'com.google.guava:guava:33.0.0-jre'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
var log4jVersion = "2.20.0"
implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}")
implementation("org.apache.logging.log4j:log4j-api:${log4jVersion}")
implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}")
include(implementation("org.apache.commons:commons-lang3:3.12.0"))
modImplementation("legacy-lwjgl3:legacy-lwjgl3:1.0.6")
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
implementation "org.lwjgl:lwjgl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-assimp:$lwjglVersion"
implementation "org.lwjgl:lwjgl-glfw:$lwjglVersion"
implementation "org.lwjgl:lwjgl-openal:$lwjglVersion"
implementation "org.lwjgl:lwjgl-opengl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-stb:$lwjglVersion"
}
java {
withSourcesJar()
}
tasks.withType(JavaCompile).configureEach {
options.release.set 8
}
jar {
from("LICENSE") {
rename { "${it}_${archivesBaseName}" }
}
}
configurations.configureEach {
// Removes LWJGL2 dependencies
exclude group: "org.lwjgl.lwjgl"
}
processResources {
inputs.property "version", version
filesMatching("fabric.mod.json") {
expand "version": version
}
}
remapJar {
destinationDirectory.set(file("$projectDir/jars"))
archiveVersion.set(archiveVersion.get()+"-${bta_version}")
}
publishing {
if(checkVersion(project.mod_group,project.mod_name,project.mod_version)) {
repositories {
maven {
name = "signalumMaven"
url = "https://maven.thesignalumproject.net/releases"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}
publications {
maven(MavenPublication) {
groupId = project.mod_group
artifactId = project.mod_name
version = project.mod_version
from components.java
println("Version ${project.mod_version} of ${project.mod_group}.${project.mod_name} ready for release!")
println("@Mod Updates **Catalyst updated to ${project.mod_version}!**\n\n${Files.readString(java.nio.file.Path.of("${project.projectDir}/CHANGELOG.md"))}\n\n:modrinth:https://modrinth.com/mod/catalyst/version/${project.mod_version}\n:github:<https://github.com/MartinSVK12/catalyst/releases/tag/${project.mod_version}>")
}
}
}
}
import net.fabricmc.loom.task.RemapJarTask
import org.kohsuke.github.GHReleaseBuilder
import org.kohsuke.github.GitHub
import java.nio.file.Files
tasks.register('github') {
doLast {
List<RemapJarTask> ts = List.of(
rootProject.project(":catalyst-core").remapJar as RemapJarTask,
rootProject.project(":catalyst-energy").remapJar as RemapJarTask,
rootProject.project(":catalyst-fluids").remapJar as RemapJarTask,
rootProject.project(":catalyst-multiblocks").remapJar as RemapJarTask,
rootProject.project(":catalyst-multipart").remapJar as RemapJarTask,
rootProject.project(":catalyst-effects").remapJar as RemapJarTask
)
def github = GitHub.connectUsingOAuth(githubToken as String)
def repository = github.getRepository("MartinSVK12/catalyst")
def releaseBuilder = new GHReleaseBuilder(repository, version as String)
releaseBuilder.name("$version")
releaseBuilder.body(Files.readString(java.nio.file.Path.of("${project.projectDir}/CHANGELOG.md")))
releaseBuilder.commitish("7.3")
def release = releaseBuilder.create()
release.uploadAsset(project.file(remapJar.getArchiveFile().get().getAsFile()),"application/java-archive")
if(findProject(":catalyst-all") != null){
ts.forEach {
release.uploadAsset(project.file(it.getArchiveFile().get().getAsFile()),"application/java-archive")
}
}
}
}
modrinth {
token = modrinthToken
projectId = "catalyst" // This can be the project ID or the slug. Either will work!
versionName = "Catalyst ${project.mod_version}"
versionNumber = project.mod_version // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = "release" // This is the default -- can also be `beta` or `alpha`
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = ["b1.7.3"] // Must be an array, even with only one version
loaders = ["bta-babric"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
changelog = Files.readString(java.nio.file.Path.of("${project.projectDir}/CHANGELOG.md"))
}
static boolean checkVersion(String group, String name, String version) {
try {
def xml = new URL("https://maven.thesignalumproject.net/releases/${group}/${name}/maven-metadata.xml").text
def metadata = new XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text();
if (versions.contains(version)) {
System.err.println("Version ${version} of ${group}.${name} already exists!")
return false
}
return true
} catch (FileNotFoundException ignored){
return true
}
}