Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 32 additions & 49 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import io.sentry.android.gradle.extensions.SentryPluginExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.internal.jvm.Jvm
import org.jetbrains.changelog.Changelog
import org.jetbrains.gradle.ext.settings
import org.jetbrains.gradle.ext.taskTriggers
Expand All @@ -33,7 +32,6 @@ plugins {
`mcdev-core`
`mcdev-parsing`
`mcdev-publishing`
alias(libs.plugins.sentry) apply (System.getenv("CI") == "true" && System.getenv("NO_SENTRY") != "true")
}

val coreVersion: String by project
Expand All @@ -45,32 +43,32 @@ val testLibs: Configuration by configurations.creating {

group = "com.demonwav.mcdev"

val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create("gradle-tooling-extension", Action<SourceSet> {
val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create("gradle-tooling-extension") {
configurations.named(compileOnlyConfigurationName) {
extendsFrom(gradleToolingExtension)
}
})
}
val gradleToolingExtensionJar = tasks.register<Jar>(gradleToolingExtensionSourceSet.jarTaskName) {
from(gradleToolingExtensionSourceSet.output)
archiveClassifier.set("gradle-tooling-extension")
exclude("META-INF/plugin.xml")
}

val templatesSourceSet: SourceSet = sourceSets.create("templates", Action<SourceSet> {
val templatesSourceSet: SourceSet = sourceSets.create("templates") {
resources {
srcDir("templates")
compileClasspath += sourceSets.main.get().output
}
})
}

val templateSourceSets: List<SourceSet> = (file("templates").listFiles() ?: emptyArray()).mapNotNull { file ->
if (file.isDirectory() && (file.listFiles() ?: emptyArray()).any { it.name.endsWith(".mcdev.template.json") }) {
sourceSets.create("templates-${file.name}", Action<SourceSet> {
sourceSets.create("templates-${file.name}") {
resources {
srcDir(file)
compileClasspath += sourceSets.main.get().output
}
})
}
} else {
null
}
Expand All @@ -83,20 +81,22 @@ val externalAnnotationsJar = tasks.register<Jar>("externalAnnotationsJar") {
}

dependencies {
// Add tools.jar for the JDI API
implementation(files(Jvm.current().toolsJar))

implementation(files(gradleToolingExtensionJar))

implementation(libs.mixinExtras.expressions) {
exclude(group = "org.ow2.asm", module = "asm-debug-all")
}
testLibs(libs.mixinExtras.common)
implementation(libs.jgraphx)

implementation(libs.mappingIo)
implementation(libs.bundles.asm)

implementation(libs.bundles.fuel)
implementation(libs.sentry) {
exclude(group = "org.slf4j")
implementation(libs.bundles.fuel) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "org.jetbrains.kotlinx")
}

intellijPlatform {
Expand All @@ -120,11 +120,13 @@ dependencies {


testFramework(TestFrameworkType.JUnit5)
testFramework(TestFrameworkType.Platform)
testFramework(TestFrameworkType.Plugin.Java)

pluginVerifier()
}

testLibs(libs.test.mockJdk)
testLibs(libs.test.mixin)
testLibs(libs.test.spigotapi)
testLibs(libs.test.bungeecord)
Expand All @@ -142,7 +144,7 @@ dependencies {
testLibs(projects.mixinTestData)

// For non-SNAPSHOT versions (unless Jetbrains fixes this...) find the version with:
// afterEvaluate { println(intellij.ideaDependency.get().buildNumber.substring(intellij.type.get().length + 1)) }
// afterEvaluate { println(intellijPlatform.productInfo.buildNumber) }
gradleToolingExtension(libs.groovy)
gradleToolingExtension(libs.gradleToolingExtension)
gradleToolingExtension(libs.annotations)
Expand All @@ -169,20 +171,28 @@ tasks.patchPluginXml {
changeNotes = changelog.render(Changelog.OutputType.HTML)
}

// Compile classes to be loaded into the Gradle VM to Java 8
// Compile classes to be loaded into the Gradle VM to Java 5 to match Groovy
// This is for maximum compatibility, these classes will be loaded into every Gradle import on all
// projects (not just Minecraft), so we don't want to break that with an incompatible class version.
tasks.named(gradleToolingExtensionSourceSet.compileJavaTaskName, JavaCompile::class) {
options.release = 8
val java7Compiler = javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion.of(11)) }
javaCompiler.set(java7Compiler)
options.release.set(6)
options.bootstrapClasspath = files(java7Compiler.map { it.metadata.installationPath.file("jre/lib/rt.jar") })
options.compilerArgs = listOf("-Xlint:-options")
}
tasks.withType<GroovyCompile>().configureEach {
options.compilerArgs = listOf("-proc:none")
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
}

tasks.processResources {
for (lang in arrayOf("", "_en")) {
from("src/main/resources/messages.MinecraftDevelopment_en_US.properties") {
rename { "messages.MinecraftDevelopment$lang.properties" }
}
}
// These templates aren't allowed to be in a directory structure in the output jar
// But we have a lot of templates that would get real hard to deal with if we didn't have some structure
// So this just flattens out the fileTemplates/j2ee directory in the jar, while still letting us have directories
Expand Down Expand Up @@ -216,7 +226,6 @@ idea {
license {
val endings = listOf("java", "kt", "kts", "groovy", "gradle.kts", "xml", "properties", "html", "flex", "bnf")
exclude("META-INF/plugin.xml") // https://youtrack.jetbrains.com/issue/IDEA-345026
exclude("sentry-debug-meta.properties", "sentry-external-modules.txt")
include(endings.map { "**/*.$it" })

val projectDir = layout.projectDirectory.asFile
Expand Down Expand Up @@ -263,8 +272,8 @@ license {
val generateAtLexer by lexer("AtLexer", "com/demonwav/mcdev/platform/mcp/at/gen")
val generateAtParser by parser("AtParser", "com/demonwav/mcdev/platform/mcp/at/gen")

val generateCtLexer by lexer("CtLexer", "com/demonwav/mcdev/platform/mcp/ct/gen")
val generateCtParser by parser("CtParser", "com/demonwav/mcdev/platform/mcp/ct/gen")
val generateAwLexer by lexer("AwLexer", "com/demonwav/mcdev/platform/mcp/aw/gen")
val generateAwParser by parser("AwParser", "com/demonwav/mcdev/platform/mcp/aw/gen")

val generateNbttLexer by lexer("NbttLexer", "com/demonwav/mcdev/nbt/lang/gen")
val generateNbttParser by parser("NbttParser", "com/demonwav/mcdev/nbt/lang/gen")
Expand All @@ -287,8 +296,8 @@ val generate by tasks.registering {
dependsOn(
generateAtLexer,
generateAtParser,
generateCtLexer,
generateCtParser,
generateAwLexer,
generateAwParser,
generateNbttLexer,
generateNbttParser,
generateLangLexer,
Expand Down Expand Up @@ -333,29 +342,3 @@ tasks.runIde {
// systemProperty("user.language", "fr")
// systemProperty("user.country", "FR")
}

if (System.getenv("CI") == "true" && System.getenv("NO_SENTRY") != "true") {
configure<SentryPluginExtension> {
includeSourceContext = true
includeDependenciesReport = true
autoInstallation {
enabled = false
}

url = "https://sentry.mcdev.io/"
org = "mcdev"
projectName = "mcdev"
authToken = providers.gradleProperty("mcdev.sentry.token")
}

// Wire together some tasks to make Gradle happy
tasks.named("generateSentryBundleIdJava") {
dependsOn(generate)
}
tasks.named("sentryCollectSourcesJava") {
dependsOn(generate)
}
tasks.checkLicenseMain {
dependsOn(tasks.named("generateSentryDebugMetaPropertiesjava"), tasks.named("collectExternalDependenciesForSentry"))
}
}
6 changes: 4 additions & 2 deletions buildSrc/src/main/kotlin/mcdev-core.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ repositories {

val libs = the<LibrariesForLibs>()
dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.kotlin.reflect)
compileOnly(libs.kotlin.stdlib)
compileOnly(libs.kotlin.reflect)
compileOnly(libs.annotations)
implementation(libs.bundles.coroutines) {
exclude(module = "kotlinx-coroutines-core-jvm")
exclude(group = "org.jetbrains.kotlin")
}

testImplementation(libs.junit.api)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ org.gradle.jvmargs=-Xmx1g

ideaVersionName = 2024.3

coreVersion = 1.8.7
coreVersion = 1.8.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't bump the version in PRs


# Silences a build-time warning because we are bundling our own kotlin library
kotlin.stdlib.default.dependency = false
Expand Down
27 changes: 12 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
[versions]
kotlin = "2.2.20"
coroutines = "1.9.0-RC.2"
kotlin = "2.1.21"
coroutines = "1.10.2"
junit = "5.10.2"
junit-platform = "1.10.2"
asm = "9.6"
fuel = "2.3.1"
licenser = "0.7.5"
licenser = "0.6.1"
changelog = "2.2.0"
intellij-plugin = "2.5.0"
intellij-plugin = "2.6.0"
intellij-plugin-repository-rest-client = "2.0.46"
intellij-ide = "2024.3.5"
intellij-ide = "2025.2"
idea-ext = "1.1.10"
psiPlugin = "243.7768"
psiPlugin = "251.175"

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
intellij-platform = { id = "org.jetbrains.intellij.platform", version.ref = "intellij-plugin" }
idea-ext = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "idea-ext" }
licenser = { id = "net.neoforged.licenser", version.ref = "licenser" }
licenser = { id = "org.cadixdev.licenser", version.ref = "licenser" }
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
sentry = "io.sentry.jvm.gradle:5.12.2"

[libraries]
intellij-plugin-repository-rest-client = { module = "org.jetbrains.intellij:plugin-repository-rest-client", version.ref = "intellij-plugin-repository-rest-client" }
Expand All @@ -29,22 +28,21 @@ kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.re
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }

intellij-plugin = { module = "org.jetbrains.intellij.platform:org.jetbrains.intellij.platform.gradle.plugin", version.ref = "intellij-plugin" }
licenser-plugin = { module = "net.neoforged.licenser:net.neoforged.licenser.gradle.plugin", version.ref = "licenser" }
licenser-plugin = { module = "org.cadixdev.licenser:org.cadixdev.licenser.gradle.plugin", version.ref = "licenser" }
changelog-plugin = { module = "org.jetbrains.changelog:org.jetbrains.changelog.gradle.plugin", version.ref = "changelog" }

coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "coroutines" }

mappingIo = "net.fabricmc:mapping-io:0.2.1"
mixinExtras-expressions = "io.github.llamalad7:mixinextras-expressions:0.0.6"
jgraphx = "com.github.vlsi.mxgraph:jgraphx:4.2.2"
mixinExtras-expressions = "io.github.llamalad7:mixinextras-expressions:0.0.4"

# GrammarKit
jflex-lib = "org.jetbrains.idea:jflex:1.7.0-b7f882a"
jflex-skeleton = "org.jetbrains.idea:jflex:1.7.0-c1fdf11"
grammarKit = "org.jetbrains.idea:grammar-kit:1.5.1"

# Gradle Tooling
gradleToolingExtension = "com.jetbrains.intellij.gradle:gradle-tooling-extension:243-EAP-SNAPSHOT"
gradleToolingExtension = { module = "com.jetbrains.intellij.gradle:gradle-tooling-extension", version = "252.23892.409" }
annotations = "org.jetbrains:annotations:24.0.0"
groovy = "org.codehaus.groovy:groovy:3.0.19"

Expand All @@ -58,12 +56,11 @@ gson = "com.google.code.gson:gson:2.10.1"
fuel = { module = "com.github.kittinunf.fuel:fuel", version.ref = "fuel" }
fuel-coroutines = { module = "com.github.kittinunf.fuel:fuel-coroutines", version.ref = "fuel" }

sentry = "io.sentry:sentry:8.22.0"

# Testing
test-mockJdk = "org.jetbrains.idea:mock-jdk:1.7-4d76c50"
test-mixin = "org.spongepowered:mixin:0.8.5"
test-spigotapi = "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT"
test-bungeecord = "net.md-5:bungeecord-api:1.21-R0.3"
test-bungeecord = "net.md-5:bungeecord-api:1.21-R0.3-SNAPSHOT"
test-spongeapi = "org.spongepowered:spongeapi:7.4.0"
test-fabricloader = "net.fabricmc:fabric-loader:0.15.11"
test-nbt = "com.demonwav.mcdev:all-types-nbt:1.0"
Expand Down
7 changes: 5 additions & 2 deletions src/main/kotlin/creator/buildsystem/gradle-steps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ import com.intellij.psi.PsiFile
import com.intellij.psi.PsiManager
import java.nio.file.Path
import java.util.concurrent.CountDownLatch
import kotlinx.coroutines.runBlocking
import org.jetbrains.plugins.gradle.service.execution.GradleExternalTaskConfigurationType
import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
import org.jetbrains.plugins.gradle.service.project.open.canLinkAndRefreshGradleProject
import org.jetbrains.plugins.gradle.service.project.open.linkAndRefreshGradleProject
import org.jetbrains.plugins.gradle.service.project.open.linkAndSyncGradleProject

val DEFAULT_GRADLE_VERSION = SemanticVersion.release(8, 7)
val GRADLE_VERSION_KEY = Key.create<SemanticVersion>("mcdev.gradleVersion")
Expand Down Expand Up @@ -216,7 +217,9 @@ open class GradleImportStep(parent: NewProjectWizardStep) : AbstractLongRunningS
invokeLater(project.disposed) {
val path = rootDirectory.toAbsolutePath().toString()
if (canLinkAndRefreshGradleProject(path, project, false)) {
linkAndRefreshGradleProject(path, project)
runBlocking {
linkAndSyncGradleProject(project, path)
}
showProgress(project)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ZipTemplateProvider : TemplateProvider {

return panel {
row(MCDevBundle("creator.ui.custom.path.label")) {
val pathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor()
val pathChooserDescriptor = FileChooserDescriptorFactory.singleFile()
.withTitle(MCDevBundle("creator.ui.custom.archive.dialog.title"))
.withFileFilter { it.extension == "zip" }
.apply { description = MCDevBundle("creator.ui.custom.archive.dialog.description") }
Expand Down
Loading