Skip to content

Commit

Permalink
Merge branch '2023.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
RedNesto committed Dec 6, 2023
2 parents 32ebb40 + fe08bbf commit b246f71
Show file tree
Hide file tree
Showing 44 changed files with 188 additions and 164 deletions.
25 changes: 5 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.cadixdev.gradle.licenser.header.HeaderStyle
import org.cadixdev.gradle.licenser.tasks.LicenseUpdate
import org.gradle.internal.jvm.Jvm
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.gradle.ext.settings
import org.jetbrains.gradle.ext.taskTriggers
import org.jetbrains.intellij.tasks.PrepareSandboxTask
Expand Down Expand Up @@ -262,7 +261,11 @@ tasks.test {
}
}
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
jvmArgs("--illegal-access=deny")

jvmArgs(
"-Dsun.io.useCanonCaches=false",
"-Dsun.io.useCanonPrefixCache=false",
)
}

idea {
Expand Down Expand Up @@ -387,22 +390,4 @@ tasks.runIde {
tasks.buildSearchableOptions {
// not working atm
enabled = false
// https://youtrack.jetbrains.com/issue/IDEA-210683
jvmArgs(
"--illegal-access=deny",
"--add-exports=java.base/jdk.internal.vm=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.desktop/java.awt.event=ALL-UNNAMED",
"--add-opens=java.desktop/java.awt=ALL-UNNAMED",
"--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED",
"--add-opens=java.desktop/javax.swing=ALL-UNNAMED",
"--add-opens=java.desktop/sun.awt=ALL-UNNAMED",
"--add-opens=java.desktop/sun.font=ALL-UNNAMED",
"--add-opens=java.desktop/sun.swing=ALL-UNNAMED",
)

if (OperatingSystem.current().isMacOsX) {
jvmArgs("--add-opens=java.desktop/com.apple.eawt.event=ALL-UNNAMED")
}
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
# suppress inspection "UnusedProperty" for whole file
kotlin.code.style=official

ideaVersion = 2022.3
ideaVersionName = 2022.3
ideaVersion = 2023.1
ideaVersionName = 2023.1

coreVersion = 1.6.11
downloadIdeaSources = true

pluginTomlVersion = 223.7571.59
pluginTomlVersion = 231.8109.1

# Silences a build-time warning because we are bundling our own kotlin library
kotlin.stdlib.default.dependency = false
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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:223-EAP-SNAPSHOT"
gradleToolingExtension = "com.jetbrains.intellij.gradle:gradle-tooling-extension:231-EAP-SNAPSHOT"
annotations = "org.jetbrains:annotations:23.0.0"
groovy = "org.codehaus.groovy:groovy-all:2.5.18"

Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ rootProject.name = "MinecraftDev"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

include("mixin-test-data")

startParameter.warningMode = WarningMode.All
12 changes: 8 additions & 4 deletions src/main/kotlin/creator/ProjectSetupFinalizerWizardStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import com.intellij.openapi.projectRoots.JavaSdk
import com.intellij.openapi.projectRoots.JavaSdkVersion
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.ui.ValidationInfo
import com.intellij.openapi.ui.validation.AFTER_GRAPH_PROPAGATION
import com.intellij.openapi.ui.validation.DialogValidation
import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED
import com.intellij.ui.JBColor
import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.builder.Placeholder
Expand Down Expand Up @@ -70,11 +70,13 @@ class ProjectSetupFinalizerWizardStep(parent: NewProjectWizardStep) : AbstractNe
}

override fun setupUI(builder: Panel) {
step?.setupUI(builder)
for (step in finalizers) {
step.setupUI(builder)
}
if (finalizers.isNotEmpty()) {
builder.row {
cell(JPanel())
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.validation(
DialogValidation {
finalizers.mapFirstNotNull(ProjectSetupFinalizer::validate)?.let(::ValidationInfo)
Expand All @@ -85,7 +87,9 @@ class ProjectSetupFinalizerWizardStep(parent: NewProjectWizardStep) : AbstractNe
}

override fun setupProject(project: Project) {
step?.setupProject(project)
for (step in finalizers) {
step.setupProject(project)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import com.intellij.ide.wizard.AbstractNewProjectWizardStep
import com.intellij.ide.wizard.NewProjectWizardBaseData
import com.intellij.ide.wizard.NewProjectWizardStep
import com.intellij.openapi.observable.util.bindStorage
import com.intellij.openapi.ui.validation.AFTER_GRAPH_PROPAGATION
import com.intellij.openapi.ui.validation.CHECK_ARTIFACT_ID
import com.intellij.openapi.ui.validation.CHECK_GROUP_ID
import com.intellij.openapi.ui.validation.CHECK_NON_EMPTY
import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED
import com.intellij.openapi.ui.validation.validationErrorIf
import com.intellij.ui.dsl.builder.COLUMNS_MEDIUM
import com.intellij.ui.dsl.builder.Panel
Expand Down Expand Up @@ -72,21 +72,21 @@ class BuildSystemPropertiesStep<ParentStep>(private val parent: ParentStep) : Ab
textField()
.bindText(groupIdProperty)
.columns(COLUMNS_MEDIUM)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.textValidation(CHECK_NON_EMPTY, CHECK_GROUP_ID, nonExampleValidation)
}
row(MCDevBundle("creator.ui.group.artifact_id")) {
textField()
.bindText(artifactIdProperty)
.columns(COLUMNS_MEDIUM)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.textValidation(CHECK_NON_EMPTY, CHECK_ARTIFACT_ID)
}
row(MCDevBundle("creator.ui.group.version")) {
textField()
.bindText(versionProperty)
.columns(COLUMNS_MEDIUM)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.textValidation(versionValidation)
}
}.expanded = true
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/creator/step/AbstractLatentStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.ValidationInfo
import com.intellij.openapi.ui.validation.AFTER_GRAPH_PROPAGATION
import com.intellij.openapi.ui.validation.DialogValidation
import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED
import com.intellij.openapi.util.Disposer
import com.intellij.ui.JBColor
import com.intellij.ui.dsl.builder.Panel
Expand Down Expand Up @@ -108,7 +108,7 @@ abstract class AbstractLatentStep<T>(parent: NewProjectWizardStep) : AbstractNew
val labelValidationText =
MCDevBundle("creator.ui.generic_validation_failure.message", description, errorMessage)
val label = label(labelValidationText)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.validation(DialogValidation { ValidationInfo(labelValidationText) })
label.component.foreground = JBColor.RED
}
Expand Down Expand Up @@ -154,7 +154,7 @@ abstract class AbstractLatentStep<T>(parent: NewProjectWizardStep) : AbstractNew
}
},
)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.validation(
DialogValidation {
ValidationInfo(MCDevBundle("creator.ui.generic_unfinished.message", description))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ abstract class FixedAssetsNewProjectWizardStep(parent: NewProjectWizardStep) : A
throw IOException("Unable to process template", e)
}

val pathStr = "$outputDirectory/${asset.targetFileName}"
val pathStr = "$outputDirectory/${asset.relativePath}"
val path = Path.of(pathStr)
path.parent?.let(NioFiles::createDirectories)
Files.writeString(path, code)
Expand All @@ -136,7 +136,7 @@ abstract class FixedAssetsNewProjectWizardStep(parent: NewProjectWizardStep) : A
private fun generateFile(asset: GeneratorResourceFile): VirtualFile? {
val content = asset.resource.openStream().use { it.readAllBytes() }

val pathStr = "$outputDirectory/${asset.targetFileName}"
val pathStr = "$outputDirectory/${asset.relativePath}"
val path = Path.of(pathStr)
path.parent?.let(NioFiles::createDirectories)
Files.write(path, content)
Expand All @@ -145,7 +145,7 @@ abstract class FixedAssetsNewProjectWizardStep(parent: NewProjectWizardStep) : A
}

private fun generateFile(asset: GeneratorEmptyDirectory): VirtualFile? {
val pathStr = "$outputDirectory/${asset.targetFileName}"
val pathStr = "$outputDirectory/${asset.relativePath}"
val path = Path.of(pathStr)
NioFiles.createDirectories(path)
return VfsUtil.findFile(path, true)
Expand Down Expand Up @@ -183,7 +183,7 @@ sealed class FixedGeneratorAsset {
}

data class GeneratorAssetDelegate(val delegate: GeneratorAsset) : FixedGeneratorAsset() {
override val targetFileName get() = delegate.targetFileName
override val targetFileName get() = delegate.relativePath
}

class GeneratorFile(
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/creator/step/ModIdStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import com.intellij.ide.wizard.AbstractNewProjectWizardStep
import com.intellij.ide.wizard.NewProjectWizardBaseData
import com.intellij.ide.wizard.NewProjectWizardStep
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.validation.AFTER_GRAPH_PROPAGATION
import com.intellij.openapi.ui.validation.CHECK_NON_EMPTY
import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED
import com.intellij.openapi.ui.validation.and
import com.intellij.openapi.ui.validation.validationErrorIf
import com.intellij.openapi.util.Key
Expand Down Expand Up @@ -75,7 +75,7 @@ abstract class AbstractModIdStep(
textField()
.bindText(idProperty)
.columns(COLUMNS_MEDIUM)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.textValidation(CHECK_NON_EMPTY and idValidation)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/creator/step/ModNameStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import com.intellij.ide.wizard.AbstractNewProjectWizardStep
import com.intellij.ide.wizard.NewProjectWizardBaseData
import com.intellij.ide.wizard.NewProjectWizardStep
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.validation.AFTER_GRAPH_PROPAGATION
import com.intellij.openapi.ui.validation.CHECK_NON_EMPTY
import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED
import com.intellij.openapi.util.Key
import com.intellij.ui.dsl.builder.COLUMNS_MEDIUM
import com.intellij.ui.dsl.builder.Panel
Expand All @@ -53,7 +53,7 @@ abstract class AbstractModNameStep(parent: NewProjectWizardStep) : AbstractNewPr
textField()
.bindText(nameProperty)
.columns(COLUMNS_MEDIUM)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
.textValidation(CHECK_NON_EMPTY)
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/creator/step/OptionalSteps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ abstract class AbstractOptionalStringBasedOnProjectNameStep(
value = suggestValue()
}
valueProperty.updateWhenChanged(formatProperty, ::suggestValue)
valueProperty.updateWhenChanged(baseData.nameProperty, ::suggestValue)
valueProperty.updateWhenChanged(baseData!!.nameProperty, ::suggestValue)
formatProperty.updateWhenChanged(valueProperty, ::suggestFormat)
}

private fun suggestValue() = format.replace(PROJECT_NAME_PLACEHOLDER, baseData.name)
private fun suggestValue() = format.replace(PROJECT_NAME_PLACEHOLDER, baseData!!.name)

private fun suggestFormat(): String {
val index = value.indexOf(baseData.name)
val index = value.indexOf(baseData!!.name)
if (index == -1) {
return value
}
if (value.indexOf(baseData.name, startIndex = index + baseData.name.length) != -1) {
if (value.indexOf(baseData!!.name, startIndex = index + baseData!!.name.length) != -1) {
// don't change format if there are multiple instances of the project name
return format
}
return value.replace(baseData.name, PROJECT_NAME_PLACEHOLDER)
return value.replace(baseData!!.name, PROJECT_NAME_PLACEHOLDER)
}

companion object {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/facet/MinecraftFacetDetector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class MinecraftFacetDetector : StartupActivity {
if (m.name.startsWith("SpongeAPI", ignoreCase = true)) {
// We don't want want to add parent modules in module groups
val moduleManager = ModuleManager.getInstance(m.project)
val groupPath = moduleManager.getModuleGroupPath(m)
if (groupPath == null) {
val groupPath = moduleManager.getModuleGrouper(null).getGroupPath(m)
if (groupPath.isEmpty()) {
platformKinds.add(SPONGE_LIBRARY_KIND)
return@forEach true
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/facet/MinecraftFacetEditorTabV2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.builder.Row
import com.intellij.ui.dsl.builder.RowLayout
import com.intellij.ui.dsl.builder.bindSelected
import com.intellij.ui.dsl.builder.enableIf
import com.intellij.ui.dsl.builder.panel
import com.intellij.util.ui.UIUtil
import javax.swing.Icon
Expand Down Expand Up @@ -290,7 +289,7 @@ class MinecraftFacetEditorTabV2(private val configuration: MinecraftFacetConfigu
platform.enabled.apply(enabledCheckbox)
platform.auto.afterChange { _ -> checkAuto(platform.auto, platform.enabled, platform.platform) }
platform.auto.apply(autoCheckbox)
checkBox("").bindSelected(platform.enabled).enableIf(platform.auto.not())
checkBox("").bindSelected(platform.enabled).enabledIf(platform.auto.not())
checkBox("").bindSelected(platform.auto)
}.layout(RowLayout.PARENT_GRID)
}
3 changes: 2 additions & 1 deletion src/main/kotlin/insight/ColorUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.demonwav.mcdev.util.runWriteAction
import com.intellij.openapi.module.ModuleUtilCore
import com.intellij.psi.JVMElementFactories
import com.intellij.psi.PsiType
import com.intellij.psi.PsiTypes
import com.intellij.psi.search.GlobalSearchScope
import java.awt.Color
import java.util.Locale
Expand Down Expand Up @@ -159,7 +160,7 @@ private fun findColorFromCallExpression(
types.size == 1 ->
colorFromSingleArgument(arguments[0])?.let { it to arguments[0] }
// Triple Integer Argument
types.size == 3 && types.all { it == PsiType.INT } ->
types.size == 3 && types.all { it == PsiTypes.intType() } ->
colorFromThreeArguments(arguments)?.let { it to methodExpression }
vectorClasses != null && types.size == 1 -> {
val scope = GlobalSearchScope.allScope(project)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.demonwav.mcdev.insight.findColor
import com.demonwav.mcdev.platform.adventure.AdventureConstants
import com.demonwav.mcdev.platform.adventure.AdventureModuleType
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiType
import com.intellij.psi.PsiTypes
import java.awt.Color
import kotlin.math.roundToInt
import org.jetbrains.uast.UCallExpression
Expand Down Expand Up @@ -85,7 +85,7 @@ fun PsiElement.findAdventureColor(): Pair<Color, UElement>? {
}

val params = call.valueArguments
if (params.size == 1 && params[0].getExpressionType() != PsiType.INT) {
if (params.size == 1 && params[0].getExpressionType() != PsiTypes.intType()) {
return params[0].findAdventureColor()
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/platform/bukkit/creator/bukkit-platforms.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.demonwav.mcdev.util.MinecraftTemplates
import com.demonwav.mcdev.util.MinecraftVersions
import com.demonwav.mcdev.util.SemanticVersion
import com.intellij.openapi.observable.util.bindBooleanStorage
import com.intellij.openapi.ui.validation.AFTER_GRAPH_PROPAGATION
import com.intellij.openapi.ui.validation.WHEN_GRAPH_PROPAGATION_FINISHED
import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.builder.bindSelected

Expand Down Expand Up @@ -77,7 +77,7 @@ class PaperPlatformStep(parent: BukkitPlatformStep) : AbstractBukkitPlatformStep
row("Paper manifest:") {
checkBox("Use paper-plugin.yml")
.bindSelected(usePaperManifestProperty)
.validationRequestor(AFTER_GRAPH_PROPAGATION(propertyGraph))
.validationRequestor(WHEN_GRAPH_PROPAGATION_FINISHED(propertyGraph))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BungeeGradleFilesStep(parent: NewProjectWizardStep) : AbstractLongRunningA
override val description = "Creating Gradle files"

override fun setupAssets(project: Project) {
val projectName = baseData.name
val projectName = baseData!!.name
val buildSystemProps = findStep<BuildSystemPropertiesStep<*>>()
assets.addTemplateProperties(
"PROJECT_NAME" to projectName,
Expand Down
Loading

0 comments on commit b246f71

Please sign in to comment.