From fdaea01bb0dca109fdef6b81ef47ef49f43674b5 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Sun, 20 Apr 2025 00:32:54 +0200 Subject: [PATCH] Refactor product handling logic in build script Accounts for possible "IU" product variant not supported by current community-edition specific implementation --- build.gradle.kts | 16 +++++++++------- flutter-idea/build.gradle.kts | 11 +++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7f933a6e22..4fc9678074 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,6 @@ * found in the LICENSE file. */ -import org.jetbrains.intellij.platform.gradle.IntelliJPlatform import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType import org.jetbrains.intellij.platform.gradle.TestFrameworkType import org.jetbrains.intellij.platform.gradle.models.ProductRelease @@ -94,8 +93,12 @@ dependencies { // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms if (ideaProduct == "android-studio") { androidStudio(ideaVersion) - } else { // if (ideaProduct == "IC") { - intellijIdeaCommunity(ideaVersion) + } else { + when (ideaProduct) { + "IU" -> intellijIdeaUltimate(ideaVersion) + "IC" -> intellijIdeaCommunity(ideaVersion) + else -> throw IllegalArgumentException("ideaProduct must be defined in the product matrix as either \"IU\" or \"IC\", but is not for $ideaVersion") + } } testFramework(TestFrameworkType.Platform) @@ -109,12 +112,11 @@ dependencies { "org.jetbrains.kotlin", "org.jetbrains.plugins.gradle", "org.intellij.intelliLang") + val pluginList = mutableListOf("Dart:$dartPluginVersion") if (ideaProduct == "android-studio") { bundledPluginList.add("org.jetbrains.android") bundledPluginList.add("com.android.tools.idea.smali") - } - val pluginList = mutableListOf("Dart:$dartPluginVersion") - if (ideaProduct == "IC") { + } else { pluginList.add("org.jetbrains.android:$androidPluginVersion") } @@ -214,4 +216,4 @@ tasks { dependsOn(":flutter-studio:prepareSandbox") } } -} \ No newline at end of file +} diff --git a/flutter-idea/build.gradle.kts b/flutter-idea/build.gradle.kts index ac71501ed8..a3759ef03c 100644 --- a/flutter-idea/build.gradle.kts +++ b/flutter-idea/build.gradle.kts @@ -74,7 +74,11 @@ dependencies { if (ideaProduct == "android-studio") { androidStudio(ideaVersion) } else { // if (ideaProduct == "IC") { - intellijIdeaCommunity(ideaVersion) + when (ideaProduct) { + "IU" -> intellijIdeaUltimate(ideaVersion) + "IC" -> intellijIdeaCommunity(ideaVersion) + else -> throw IllegalArgumentException("ideaProduct must be defined in the product matrix as either \"IU\" or \"IC\", but is not for $ideaVersion") + } } testFramework(TestFrameworkType.Platform) @@ -89,12 +93,11 @@ dependencies { "org.jetbrains.plugins.gradle", "org.intellij.intelliLang", ) + val pluginList = mutableListOf("Dart:$dartPluginVersion") if (ideaProduct == "android-studio") { bundledPluginList.add("org.jetbrains.android") bundledPluginList.add("com.android.tools.idea.smali") - } - val pluginList = mutableListOf("Dart:$dartPluginVersion") - if (ideaProduct == "IC") { + } else { pluginList.add("org.jetbrains.android:$androidPluginVersion") }