Skip to content

Commit d0d3a4b

Browse files
committed
Merge branch '2024.1' into 2024.2
# Conflicts: # build.gradle.kts # gradle.properties # gradle/libs.versions.toml # src/main/kotlin/creator/custom/ResourceBundleTranslator.kt
2 parents 4c3f5ee + e4ae7da commit d0d3a4b

File tree

324 files changed

+18461
-1121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+18461
-1121
lines changed

build.gradle.kts

Lines changed: 50 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,20 @@
1818
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1919
*/
2020

21-
import org.cadixdev.gradle.licenser.header.HeaderStyle
22-
import org.cadixdev.gradle.licenser.tasks.LicenseUpdate
2321
import org.gradle.internal.jvm.Jvm
2422
import org.jetbrains.changelog.Changelog
23+
import org.jetbrains.gradle.ext.settings
24+
import org.jetbrains.gradle.ext.taskTriggers
2525
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
2626
import org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask
27-
import org.jetbrains.intellij.platform.gradle.tasks.PublishPluginTask
28-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
29-
import org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask
30-
import org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask
3127

3228
plugins {
33-
kotlin("jvm") version "1.9.24"
34-
java
35-
mcdev
3629
groovy
37-
idea
38-
id("org.jetbrains.intellij.platform") version "2.0.0"
39-
id("org.cadixdev.licenser")
40-
id("org.jlleitschuh.gradle.ktlint") version "10.3.0"
41-
id("org.jetbrains.changelog") version "2.2.0"
30+
id(libs.plugins.changelog.get().pluginId)
31+
alias(libs.plugins.idea.ext)
32+
`mcdev-core`
33+
`mcdev-parsing`
34+
`mcdev-publishing`
4235
}
4336

4437
val ideaVersionProvider: Provider<String> = providers.gradleProperty("ideaVersion")
@@ -50,21 +43,9 @@ val testLibs: Configuration by configurations.creating {
5043
isTransitive = false
5144
}
5245

53-
group = "com.demonwav.minecraft-dev"
46+
group = "com.demonwav.mcdev"
5447
version = "$ideaVersionName-$coreVersion"
5548

