Skip to content

Commit 632afe4

Browse files
committed
Merge branch '2021.2' into 2021.3
2 parents 56eec96 + 78379fe commit 632afe4

36 files changed

+155
-836
lines changed

build.gradle.kts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ import org.gradle.internal.os.OperatingSystem
1414
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1515

1616
plugins {
17-
kotlin("jvm") version "1.6.10"
17+
kotlin("jvm") version "1.6.20"
1818
java
1919
mcdev
2020
groovy
2121
idea
22-
val ijPluginVersion = if (System.getProperty("mcdev.localdev").toBoolean()) {
23-
"1.1.3"
24-
} else {
25-
"1.3.0"
26-
}
27-
id("org.jetbrains.intellij") version ijPluginVersion
22+
id("org.jetbrains.intellij") version "1.5.2"
2823
id("org.cadixdev.licenser") version "0.6.1"
2924
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
3025
}
@@ -41,9 +36,7 @@ val jflex by configurations
4136
val jflexSkeleton by configurations
4237
val grammarKit by configurations
4338

44-
val gradleToolingExtension: Configuration by configurations.creating {
45-
extendsFrom(idea)
46-
}
39+
val gradleToolingExtension: Configuration by configurations.creating
4740
val testLibs: Configuration by configurations.creating {
4841
isTransitive = false
4942
}
@@ -106,13 +99,13 @@ dependencies {
10699
extension = "nbt"
107100
}
108101
}
109-
testLibs(project(":mixin-test-data"))
102+
testLibs(projects.mixinTestData)
110103

111104
// For non-SNAPSHOT versions (unless Jetbrains fixes this...) find the version with:
112105
// afterEvaluate { println(intellij.ideaDependency.get().buildNumber.substring(intellij.type.get().length + 1)) }
106+
gradleToolingExtension(libs.groovy)
113107
gradleToolingExtension(libs.gradleToolingExtension)
114108
gradleToolingExtension(libs.annotations)
115-
gradleToolingExtension(libs.groovy)
116109

117110
testImplementation(libs.junit.api)
118111
testRuntimeOnly(libs.junit.entine)
@@ -154,7 +147,7 @@ tasks.publishPlugin {
154147
}
155148

156149
tasks.runPluginVerifier {
157-
ideVersions.addAll("IC-2021.3")
150+
ideVersions.addAll("IC-$ideaVersionName")
158151
}
159152

