-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
build.gradle.kts
276 lines (242 loc) · 9.55 KB
/
build.gradle.kts
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import dev.architectury.plugin.ArchitectPluginExtension
import groovy.json.StringEscapeUtils
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.fabricmc.loom.task.RemapJarTask
plugins {
java
id("maven-publish")
id("com.teamresourceful.resourcefulgradle") version "0.0.+"
id("dev.architectury.loom") version "1.6.9999-PR.207+kneelawk" apply false
id("architectury-plugin") version "3.4-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
}
architectury {
val minecraftVersion: String by project
minecraft = minecraftVersion
}
val stationsFile: String = file("stations.json").absolutePath
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "dev.architectury.loom")
apply(plugin = "architectury-plugin")
apply(plugin = "com.github.johnrengelman.shadow")
val minecraftVersion: String by project
val modLoader = project.name
val modId = rootProject.name
val isCommon = modLoader == rootProject.projects.common.name
base {
archivesName.set("$modId-$modLoader-$minecraftVersion")
}
configure<LoomGradleExtensionAPI> {
silentMojangMappingsLicense()
runConfigs {
"client" {
property("adastra.stations", stationsFile)
}
"server" {
property("adastra.stations", stationsFile)
}
}
}
repositories {
mavenCentral()
maven(url = "https://maven.teamresourceful.com/repository/maven-public/")
maven(url = "https://maven.neoforged.net/releases/")
maven(url = "https://maven.firstdarkdev.xyz/snapshots")
maven {
url = uri("https://www.cursemaven.com")
content {
includeGroup("curse.maven")
}
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = uri("https://api.modrinth.com/maven")
}
}
filter {
includeGroup("maven.modrinth")
}
}
}
dependencies {
val mixinExtrasVersion: String by project
val resourcefulLibVersion: String by project
val resourcefulConfigVersion: String by project
val botariumVersion: String by project
val athenaVersion: String by project
val cadmusVersion: String by project
val argonautsVersion: String by project
val jeiVersion: String by project
val reiVersion: String by project
val patchouliVersion: String by project
val shimmerVersion: String by project
"minecraft"("::$minecraftVersion")
@Suppress("UnstableApiUsage")
"mappings"(project.the<LoomGradleExtensionAPI>().layered {
val parchmentVersion: String by project
officialMojangMappings()
parchment(create(group = "org.parchmentmc.data", name = "parchment-1.20.6", version = parchmentVersion))
})
"modApi"(
group = "com.teamresourceful.resourcefullib",
name = "resourcefullib-$modLoader-1.20.5",
version = resourcefulLibVersion
)
"modApi"(
group = "com.teamresourceful.resourcefulconfig",
name = "resourcefulconfig-$modLoader-1.20.5",
version = resourcefulConfigVersion
)
"modApi"(
group = "earth.terrarium.botarium",
name = "botarium-$modLoader-1.20.4",
version = botariumVersion
)
if (isCommon) {
implementation(group = "javazoom", name = "jlayer", version = "1.0.1")
// "modApi"(group = "mezz.jei", name = "jei-$minecraftVersion-common-api", version = jeiVersion)
"modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api", version = reiVersion)
"modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin", version = reiVersion)
implementation(
"annotationProcessor"(
group = "io.github.llamalad7",
name = "mixinextras-common",
version = mixinExtrasVersion
)
)
/*
"modCompileOnly"(group = "earth.terrarium.cadmus", name = "cadmus-$modLoader-$minecraftVersion", version = cadmusVersion) {
isTransitive = false
}
"modCompileOnly"(group = "earth.terrarium.argonauts", name = "argonauts-$modLoader-$minecraftVersion", version = argonautsVersion) {
isTransitive = false
}
*/
} else {
"include"(implementation(group = "javazoom", name = "jlayer", version = "1.0.1"))
/*
"modLocalRuntime"(group = "earth.terrarium.cadmus", name = "cadmus-$modLoader-$minecraftVersion", version = cadmusVersion) {
isTransitive = false
}
"modLocalRuntime"(group = "earth.terrarium.argonauts", name = "argonauts-$modLoader-$minecraftVersion", version = argonautsVersion) {
isTransitive = false
}
modLocalRuntime(group = "mezz.jei", name = "jei-$minecraftVersion-$modLoader", version = jeiVersion) {
isTransitive = false
}
*/
"modLocalRuntime"(
group = "earth.terrarium.athena",
name = "athena-$modLoader-1.20.5",
version = athenaVersion
)
"modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api-$modLoader", version = reiVersion)
"modCompileOnly"(
group = "me.shedaniel",
name = "RoughlyEnoughItems-default-plugin-$modLoader",
version = reiVersion
)
// "modLocalRuntime"(group = "vazkii.patchouli", name = "Patchouli", version = "$minecraftVersion-$patchouliVersion-${modLoader.uppercase()}")
// "modLocalRuntime"(group = "com.lowdragmc.shimmer", name = "Shimmer-$modLoader", version = "$minecraftVersion-$shimmerVersion") { isTransitive = false }
}
}
java {
withSourcesJar()
}
tasks.jar {
archiveClassifier.set("dev")
}
tasks.named<RemapJarTask>("remapJar") {
archiveClassifier.set(null as String?)
}
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
filesMatching(listOf("META-INF/neoforge.mods.toml", "fabric.mod.json")) {
expand("version" to project.version)
}
}
if (!isCommon) {
configure<ArchitectPluginExtension> {
platformSetupLoomIde()
}
val shadowCommon by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}
tasks {
"shadowJar"(ShadowJar::class) {
archiveClassifier.set("dev-shadow")
configurations = listOf(shadowCommon)
exclude(".cache/**") // Remove datagen cache from jar.
exclude("**/adastra/datagen/**") // Remove data gen code from jar.
}
"remapJar"(RemapJarTask::class) {
dependsOn("shadowJar")
inputFile.set(named<ShadowJar>("shadowJar").flatMap { it.archiveFile })
}
}
} else {
sourceSets.main.get().resources.srcDir("src/main/generated/resources")
}
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "$modId-$modLoader-$minecraftVersion"
from(components["java"])
pom {
name.set("Ad Astra $modLoader")
url.set("https://github.com/terrarium-earth/$modId")
scm {
connection.set("git:https://github.com/terrarium-earth/$modId.git")
developerConnection.set("git:https://github.com/terrarium-earth/$modId.git")
url.set("https://github.com/terrarium-earth/$modId")
}
licenses {
license {
name.set("Terrarium Licence (https://gist.github.com/CodexAdrian/4bb2a1868bb2d2a91ca74ea40424e69d)")
}
}
}
}
}
repositories {
maven {
setUrl("https://maven.teamresourceful.com/repository/terrarium/")
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
}
}
}
}
idea {
module {
excludeDirs.add(file("run"))
}
}
}
resourcefulGradle {
templates {
register("embed") {
val minecraftVersion: String by project
val version: String by project
val changelog: String = file("changelog.md").readText(Charsets.UTF_8)
val fabricLink: String? = System.getenv("FABRIC_RELEASE_URL")
val forgeLink: String? = System.getenv("FORGE_RELEASE_URL")
source.set(file("templates/embed.json.template"))
injectedValues.set(
mapOf(
"minecraft" to minecraftVersion,
"version" to version,
"changelog" to StringEscapeUtils.escapeJava(changelog),
"fabric_link" to fabricLink,
"forge_link" to forgeLink,
)
)
}
}
}