-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
164 lines (136 loc) · 5.51 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "2.1.0"
kotlin("plugin.serialization") version "2.1.0"
id("com.google.devtools.ksp") version "2.1.0-1.0.29" apply false
id("fabric-loom") version "1.9-SNAPSHOT" apply false
id("net.neoforged.moddev") version "2.0.74" apply false
id("com.modrinth.minotaur") version "2.+"
id("me.modmuss50.mod-publish-plugin") version "0.8.3"
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
`maven-publish`
}
repositories {
mavenCentral()
}
val minecraft_version: String by project.properties
val parchment_minecraft: String by rootProject.properties
val parchment_version: String by rootProject.properties
val mod_id: String by rootProject.properties
val mod_name: String by rootProject.properties
val mod_description: String by rootProject.properties
val mod_version: String by rootProject.properties
val mod_author: String by rootProject.properties
val fabric_loader_version: String by rootProject.properties
val fabric_version: String by rootProject.properties
val flk_version: String by rootProject.properties
val minecraft_version_range: String by rootProject.properties
val neoforge_version: String by rootProject.properties
val kff_version: String by rootProject.properties
val kff_loader_version_range: String by rootProject.properties
val credits: String by rootProject.properties
val cloth_config_version: String by rootProject.properties
val license: String by rootProject.properties
val java_version: String by rootProject.properties
subprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
apply(plugin = "com.google.devtools.ksp")
apply(plugin = "maven-publish")
group = rootProject.property("group").toString()
base.archivesName = "$mod_id-${path.replace(":", "")}"
version = mod_version
java {
withSourcesJar()
}
repositories {
mavenCentral()
maven("https://maven.wiredtomato.net/snapshots")
maven("https://maven.parchmentmc.org")
maven("https://maven.shedaniel.me/")
}
dependencies {
if (!projectDir.path.contains("deplatformed")) {
implementation(project(":deplatformed-api"))
"ksp"(project(":deplatformed-ksp"))
}
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(java_version.toInt())
}
withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.fromTarget(java_version)
}
}
processResources {
val propertyMap = mapOf(
"version" to project.version,
"mod_id" to mod_id,
"mod_name" to mod_name,
"mod_description" to mod_description,
"mod_author" to mod_author,
"license" to license,
"fabric_loader_version" to fabric_loader_version,
"flk_version" to flk_version,
"minecraft_version" to minecraft_version,
"java_version" to java_version,
"kff_version" to kff_version,
"kff_loader_version_range" to kff_loader_version_range,
"neoforge_version" to neoforge_version,
"minecraft_version_range" to minecraft_version_range,
"cloth_config_version" to cloth_config_version,
"credits" to credits,
)
inputs.properties(propertyMap)
filesMatching(listOf("${mod_id}.mixins.json", "fabric.mod.json", "${mod_id}.fabric.mixins.json", "META-INF/neoforge.mods.toml")) {
expand(propertyMap)
}
}
}
publishing {
if (project.name.contains("deplatformed")) return@publishing
publications {
create<MavenPublication>(mod_id) {
groupId = group.toString()
artifactId = mod_id
version = if (mod_version.contains("beta")) "$mod_version-${project.name}-SNAPSHOT" else "$mod_version-${project.name}"
from(components["java"])
}
repositories {
maven("https://maven.wiredtomato.net/releases") {
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}
}
val modrinthPublish = listOf("fabric", "neoforge")
subprojects {
if (project.name !in modrinthPublish) return@subprojects
project.version = mod_version
apply(plugin = "me.modmuss50.mod-publish-plugin")
if (project.name == "fabric") apply(plugin = "fabric-loom")
publishMods {
file = (if (project.name == "fabric") tasks.getByName("remapJar", org.gradle.jvm.tasks.Jar::class) else tasks.getByName("jar", org.gradle.jvm.tasks.Jar::class)).archiveFile
type = if (mod_version.contains("beta")) BETA else STABLE
modLoaders.add(project.name)
changelog = ""
modrinth {
accessToken = System.getenv("MODRINTH_TOKEN")
projectId = "J8ozcPak"
minecraftVersions.add(minecraft_version)
requires("cloth-config")
if (project.name == "fabric") {
requires("fabric-api", "fabric-language-kotlin")
} else requires("kotlin-for-forge")
}
}
}