forked from badasintended/cpas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
107 lines (86 loc) · 2.79 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
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseRelation
plugins {
id("fabric-loom").version("1.4.+")
id("com.matthewprenger.cursegradle").version("1.4.0")
}
val env: Map<String, String> = System.getenv()
version = env["MOD_VERSION"] ?: "local"
allprojects {
apply(plugin = "fabric-loom")
version = rootProject.version
dependencies {
minecraft("com.mojang:minecraft:${rootProp["minecraft"]}")
mappings("net.fabricmc:yarn:${rootProp["yarn"]}:v2")
modImplementation("net.fabricmc:fabric-loader:${rootProp["loader"]}")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand("version" to project.version)
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
tasks.jar {
from(rootProject.file("includes"))
}
}
subprojects.forEach {
tasks.remapJar {
dependsOn(it.tasks.named("remapJar").get())
}
}
repositories {
maven("https://maven.shedaniel.me")
}
dependencies {
modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:${rootProp["rei"]}")
afterEvaluate {
subprojects.forEach {
implementation(project(path = it.path, configuration = "namedElements"))
include(it)
}
}
}
curseforge {
env["CURSEFORGE_API"]?.let { CURSEFORGE_API ->
apiKey = CURSEFORGE_API
project(closureOf<CurseProject> {
id = prop["cf.projectId"]
releaseType = prop["cf.releaseType"]
changelogType = "markdown"
changelog = "https://github.com/badasintended/cpas/releases/tag/${project.version}"
mainArtifact(tasks["remapJar"], closureOf<CurseArtifact> {
displayName = "[${prop["minecraft"]}] v${project.version}"
})
addGameVersion("Fabric")
prop["cf.gameVersion"].split(", ").forEach {
addGameVersion(it)
}
relations(closureOf<CurseRelation> {
prop.ifPresent("cf.require") { require ->
require.split(", ").forEach {
requiredDependency(it)
}
}
prop.ifPresent("cf.optional") { optional ->
optional.split(", ").forEach {
optionalDependency(it)
}
}
})
afterEvaluate {
uploadTask.dependsOn("build")
}
})
}
}