56-
java {
57-
toolchain {
58-
languageVersion.set(JavaLanguageVersion.of(21))
59-
vendor.set(JvmVendorSpec.JETBRAINS)
60-
}
61-
}
62-
kotlin {
63-
jvmToolchain {
64-
languageVersion.set(java.toolchain.languageVersion.get())
65-
}
66-
}
67-
6849
val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create("gradle-tooling-extension") {
6950
configurations.named(compileOnlyConfigurationName) {
7051
extendsFrom(gradleToolingExtension)
@@ -102,50 +83,42 @@ val externalAnnotationsJar = tasks.register<Jar>("externalAnnotationsJar") {
10283
archiveFileName.set("externalAnnotations.jar")
10384
}
10485

105-
repositories {
106-
maven("https://repo.denwav.dev/repository/maven-public/")
107-
maven("https://maven.fabricmc.net/") {
108-
content {
109-
includeModule("net.fabricmc", "mapping-io")
110-
includeModule("net.fabricmc", "fabric-loader")
111-
}
112-
}
113-
mavenCentral()
114-
maven("https://repo.spongepowered.org/maven/")
115-
116-
intellijPlatform {
117-
defaultRepositories()
118-
}
119-
}
120-
12186
dependencies {
12287
// Add tools.jar for the JDI API
12388
implementation(files(Jvm.current().toolsJar))
12489

90+
implementation(files(gradleToolingExtensionJar))
91+
12592
implementation(libs.mixinExtras.expressions)
12693
testLibs(libs.mixinExtras.common)
12794

128-
// Kotlin
129-
implementation(kotlin("stdlib-jdk8"))
130-
implementation(kotlin("reflect"))
131-
implementation(libs.bundles.coroutines) {
132-
exclude(module = "kotlinx-coroutines-core-jvm")
133-
}
134-
135-
implementation(files(gradleToolingExtensionJar))
136-
13795
implementation(libs.mappingIo)
13896
implementation(libs.bundles.asm)
13997

14098
implementation(libs.bundles.fuel)
14199

142-
jflex(libs.jflex.lib)
143-
jflexSkeleton(libs.jflex.skeleton) {
144-
artifact {
145-
extension = "skeleton"
146-
}
100+
intellijPlatform {
101+
intellijIdeaCommunity(libs.versions.intellij.ide)
102+
103+
// Bundled plugin dependencies
104+
bundledPlugin("com.intellij.java")
105+
bundledPlugin("org.jetbrains.idea.maven")
106+
bundledPlugin("com.intellij.gradle")
107+
bundledPlugin("org.intellij.groovy")
108+
bundledPlugin("ByteCodeViewer")
109+
bundledPlugin("org.intellij.intelliLang")
110+
bundledPlugin("com.intellij.properties")
111+
112+
// Optional dependencies
113+
bundledPlugin("org.jetbrains.kotlin")
114+
bundledPlugin("org.toml.lang")
115+
bundledPlugin("org.jetbrains.plugins.yaml")
116+
117+
testFramework(TestFrameworkType.JUnit5)
118+
testFramework(TestFrameworkType.Plugin.Java)
119+
120+
pluginVerifier()
147121
}
148-
grammarKit(libs.grammarKit)
149122

150123
intellijPlatform {
151124
intellijIdeaCommunity(ideaVersionProvider, useInstaller = false)
@@ -168,6 +141,8 @@ dependencies {
168141

169142
testLibs(libs.test.mockJdk)
170143
testLibs(libs.test.mixin)
144+
testLibs(libs.test.spigotapi)
145+
testLibs(libs.test.bungeecord)
171146
testLibs(libs.test.spongeapi) {
172147
artifact {
173148
classifier = "shaded"
@@ -186,37 +161,6 @@ dependencies {
186161
gradleToolingExtension(libs.groovy)
187162
gradleToolingExtension(libs.gradleToolingExtension)
188163
gradleToolingExtension(libs.annotations)
189-
190-
testImplementation(libs.junit.api)
191-
testRuntimeOnly(libs.junit.entine)
192-
testRuntimeOnly(libs.junit.platform.launcher)
193-
}
194-
195-
val artifactType = Attribute.of("artifactType", String::class.java)
196-
val filtered = Attribute.of("filtered", Boolean::class.javaObjectType)
197-
198-
dependencies {
199-
attributesSchema {
200-
attribute(filtered)
201-
}
202-
artifactTypes.getByName("jar") {
203-
attributes.attribute(filtered, false)
204-
}
205-
206-
registerTransform(Filter::class) {
207-
from.attribute(filtered, false).attribute(artifactType, "jar")
208-
to.attribute(filtered, true).attribute(artifactType, "jar")
209-
210-
parameters {
211-
ideaVersion.set(providers.gradleProperty("ideaVersion"))
212-
ideaVersionName.set(providers.gradleProperty("ideaVersionName"))
213-
depsFile.set(layout.projectDirectory.file(".gradle/intellij-deps.json"))
214-
}
215-
}
216-
}
217-
218-
configurations.compileClasspath {
219-
attributes.attribute(filtered, true)
220164
}
221165

222166
changelog {
@@ -226,10 +170,7 @@ changelog {
226170
}
227171

228172
intellijPlatform {
229-
sandboxContainer.set(layout.projectDirectory.dir(".sandbox"))
230-
231-
instrumentCode = false
232-
buildSearchableOptions = false
173+
projectName = "Minecraft Development"
233174

234175
pluginVerification {
235176
ides {
@@ -243,31 +184,6 @@ tasks.patchPluginXml {
243184
changeNotes = changelog.render(Changelog.OutputType.HTML)
244185
}
245186

246-
tasks.withType<PublishPluginTask> {
247-
// Build numbers are used for
248-
properties["buildNumber"]?.let { buildNumber ->
249-
project.version = "${project.version}-$buildNumber"
250-
}
251-
properties["mcdev.deploy.token"]?.let { deployToken ->
252-
token.set(deployToken.toString())
253-
}
254-
channels.add(properties["mcdev.deploy.channel"]?.toString() ?: "Stable")
255-
}
256-
257-
tasks.withType<JavaCompile>().configureEach {
258-
options.encoding = "UTF-8"
259-
options.compilerArgs = listOf("-proc:none")
260-
options.release.set(21)
261-
}
262-
263-
tasks.withType<KotlinCompile>().configureEach {
264-
kotlinOptions {
265-
jvmTarget = "21"
266-
freeCompilerArgs = listOf("-Xjvm-default=all")
267-
kotlinDaemonJvmArguments.add("-Xmx2G")
268-
}
269-
}
270-
271187
// Compile classes to be loaded into the Gradle VM to Java 5 to match Groovy
272188
// This is for maximum compatibility, these classes will be loaded into every Gradle import on all
273189
// projects (not just Minecraft), so we don't want to break that with an incompatible class version.
@@ -303,7 +219,6 @@ tasks.processResources {
303219

304220
tasks.test {
305221
dependsOn(tasks.jar, testLibs)
306-
useJUnitPlatform()
307222

308223
testLibs.resolvedConfiguration.resolvedArtifacts.forEach {
309224
systemProperty("testLibs.${it.name}", it.file.absolutePath)
@@ -318,26 +233,22 @@ tasks.test {
318233
}
319234

320235
idea {
321-
module {
322-
generatedSourceDirs.add(file("build/gen"))
323-
excludeDirs.add(intellijPlatform.sandboxContainer.get().asFile)
324-
isDownloadJavadoc = true
325-
isDownloadSources = true
326-
}
236+
project.settings.taskTriggers.afterSync("generate")
327237
}
328238

329239
license {
330-
header.set(resources.text.fromFile(file("copyright.txt")))
331-
style["flex"] = HeaderStyle.BLOCK_COMMENT.format
332-
style["bnf"] = HeaderStyle.BLOCK_COMMENT.format
333-
334240
val endings = listOf("java", "kt", "kts", "groovy", "gradle.kts", "xml", "properties", "html", "flex", "bnf")
335241
exclude("META-INF/plugin.xml") // https://youtrack.jetbrains.com/issue/IDEA-345026
336242
include(endings.map { "**/*.$it" })
337243

338-
exclude("com/demonwav/mcdev/platform/mixin/invalidInjectorMethodSignature/*.java")
244+
val projectDir = layout.projectDirectory.asFile
245+
exclude {
246+
it.file.toRelativeString(projectDir)
247+
.replace("\\", "/")
248+
.startsWith("src/test/resources")
249+
}
339250

340-
this.tasks {
251+
tasks {
341252
register("gradle") {
342253
files.from(
343254
fileTree(project.projectDir) {
@@ -354,6 +265,14 @@ license {
354265
},
355266
)
356267
}
268+
register("mixinTestData") {
269+
files.from(
270+
project.fileTree(project.projectDir.resolve("mixin-test-data")) {
271+
include("**/*.java", "**/*.kts")
272+
exclude("**/build/**")
273+
},
274+
)
275+
}
357276
register("grammars") {
358277
files.from(project.fileTree("src/main/grammars"))
359278
}
@@ -363,19 +282,6 @@ license {
363282
}
364283
}
365284

366-
ktlint {
367-
disabledRules.add("filename")
368-
}
369-
tasks.withType<BaseKtLintCheckTask>().configureEach {
370-
workerMaxHeapSize.set("512m")
371-
}
372-
373-
tasks.register("format") {
374-
group = "minecraft"
375-
description = "Formats source code according to project style"
376-
dependsOn(tasks.withType<LicenseUpdate>(), tasks.withType<KtLintFormatTask>())
377-
}
378-
379285
val generateAtLexer by lexer("AtLexer", "com/demonwav/mcdev/platform/mcp/at/gen")
380286
val generateAtParser by parser("AtParser", "com/demonwav/mcdev/platform/mcp/at/gen")
381287

@@ -420,12 +326,6 @@ sourceSets.main { java.srcDir(generate) }
420326
// Remove gen directory on clean
421327
tasks.clean { delete(generate) }
422328

423-
tasks.register("cleanSandbox", Delete::class) {
424-
group = "intellij"
425-
description = "Deletes the sandbox directory."
426-
delete(layout.projectDirectory.dir(".sandbox"))
427-
}
428-
429329
tasks.withType<PrepareSandboxTask> {
430330
pluginJar.set(tasks.jar.get().archiveFile)
431331
from(externalAnnotationsJar) {

buildSrc/build.gradle.kts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,30 @@
1818
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1919
*/
2020

21+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22+
2123
plugins {
2224
`kotlin-dsl`
2325
}
2426

27+
tasks.withType<JavaCompile>().configureEach {
28+
options.release.set(8)
29+
}
30+
tasks.withType<KotlinCompile>().configureEach {
31+
kotlinOptions.jvmTarget = "1.8"
32+
}
33+
2534
repositories {
2635
mavenCentral()
2736
gradlePluginPortal()
2837
}
2938

3039
dependencies {
31-
implementation("com.google.code.gson:gson:2.9.1")
32-
implementation("org.cadixdev.licenser:org.cadixdev.licenser.gradle.plugin:0.6.1")
40+
// hack for version catalogs
41+
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
42+
implementation(libs.gson)
43+
implementation(libs.kotlin.plugin)
44+
implementation(libs.intellij.plugin)
45+
implementation(libs.licenser.plugin)
46+
implementation(libs.changelog.plugin)
3347
}

buildSrc/settings.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@
1919
*/
2020

2121
rootProject.name = "buildSrc"
22+
23+
dependencyResolutionManagement {
24+
versionCatalogs {
25+
create("libs") {
26+
from(files("../gradle/libs.versions.toml"))
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)