Skip to content

Commit a939ad8

Browse files
committed
Merge branch 'mc-1.21.x' into mc-1.21.y
2 parents 995a6e7 + fdae94b commit a939ad8

File tree

36 files changed

+612
-615
lines changed

36 files changed

+612
-615
lines changed

.editorconfig

+12-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ indent_size = 2
2727
[*.yml]
2828
indent_size = 2
2929

30-
[{*.kt,*.kts}]
30+
[*.{kt,kts}]
3131
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
3232
ij_kotlin_continuation_indent_size = 4
3333
ij_kotlin_spaces_around_equality_operators = true
@@ -39,3 +39,14 @@ ij_kotlin_allow_trailing_comma_on_call_site = true
3939
ij_kotlin_method_parameters_wrap = off
4040
ij_kotlin_call_parameters_wrap = off
4141
ij_kotlin_extends_list_wrap = off
42+
43+
ktlint_code_style = intellij_idea
44+
ktlint_standard_class-naming = disabled
45+
ktlint_standard_class-signature = disabled
46+
ktlint_standard_function-naming = disabled
47+
ktlint_standard_no-wildcard-imports = disabled
48+
49+
# FIXME: These two are disable right now as they're over-eager in putting things
50+
# on the same line. We should set max_line_length and handle this properly.
51+
ktlint_standard_function-signature = disabled
52+
ktlint_standard_function-expression-body = disabled

buildSrc/src/main/kotlin/cc-tweaked.forge.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import cc.tweaked.gradle.CCTweakedExtension
88
import cc.tweaked.gradle.CCTweakedPlugin
9-
import cc.tweaked.gradle.IdeaRunConfigurations
109
import cc.tweaked.gradle.MinecraftConfigurations
1110

