Skip to content

Commit 327ca88

Browse files
committed
Port to 1.21
1 parent 0bc727c commit 327ca88

File tree

18 files changed

+301
-385
lines changed

18 files changed

+301
-385
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import com.blamejared.clumps.gradle.Properties
2-
import com.blamejared.clumps.gradle.Versions
1+
import com.blamejared.Properties
2+
import com.blamejared.Versions
33
import com.blamejared.gradle.mod.utils.GMUtils
44
import com.diluv.schoomp.Webhook
55
import com.diluv.schoomp.message.Message

buildSrc/build.gradle.kts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,3 @@ dependencies {
1818
implementation(group = "com.modrinth.minotaur", name = "Minotaur", version = "2.+")
1919
implementation(group = "com.diluv.schoomp", name= "Schoomp", version="1.2.6")
2020
}
21-
22-
gradlePlugin {
23-
plugins {
24-
create("default") {
25-
id = "com.blamejared.clumps.default"
26-
implementationClass = "com.blamejared.clumps.gradle.DefaultPlugin"
27-
}
28-
create("loader") {
29-
id = "com.blamejared.clumps.loader"
30-
implementationClass = "com.blamejared.clumps.gradle.LoaderPlugin"
31-
}
32-
}
33-
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import com.blamejared.Properties
2+
import com.blamejared.Versions
3+
import com.blamejared.gradle.mod.utils.GMUtils
4+
import org.gradle.jvm.tasks.Jar
5+
import java.nio.charset.StandardCharsets
6+
7+
plugins {
8+
base
9+
`java-library`
10+
idea
11+
`maven-publish`
12+
}
13+
14+
base.archivesName.set("${Properties.NAME}-${project.name.lowercase()}-${Versions.MINECRAFT}")
15+
version = GMUtils.updatingVersion(Versions.MOD)
16+
group = Properties.GROUP
17+
18+
java {
19+
toolchain.languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_21.majorVersion))
20+
withSourcesJar()
21+
withJavadocJar()
22+
}
23+
24+
@Suppress("UnstableApiUsage")
25+
repositories {
26+
mavenCentral()
27+
maven("https://maven.blamejared.com/") {
28+
name = "BlameJared"
29+
content {
30+
includeGroupAndSubgroups("com.blamejared")
31+
includeGroupAndSubgroups("mezz.jei")
32+
includeGroupAndSubgroups("com.faux")
33+
includeGroupAndSubgroups("org.openzen")
34+
}
35+
}
36+
maven("https://repo.spongepowered.org/repository/maven-public/") {
37+
name = "Sponge"
38+
content {
39+
includeGroupAndSubgroups("org.spongepowered")
40+
}
41+
}
42+
maven("https://maven.parchmentmc.org/") {
43+
name = "ParchmentMC"
44+
content {
45+
includeGroupAndSubgroups("org.parchmentmc")
46+
}
47+
}
48+
}
49+
50+
setOf("apiElements", "runtimeElements", "sourcesElements", "javadocElements").forEach { it: String ->
51+
configurations.getByName(it).outgoing {
52+
capability("$group:${base.archivesName.get()}:$version")
53+
capability("$group:${Properties.MODID}-${project.name}-${Versions.MINECRAFT}:$version")
54+
capability("$group:${Properties.MODID}:$version")
55+
}
56+
publishing.publications {
57+
if (this is MavenPublication) {
58+
this.suppressPomMetadataWarningsFor(it)
59+
}
60+
}
61+
}
62+
63+
tasks {
64+
named<JavaCompile>("compileJava").configure {
65+
options.encoding = StandardCharsets.UTF_8.toString()
66+
options.release.set(Versions.JAVA.toInt())
67+
}
68+
named<Javadoc>("javadoc").configure {
69+
options {
70+
encoding = StandardCharsets.UTF_8.toString()
71+
// Javadoc defines this specifically as StandardJavadocDocletOptions
72+
// but only has a getter for MinimalJavadocOptions, but let's just make sure to be safe
73+
if (this is StandardJavadocDocletOptions) {
74+
addStringOption("Xdoclint:none", "-quiet")
75+
}
76+
}
77+
}
78+
named<ProcessResources>("processResources").configure {
79+
val properties = mapOf(
80+
"version" to project.version,
81+
"MOD" to Versions.MOD,
82+
"JAVA" to Versions.JAVA,
83+
"MINECRAFT" to Versions.MINECRAFT,
84+
"FABRIC_LOADER" to Versions.FABRIC_LOADER,
85+
"FABRIC" to Versions.FABRIC,
86+
"FORGE" to Versions.FORGE,
87+
"FORGE_LOADER" to Versions.FORGE_LOADER,
88+
"NEO_FORGE" to Versions.NEO_FORGE,
89+
"NEO_FORGE_LOADER" to Versions.NEO_FORGE_LOADER,
90+
"GROUP" to Properties.GROUP,
91+
"NAME" to Properties.NAME,
92+
"AUTHOR" to Properties.AUTHOR,
93+
"MODID" to Properties.MODID,
94+
"AVATAR" to Properties.AVATAR,
95+
"CURSE_PROJECT_ID" to Properties.CURSE_PROJECT_ID,
96+
"CURSE_HOMEPAGE" to Properties.CURSE_HOMEPAGE,
97+
"MODRINTH_PROJECT_ID" to Properties.MODRINTH_PROJECT_ID,
98+
"GIT_REPO" to Properties.GIT_REPO,
99+
"DESCRIPTION" to Properties.DESCRIPTION,
100+
"ITEM_ICON" to Properties.ITEM_ICON,
101+
)
102+
inputs.properties(properties)
103+
filesMatching(setOf("fabric.mod.json", "META-INF/mods.toml", "META-INF/neoforge.mods.toml", "pack.mcmeta")) {
104+
expand(properties)
105+
}
106+
}
107+
named<Jar>("jar").configure {
108+
from(project.rootProject.file("LICENSE"))
109+
manifest {
110+
attributes["Specification-Title"] = Properties.NAME
111+
attributes["Specification-Vendor"] = Properties.AUTHOR
112+
attributes["Specification-Version"] = archiveVersion
113+
attributes["Implementation-Title"] = project.name
114+
attributes["Implementation-Version"] = archiveVersion
115+
attributes["Implementation-Vendor"] = Properties.AUTHOR
116+
attributes["Built-On-Java"] = "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})"
117+
attributes["Build-On-Minecraft"] = Versions.MINECRAFT
118+
}
119+
}
120+
}
121+
122+
@Suppress("UnstableApiUsage")
123+
configurations {
124+
val library = register("library")
125+
val lor = register("localOnlyRuntime")
126+
getByName("implementation") {
127+
extendsFrom(library.get())
128+
}
129+
getByName("runtimeClasspath").extendsFrom(lor.get())
130+
}
131+
132+
publishing {
133+
publications {
134+
register<MavenPublication>("mavenJava") {
135+
artifactId = base.archivesName.get()
136+
from(components.getByName("java"))
137+
}
138+
}
139+
repositories {
140+
maven(System.getenv("local_maven_url") ?: "file://${project.projectDir}/repo")
141+
}
142+
}
143+
144+
idea {
145+
module {
146+
excludeDirs.addAll(setOf(project.file("run"), project.file("runs"), project.file("run_server"), project.file("run_client"), project.file("run_game_test")))
147+
}
148+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import com.blamejared.Properties
2+
import com.blamejared.Versions
3+
import org.gradle.jvm.tasks.Jar
4+
5+
plugins {
6+
id("blamejared-java-conventions")
7+
id("com.blamejared.gradle-mod-utils")
8+
id("com.modrinth.minotaur")
9+
id("net.darkhax.curseforgegradle")
10+
}
11+
12+
configurations {
13+
register("commonJava") {
14+
isCanBeResolved = true
15+
}
16+
register("commonResources") {
17+
isCanBeResolved = true
18+
}
19+
}
20+
21+
dependencies {
22+
compileOnly(project(":common")) {
23+
capabilities {
24+
requireCapability("$group:${Properties.MODID}")
25+
}
26+
}
27+
"commonJava"(project(path = ":common", configuration = "commonJava"))
28+
"commonResources"(project(path = ":common", configuration = "commonResources"))
29+
}
30+
31+
tasks {
32+
named<JavaCompile>("compileJava").configure {
33+
dependsOn(configurations.getByName("commonJava"))
34+
source(configurations.getByName("commonJava"))
35+
}
36+
37+
named<ProcessResources>("processResources").configure {
38+
dependsOn(configurations.getByName("commonResources"))
39+
from(configurations.getByName("commonResources"))
40+
}
41+
42+
named<Javadoc>("javadoc").configure {
43+
dependsOn(configurations.getByName("commonJava"))
44+
source(configurations.getByName("commonJava"))
45+
}
46+
47+
named<Jar>("sourcesJar") {
48+
dependsOn(configurations.getByName("commonJava"))
49+
dependsOn(configurations.getByName("commonResources"))
50+
from(configurations.getByName("commonJava"))
51+
from(configurations.getByName("commonResources"))
52+
}
53+
54+
}
55+
56+
versionTracker {
57+
mcVersion.set(Versions.MINECRAFT)
58+
homepage.set(Properties.CURSE_HOMEPAGE)
59+
author.set(Properties.AUTHOR)
60+
projectName.set(Properties.NAME)
61+
}

buildSrc/src/main/kotlin/com/blamejared/clumps/gradle/Properties.kt renamed to buildSrc/src/main/kotlin/com/blamejared/Properties.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.blamejared.clumps.gradle
1+
package com.blamejared
22

33
object Properties {
44
const val GROUP = "com.blamejared.clumps"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.blamejared
2+
3+
object Versions {
4+
const val MOD = "18.0.0"
5+
const val JAVA = "21"
6+
const val MINECRAFT = "1.21"
7+
const val FABRIC_LOADER = "0.15.11"
8+
const val FABRIC = "0.100.1+1.21"
9+
const val FORGE = "49.0.19" // 1.20.4
10+
const val FORGE_LOADER = "[49,)" // 1.20.4
11+
const val NEO_FORGE = "21.0.0-beta"
12+
const val NEO_FORGE_LOADER= "[4,)"
13+
}

0 commit comments

Comments
 (0)