From b0bb0a62354a27ffebf2c6514b808c5c15bbe293 Mon Sep 17 00:00:00 2001 From: uyt95 Date: Mon, 31 Jul 2023 23:49:25 +0200 Subject: [PATCH] Updated for Android Studio Giraffe --- build.gradle | 6 +++--- .../selector/BuildVariantSelectorAction.kt | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 7e216c0..8603f68 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ plugins { } group 'me.uyt' -version '1.0.5' +version '1.0.6' patchPluginXml { changeNotes = """ - Updated for Android Studio Flamingo. + Updated for Android Studio Giraffe. """ } @@ -25,7 +25,7 @@ dependencies { // See https://github.com/JetBrains/gradle-intellij-plugin/ intellij { // Define IntelliJ Platform against which to build the plugin project. - version = '222.4459.24' // Same IntelliJ IDEA version as target Android Studio version + version = '223.8836.35' // Same IntelliJ IDEA version as target Android Studio version type = 'IC' // Use IntelliJ IDEA CE because it's the basis of the IntelliJ Platform // Require the Android plugin, Gradle will match the plugin version to intellij.version diff --git a/src/main/kotlin/me/uyt/build/variant/selector/BuildVariantSelectorAction.kt b/src/main/kotlin/me/uyt/build/variant/selector/BuildVariantSelectorAction.kt index 76d33f1..b331115 100644 --- a/src/main/kotlin/me/uyt/build/variant/selector/BuildVariantSelectorAction.kt +++ b/src/main/kotlin/me/uyt/build/variant/selector/BuildVariantSelectorAction.kt @@ -48,27 +48,27 @@ class BuildVariantSelectorAction : AnAction() { return Pair(module, model) } - private fun parseFlavors(module: GradleAndroidModel): Map> { + private fun parseFlavors(model: GradleAndroidModel): Map> { val flavors = mutableMapOf>() - module.androidProject.flavorDimensions.forEach { + model.androidProject.flavorDimensions.forEach { flavors[it] = mutableListOf() } - module.androidProject.productFlavors.forEach { flavorContainer -> + model.androidProject.multiVariantData?.productFlavors?.forEach { flavorContainer -> val flavor = flavorContainer.productFlavor val dimension = flavor.dimension ?: return@forEach - val selected = module.selectedVariant.productFlavors.contains(flavor.name) + val selected = model.selectedVariant.productFlavors.contains(flavor.name) flavors[dimension]?.add(SelectOption(flavor.name, selected)) } return flavors } - private fun parseBuildTypes(module: GradleAndroidModel): List { - return module.androidProject.buildTypes.map { + private fun parseBuildTypes(model: GradleAndroidModel): List { + return model.androidProject.multiVariantData?.buildTypes?.map { SelectOption( it.buildType.name, - it.buildType.name == module.selectedVariant.buildType + it.buildType.name == model.selectedVariant.buildType ) - } + } ?: emptyList() } private fun getSelectedVariant(