1211
plugins {

buildSrc/src/main/kotlin/cc-tweaked.java-convention.gradle.kts

+7-14
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ base.archivesName.convention("cc-tweaked-$mcVersion-${project.name}")
2929

3030
java {
3131
toolchain {
32-
languageVersion= CCTweakedPlugin.JAVA_VERSION
32+
languageVersion = CCTweakedPlugin.JAVA_VERSION
3333
}
3434

3535
withSourcesJar()
@@ -93,6 +93,7 @@ sourceSets.all {
9393
check("InvalidBlockTag", CheckSeverity.OFF) // Broken by @cc.xyz
9494
check("InlineMeSuggester", CheckSeverity.OFF) // Minecraft uses @Deprecated liberally
9595
// Too many false positives right now. Maybe we need an indirection for it later on.
96+
check("AssignmentExpression", CheckSeverity.OFF) // I'm a bad person.
9697
check("ReferenceEquality", CheckSeverity.OFF)
9798
check("EnumOrdinal", CheckSeverity.OFF) // For now. We could replace most of these with EnumMap.
9899
check("OperatorPrecedence", CheckSeverity.OFF) // For now.
@@ -121,7 +122,6 @@ tasks.compileTestJava {
121122
}
122123
}
123124

124-
125125
tasks.withType(JavaCompile::class.java).configureEach {
126126
options.encoding = "UTF-8"
127127
}
@@ -170,7 +170,7 @@ tasks.test {
170170

171171
tasks.withType(JacocoReport::class.java).configureEach {
172172
reports.xml.required = true
173-
reports.html.required =true
173+
reports.html.required = true
174174
}
175175

176176
project.plugins.withType(CCTweakedPlugin::class.java) {
@@ -194,30 +194,23 @@ spotless {
194194
fun FormatExtension.defaults() {
195195
endWithNewline()
196196
trimTrailingWhitespace()
197-
indentWithSpaces(4)
197+
leadingTabsToSpaces(4)
198198
}
199199

200200
java {
201201
defaults()
202+
importOrder("", "javax|java", "\\#")
202203
removeUnusedImports()
203204
}
204205

205-
val ktlintConfig = mapOf(
206-
"ktlint_standard_no-wildcard-imports" to "disabled",
207-
"ktlint_standard_class-naming" to "disabled",
208-
"ktlint_standard_function-naming" to "disabled",
209-
"ij_kotlin_allow_trailing_comma" to "true",
210-
"ij_kotlin_allow_trailing_comma_on_call_site" to "true",
211-
)
212-
213206
kotlinGradle {
214207
defaults()
215-
ktlint().editorConfigOverride(ktlintConfig)
208+
ktlint()
216209
}
217210

218211
kotlin {
219212
defaults()
220-
ktlint().editorConfigOverride(ktlintConfig)
213+
ktlint()
221214
}
222215
}
223216

buildSrc/src/main/kotlin/cc/tweaked/gradle/ExecTasks.kt

-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
package cc.tweaked.gradle
66

77
import org.gradle.api.file.DirectoryProperty
8-
import org.gradle.api.provider.Property
98
import org.gradle.api.tasks.AbstractExecTask
109
import org.gradle.api.tasks.OutputDirectory
11-
import java.io.File
1210

1311
abstract class ExecToDir : AbstractExecTask<ExecToDir>(ExecToDir::class.java) {
1412
@get:OutputDirectory

buildSrc/src/main/kotlin/cc/tweaked/gradle/IdeaRunConfigurations.kt

+1-89
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import javax.xml.xpath.XPathFactory
2525
* Would be good to PR some (or all) of these changes upstream at some point.
2626
*
2727
* @see net.fabricmc.loom.configuration.ide.idea.IdeaSyncTask
28-
* @see net.minecraftforge.gradle.common.util.runs.IntellijRunGenerator
2928
*/
3029
internal class IdeaRunConfigurations(project: Project) {
3130
private val rootProject = project.rootProject
@@ -35,33 +34,16 @@ internal class IdeaRunConfigurations(project: Project) {
3534
private val writer = TransformerFactory.newInstance().newTransformer()
3635

3736
private val ideaDir = rootProject.file(".idea/")
38-
private val buildDir: Lazy<String?> = lazy {
39-
val ideaMisc = ideaDir.resolve("misc.xml")
40-
41-
try {
42-
val doc = Files.newBufferedReader(ideaMisc.toPath()).use {
43-
documentBuilder.parse(InputSource(it))
44-
}
45-
val node =
46-
xpath.evaluate("//component[@name=\"ProjectRootManager\"]/output", doc, XPathConstants.NODE) as Node
47-
val attr = node.attributes.getNamedItem("url") as Attr
48-
attr.value.removePrefix("file://")
49-
} catch (e: Exception) {
50-
LOGGER.error("Failed to find root directory", e)
51-
null
52-
}
53-
}
5437

5538
fun patch() = synchronized(LOCK) {
5639
val runConfigDir = ideaDir.resolve("runConfigurations")
5740
if (!runConfigDir.isDirectory) return
5841

5942
Files.list(runConfigDir.toPath()).use {
6043
for (configuration in it) {
61-
val filename = configuration.fileName.toString();
44+
val filename = configuration.fileName.toString()
6245
when {
6346
filename.endsWith("_fabric.xml") -> patchFabric(configuration)
64-
filename.startsWith("forge_") && filename.endsWith(".xml") -> patchForge(configuration)
6547
else -> {}
6648
}
6749
}
@@ -72,65 +54,6 @@ internal class IdeaRunConfigurations(project: Project) {
7254
setXml("//configuration", "folderName") { "Fabric" }
7355
}
7456

75-
private fun patchForge(path: Path) = withXml(path) {
76-
val configId = path.fileName.toString().removePrefix("forge_").removeSuffix(".xml")
77-
val sourceSet = forgeConfigs[configId]
78-
if (sourceSet == null) {
79-
LOGGER.error("[{}] Cannot map run configuration to a known source set", path)
80-
return@withXml
81-
}
82-
83-
setXml("//configuration", "folderName") { "Forge" }
84-
setXml("//configuration/module", "name") { "${rootProject.name}.forge.$sourceSet" }
85-
86-
if (buildDir.value == null) return@withXml
87-
setXml("//configuration/envs/env[@name=\"MOD_CLASSES\"]", "value") { classpath ->
88-
val classes = classpath!!.split(':')
89-
val newClasses = mutableListOf<String>()
90-
fun appendUnique(x: String) {
91-
if (!newClasses.contains(x)) newClasses.add(x)
92-
}
93-
94-
for (entry in classes) {
95-
if (!entry.contains("/out/")) {
96-
appendUnique(entry)
97-
continue
98-
}
99-
100-
val match = CLASSPATH_ENTRY.matchEntire(entry)
101-
if (match != null) {
102-
val modId = match.groups["modId"]!!.value
103-
val proj = match.groups["proj"]!!.value
104-
var component = match.groups["component"]!!.value
105-
if (component == "production") component = "main"
106-
107-
appendUnique(forgeModEntry(modId, proj, component))
108-
} else {
109-
LOGGER.warn("[{}] Unknown classpath entry {}", path, entry)
110-
appendUnique(entry)
111-
}
112-
}
113-
114-
// Ensure common code is on the classpath
115-
for (proj in listOf("common", "common-api")) {
116-
for (component in listOf("main", "client")) {
117-
appendUnique(forgeModEntry("computercraft", proj, component))
118-
}
119-
}
120-
121-
if (newClasses.any { it.startsWith("cctest%%") }) {
122-
appendUnique(forgeModEntry("cctest", "core", "testFixtures"))
123-
appendUnique(forgeModEntry("cctest", "common", "testFixtures"))
124-
appendUnique(forgeModEntry("cctest", "common", "testMod"))
125-
}
126-
127-
newClasses.joinToString(":")
128-
}
129-
}
130-
131-
private fun forgeModEntry(mod: String, project: String, component: String) =
132-
"$mod%%${buildDir.value}/production/${rootProject.name}.$project.$component"
133-
13457
private fun LocatedDocument.setXml(xpath: String, attribute: String, value: (String?) -> String) {
13558
val node = this@IdeaRunConfigurations.xpath.evaluate(xpath, document, XPathConstants.NODE) as Node?
13659
if (node == null) {
@@ -159,16 +82,5 @@ internal class IdeaRunConfigurations(project: Project) {
15982
companion object {
16083
private val LOGGER = Logging.getLogger(IdeaRunConfigurations::class.java)
16184
private val LOCK = Any()
162-
163-
private val CLASSPATH_ENTRY =
164-
Regex("(?<modId>[a-z]+)%%\\\$PROJECT_DIR\\\$/projects/(?<proj>[a-z-]+)/out/(?<component>\\w+)/(?<type>[a-z]+)\$")
165-
166-
private val forgeConfigs = mapOf(
167-
"runClient" to "client",
168-
"runData" to "main",
169-
"runGameTestServer" to "testMod",
170-
"runServer" to "main",
171-
"runTestClient" to "testMod",
172-
)
17385
}
17486
}

gradle/libs.versions.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
fabric-api = "0.118.0+1.21.4"
1111
fabric-loader = "0.16.10"
1212
neoForge = "21.4.101-beta"
13-
neoForgeSpi = "8.0.1"
13+
neoMergeTool = "2.0.0"
1414
mixin = "0.8.5"
1515
parchment = "2024.12.07"
1616
parchmentMc = "1.21.4"
@@ -59,20 +59,20 @@ jmh = "1.37"
5959

6060
# Build tools
6161
cctJavadoc = "1.8.4"
62-
checkstyle = "10.21.2"
63-
errorProne-core = "2.36.0"
62+
checkstyle = "10.21.4"
63+
errorProne-core = "2.37.0"
6464
errorProne-plugin = "4.1.0"
65-
fabric-loom = "1.10.3"
65+
fabric-loom = "1.10.4"
6666
githubRelease = "2.5.2"
6767
gradleVersions = "0.50.0"
6868
ideaExt = "1.1.7"
69-
illuaminate = "0.1.0-74-gf1551d5"
69+
illuaminate = "0.1.0-83-g1131f68"
7070
lwjgl = "3.3.3"
7171
minotaur = "2.8.7"
72-
modDevGradle = "2.0.74"
73-
nullAway = "0.12.3"
72+
modDevGradle = "2.0.78"
73+
nullAway = "0.12.4"
7474
shadow = "8.3.1"
75-
spotless = "6.23.3"
75+
spotless = "7.0.2"
7676
taskTree = "2.1.1"
7777
teavm = "0.11.0-SQUID.1"
7878
vanillaExtract = "0.2.1"
@@ -87,7 +87,7 @@ checkerFramework = { module = "org.checkerframework:checker-qual", version.ref =
8787
cobalt = { module = "cc.tweaked:cobalt", version.ref = "cobalt" }
8888
commonsCli = { module = "commons-cli:commons-cli", version.ref = "commonsCli" }
8989
fastutil = { module = "it.unimi.dsi:fastutil", version.ref = "fastutil" }
90-
neoForgeSpi = { module = "net.neoforged:neoforgespi", version.ref = "neoForgeSpi" }
90+
neoMergeTool = { module = "net.neoforged:mergetool", version.ref = "neoMergeTool" }
9191
guava = { module = "com.google.guava:guava", version.ref = "guava" }
9292
jetbrainsAnnotations = { module = "org.jetbrains:annotations", version.ref = "jetbrainsAnnotations" }
9393
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }

0 commit comments

Comments
 (0)