Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try different things, cannot get it to work - Please help #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ buildscript {
}

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
id 'org.jetbrains.intellij' version '0.4.21'
}

group 'com.pandora.plugin'
version '1.2.0'
version '1.3.0'

patchPluginXml {
changeNotes """
Expand All @@ -25,7 +25,7 @@ patchPluginXml {

intellij {
// Define IntelliJ Platform against which to build the plugin project.
version '193.6911.18' // Same IntelliJ IDEA version (2019.1.4) as target 3.5 Android Studio
version '223.8214.52' // Move to latest
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
plugins 'android'
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jun 03 08:21:31 EDT 2020
#Tue Jan 24 18:37:31 EST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.android.tools.idea.gradle.project.model

import java.util.*

fun NdkModuleModel.fetchVariantNames(): Collection<String?> {
val ndkVariantNames = Collections.emptySet<String>()
return try {
ndkVariantNames
allVariantAbis.map{ it.displayName }.toCollection(ndkVariantNames)
} catch (_: NoSuchMethodError) {
// Method is no longer accessible so try to get it via reflection
val variants = javaClass.methods.find { it.name == "getAllVariantAbis" }?.invoke(this) as? Set<*>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.android.tools.idea.gradle.variant.view

import com.intellij.openapi.project.Project
import com.intellij.openapi.project.modules

fun BuildVariantUpdater.update(project: Project, moduleName: String, selectedBuildVariant: String) =
this.updateSelectedBuildVariant(project, moduleName, selectedBuildVariant)
this.updateSelectedBuildVariant(project.modules.first { it.name == moduleName }, selectedBuildVariant)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SwitchBuildVariant : AnAction() {
val updater = BuildVariantUpdater.getInstance(project)
val moduleManager = ModuleManager.getInstance(project)

val knownLeafModules = structure.leafModules
val knownLeafModules = structure.leafHolderModules
val groupings = moduleManager.modules.map { it.variantItems }
.filterNot { it.buildVariants.isEmpty() }
.associateBy { it.buildVariants }
Expand All @@ -46,7 +46,7 @@ class SwitchBuildVariant : AnAction() {
}

private val Module.variantNames: Collection<String?>
get() = NdkModuleModel.get(this)?.fetchVariantNames() ?: AndroidModuleModel.get(this)?.variantNames ?: emptyList()
get() = NdkModuleModel.get(this)?.fetchVariantNames() ?: emptyList()

private val Module.variantItems: ModuleBuildVariant
get() = ModuleBuildVariant(name, variantNames.asSequence().distinct().filterNotNull().sorted().toList())
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<id>com.pandora.plugins.build_variant_selector</id>
<name>Build Variant Quick-Selector</name>
<vendor url="http://www.pandora.com">Pandora Media, Inc.</vendor>
<idea-version since-build="191"/>
<idea-version since-build="223.4884.69" />

<description><![CDATA[
This Android Studio plugin changes the selected Build Variant on all modules in a project
Expand Down