160153
java {
@@ -172,7 +165,7 @@ tasks.withType<JavaCompile>().configureEach {
172165
tasks.withType<KotlinCompile>().configureEach {
173166
kotlinOptions {
174167
jvmTarget = JavaVersion.VERSION_11.toString()
175-
freeCompilerArgs = listOf("-Xjvm-default=enable")
168+
freeCompilerArgs = listOf("-Xjvm-default=all")
176169
}
177170
}
178171

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kotlin.code.style=official
1414
ideaVersion = 2021.3
1515
ideaVersionName = 2021.3
1616

17-
coreVersion = 1.5.18
17+
coreVersion = 1.5.19
1818
downloadIdeaSources = true
1919

2020
pluginTomlVersion = 213.5744.224

gradle/wrapper/gradle-wrapper.jar

285 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Minecraft Development for IntelliJ
3636
</tr>
3737
</table>
3838

39-
Info and Documentation [![Current Release](https://img.shields.io/badge/release-1.5.18-orange.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/8327)
39+
Info and Documentation [![Current Release](https://img.shields.io/badge/release-1.5.19-orange.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/8327)
4040
----------------------
4141

4242
<a href="https://discord.gg/j6UNcfr"><img src="https://i.imgur.com/JXu9C1G.png" height="48px"></img></a>

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ rootProject.name = "MinecraftDev"
1212

1313
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS_FULL
1414

15-
enableFeaturePreview("VERSION_CATALOGS")
15+
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
1616

1717
include("mixin-test-data")

src/main/kotlin/creator/BuildSystemWizardStep.kt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ class BuildSystemWizardStep(private val creator: MinecraftProjectCreator) : Modu
3939
buildSystemBox.removeAllItems()
4040
buildSystemBox.isEnabled = true
4141

42+
val creatorConfig = creator.config ?: return
43+
4244
val types = BuildSystemType.values().filter { type ->
43-
creator.configs.all { type.creatorType.isInstance(it) }
45+
type.creatorType.isInstance(creatorConfig)
4446
}
4547

4648
for (type in types) {
@@ -59,26 +61,7 @@ class BuildSystemWizardStep(private val creator: MinecraftProjectCreator) : Modu
5961

6062
buildSystemBox.selectedIndex = 0
6163

62-
// We prefer Gradle, so if it's included, choose it
63-
// If Gradle is not included, luck of the draw
64-
if (creator.configs.any { it.preferredBuildSystem == BuildSystemType.GRADLE }) {
65-
buildSystemBox.selectedItem = BuildSystemType.GRADLE
66-
return
67-
}
68-
69-
val counts = creator.configs.asSequence()
70-
.mapNotNull { it.preferredBuildSystem }
71-
.groupingBy { it }
72-
.eachCount()
73-
74-
val maxValue = counts.maxByOrNull { it.value }?.value ?: return
75-
counts.asSequence()
76-
.filter { it.value == maxValue }
77-
.map { it.key }
78-
.firstOrNull()
79-
?.let { mostPopularType ->
80-
buildSystemBox.selectedItem = mostPopularType
81-
}
64+
creatorConfig.preferredBuildSystem?.let { buildSystemBox.selectedItem = it }
8265
}
8366

8467
override fun updateDataModel() {

src/main/kotlin/creator/MinecraftModuleWizardStep.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ abstract class MinecraftModuleWizardStep : ModuleWizardStep() {
5757

5858
protected fun basicUpdateStep(
5959
creator: MinecraftProjectCreator,
60-
config: ProjectConfig,
6160
pluginNameField: JTextField,
6261
mainClassField: JTextField
6362
) {
@@ -66,14 +65,6 @@ abstract class MinecraftModuleWizardStep : ModuleWizardStep() {
6665
val name = WordUtils.capitalize(buildSystem.artifactId.replace('-', ' '))
6766
pluginNameField.text = name
6867

69-
if (creator.configs.indexOf(config) != 0) {
70-
pluginNameField.isEditable = false
71-
}
72-
7368
mainClassField.text = generateClassName(buildSystem, name)
74-
75-
if (creator.configs.size > 1) {
76-
mainClassField.text = mainClassField.text + config.type.normalName
77-
}
7869
}
7970
}

src/main/kotlin/creator/MinecraftProjectCreator.kt

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ import com.intellij.openapi.progress.ProgressIndicator
2121
import com.intellij.openapi.progress.ProgressManager
2222
import com.intellij.openapi.progress.Task
2323
import com.intellij.openapi.vfs.VfsUtil
24-
import java.nio.file.Files
2524
import java.nio.file.Path
26-
import java.util.Locale
2725

2826
class MinecraftProjectCreator {
2927

3028
var buildSystem: BuildSystem? = null
3129

32-
val configs = LinkedHashSet<ProjectConfig>()
30+
var config: ProjectConfig? = null
3331

3432
fun create(root: Path, module: Module) {
3533
val build = buildSystem ?: throw IllegalStateException("buildSystem not initialized")
@@ -94,67 +92,16 @@ class MinecraftProjectCreator {
9492
VfsUtil.markDirtyAndRefresh(false, true, true, root.virtualFileOrError)
9593
}
9694

97-
build.configure(configs, root)
95+
val config = this@MinecraftProjectCreator.config ?: return
9896

99-
if (configs.size == 1) {
100-
val config = configs.first()
101-
val log = newLog(config, workLog)
102-
if (!build.buildCreator(config, root, module).getSingleModuleSteps().run(indicator, log)) {
103-
return
104-
}
105-
config.type.type.performCreationSettingSetup(module.project)
106-
CreatorStep.runAllReformats()
107-
} else {
108-
val types = configs.map { it.type }
109-
newLog(build.javaClass.name + "::multiModuleBaseSteps", workLog).let { log ->
110-
if (!build.multiModuleBaseSteps(module, types, root).run(indicator, log)) {
111-
return
112-
}
113-
}
114-
115-
val postMultiModuleAwares = mutableListOf<PostMultiModuleAware>()
116-
117-
for (config in configs) {
118-
val log = newLog(config, workLog)
119-
120-
val dirName = config.type.normalName.lowercase(Locale.ENGLISH)
121-
val newArtifactId = "${build.artifactId}-$dirName"
122-
val dir = Files.createDirectories(root.resolve(newArtifactId))
123-
124-
val newBuild = build.createSub(newArtifactId)
125-
val creator = newBuild.buildCreator(config, dir, module)
126-
if (!creator.getMultiModuleSteps(root).run(indicator, log)) {
127-
return
128-
}
129-
config.type.type.performCreationSettingSetup(module.project)
130-
if (creator is PostMultiModuleAware) {
131-
postMultiModuleAwares += creator
132-
}
133-
}
134-
135-
val commonArtifactId = "${build.artifactId}-common"
136-
val commonDir = Files.createDirectories(root.resolve(commonArtifactId))
137-
val commonBuild = build.createSub(commonArtifactId)
97+
build.configure(config, root)
13898

139-
newLog(commonBuild.javaClass.name + "::multiModuleCommonSteps", workLog).let { log ->
140-
if (!commonBuild.multiModuleCommonSteps(module, commonDir).run(indicator, log)) {
141-
return
142-
}
143-
}
144-
145-
CreatorStep.runAllReformats()
146-
147-
newLog(build.javaClass.name + "::multiModuleBaseFinalizer", workLog).let { log ->
148-
build.multiModuleBaseFinalizer(module, root).run(indicator, log)
149-
}
150-
151-
for (postMultiModuleAware in postMultiModuleAwares) {
152-
val log = newLog(postMultiModuleAware, workLog)
153-
if (!postMultiModuleAware.getPostMultiModuleSteps(root).run(indicator, log)) {
154-
return
155-
}
156-
}
99+
val log = newLog(config, workLog)
100+
if (!build.buildCreator(config, root, module).getSteps().run(indicator, log)) {
101+
return
157102
}
103+
config.type.type.performCreationSettingSetup(module.project)
104+
CreatorStep.runAllReformats()
158105

159106
// Tell IntelliJ about everything we've done
160107
invokeLater {

0 commit comments

Comments
 (0)