forked from iPortalTeam/ImmersivePortalsMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
262 lines (206 loc) · 6.91 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
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id "me.modmuss50.mod-publish-plugin" version "0.3.5"
// https://modmuss50.github.io/mod-publish-plugin/
}
version = project.mod_version
group = project.maven_group
base {
archivesName = project.archives_base_name
}
repositories {
flatDir {
dirs 'deps'
}
}
version = rootProject.mod_version
repositories {
mavenCentral()
mavenLocal()
maven {
name = 'JitPack'
url = 'https://jitpack.io'
}
// cloth config
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
// for sodium
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
// for parchment
maven {
url = "https://maven.parchmentmc.org"
}
// for cardinal components that gravity changer uses
maven {
name = 'Ladysnake'
url = 'https://maven.ladysnake.org/releases'
}
// geckolib, for testing with portal gun
maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
}
loom {
accessWidenerPath = file("src/main/resources/imm_ptl.accesswidener")
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings() {
setNameSyntheticMembers(false)
}
parchment("org.parchmentmc.data:parchment-1.20.6:2024.06.02")
}
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") {
exclude module: "fabric-gametest-api-v1"
// for now, the gametest module makes client unable to login dev env server
}
modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
include "me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}"
modCompileOnly "maven.modrinth:modmenu:${modmenu_version}"
modLocalRuntime "maven.modrinth:modmenu:${modmenu_version}"
modCompileOnly("com.github.Virtuoel:Pehkui:${pehkui_version}", {
exclude group: "net.fabricmc.fabric-api"
transitive(false)
})
modCompileOnly "${project.sodium_path}"
modCompileOnly "${project.iris_path}"
modCompileOnly("com.github.qouteall:GravityChanger:${gravity_changer_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modApi("com.github.iPortalTeam:DimLib:${dimlib_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
include("com.github.iPortalTeam:DimLib:${dimlib_version}")
// put these into inner mod to reduce duplicate MC jar
if (project.enable_sodium.equals('true')) {
modLocalRuntime "${project.sodium_path}"
}
if (project.enable_iris.equals('true')) {
modLocalRuntime "${project.iris_path}"
implementation "org.anarres:jcpp:1.4.14" // for iris
implementation 'io.github.douira:glsl-transformer:2.0.0-pre13' // for iris
implementation 'org.antlr:antlr4-runtime:4.11.1' // for iris
}
if (project.enable_pehkui.equals('true')) {
modLocalRuntime("com.github.Virtuoel:Pehkui:${pehkui_version}", {
exclude(group: "net.fabricmc.fabric-api")
})
}
if (project.enable_gravity_changer.equals('true')) {
modLocalRuntime("com.github.qouteall:GravityChanger:${gravity_changer_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
}
if (project.enable_geckolib.equals('true')) {
// for testing portal gun using dev jar
modLocalRuntime('software.bernie.geckolib:geckolib-fabric-1.20:4.2') {
transitive(false)
}
}
if (project.enable_test_mod.equals('true')) {
fileTree(dir: 'deps', include: '*.jar').each {
String baseName = it.name.replace(".jar", "")
String version = "0.1.0"
int split = baseName.lastIndexOf('-')
if (split != -1) {
version = baseName.substring(split + 1)
baseName = baseName.substring(0, split)
}
String name = "testmod:${baseName}:${version}"
System.out.println("Found test mod: " + it.name.replace(".jar", "") + " -> " + name)
modImplementation name
}
}
testImplementation(platform('org.junit:junit-bom:5.10.0'))
testImplementation('org.junit.jupiter:junit-jupiter')
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
// change the output file name
remapJar {
afterEvaluate {
archiveFileName = "${project.archives_base_name}-${project.mod_version}-mc${project.minecraft_version}-fabric.jar"
}
}
jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
// miscellaneous
task printClasspath {
doLast {
// NOTE don't forget to exclude the submod dev jar
configurations.compileClasspath.each { println "\"" + (it.toString().replace("\\", "/")) + "\"," }
}
}
// Enable ZGC: -XX:+UseZGC
// run test when building will slow down the build process
// manually run when needed
//test {
// useJUnitPlatform()
// testLogging {
// events "passed", "skipped", "failed"
// }
//}
publishMods {
file = remapJar.archiveFile
changelog = file("changelog.md").text
type = ALPHA
modLoaders.add("fabric")
displayName = "v${project.mod_version}-mc${project.minecraft_version}"
version = "v${project.mod_version}-mc${project.minecraft_version}"
curseforge {
projectId = "332273"
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add(minecraft_version)
requires {
slug = "fabric-api"
}
}
modrinth {
projectId = "zJpHMkdD"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add(minecraft_version)
requires {
slug = "fabric-api"
}
}
github {
repository = "iPortalTeam/ImmersivePortalsMod"
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = minecraft_version // the branch name is the same as minecraft version
}
}