Skip to content

Commit

Permalink
Merge pull request #13 from Nilzor/giraffe
Browse files Browse the repository at this point in the history
Android Studio Giraffe and Hedgehog support
  • Loading branch information
Nilzor authored May 24, 2023
2 parents f0f61c0 + b8b1bdc commit 42f715f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
32 changes: 12 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,25 @@ buildscript {

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
id 'org.jetbrains.intellij' version '1.0'
id 'org.jetbrains.intellij' version '1.13.3'
}

group 'com.nilsenlabs.flavormatrix'
version '1.1.0'

version '1.2.0'

// Any developer must change this to his/her installation folder
// of Android Studio of the targetIdeVersion for which to build for
// When updating, update 4 source JAR dependencies manually to get
// the dev environment class resolution correctly:
// Project Settings > Modules
// When updating, delete all source jar references manually from Project Structure > Libraries that reference
// the old version of Android Studio. E.g::
// plugins\properties\lib\platform-images.jar
// plugin\sproperties\lib\properties.jar
// plugins\properties\lib\properties.jar
// plugins\smali\lib\smali.jar
def localStudioPath = 'C:/coding/android-studio-2022.1.1.19'
//def localStudioPath = 'C:/Programfiler/android/Android Studio'

// Below: Electric Eel patch 1 . ALWAYS UPDATE PLUGIN.XML AS WELL
def targetIdeVersion = "221.6008.13"
def localStudioPath = 'd:/coding/android-studio-2022.3.1.14-windows'

// Build #IC-213.6777.52, built on January 28, 2022
// Below: From Giraffe Beta 1
// Also tested on Hedgehog Canary 4, 231.7864.76
def targetIdeVersion = "223.8836.35"

// The other machine: 'c:/Program Files/Android/Android Studio 4.1 RC3'

intellij {
// Uncomment the two lines below and remove "localPath" if you want to build for a different version than the one locally installed
Expand All @@ -49,6 +44,7 @@ intellij {
patchPluginXml {
changeNotes = """
<ul>
<li>1.2.0 Support for Android Studio Giraffe and Hedgehog</li>
<li>1.1.0 Support for Android Studio Electric Eel</li>
<li>1.0.0 Support for Android Studio Chipmunk (RC2+)</li>
<li>0.7.0 Support for Android studio Arctic Fox 2020.3.1</li>
Expand All @@ -58,7 +54,7 @@ patchPluginXml {
}

runIde {
def dirObj = project.getLayout().getProjectDirectory().dir(localStudioPath)
def dirObj = project.getLayout().getProjectDirectory().dir(localStudioPath).asFile
ideDir.set(dirObj)
}

Expand All @@ -75,9 +71,5 @@ repositories {

dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
testCompile "org.mockito:mockito-core:2.+"
testImplementation "org.mockito:mockito-core:2.+"
}

//publishPlugin {
// token project.properties['jetbrains.publish.token']
//}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@ object AndroidModuleHelper {
private fun createMergedDimensionList(modules: List<GradleAndroidModel>): DimensionList {
val dimensionList = DimensionList()
for (module in modules) {
val flavors = module.androidProject.productFlavors.toList()
val flavors = module.androidProject.multiVariantData?.productFlavors?.toList() ?: continue
for (flavorObj in flavors) {
// println("Processing flavorName: ${flavorObj.productFlavor.name}: ${flavorObj.productFlavor.dimension}")
/*
Expecting a log like like this for my test project:
Processing flavorName: qa: environment
Processing flavorName: prod: environment
Processing flavorName: dev: environment
Processing flavorName: paid: paymentmodel
Processing flavorName: free: paymentmodel
*/
val flavor = flavorObj.productFlavor
flavor.dimension?.let { dim ->
val flavorsForDimension = dimensionList.getOrCreateDimension(dim)
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.nilsenlabs.flavormatrix</id>
<name>Build Variant Matrix Selector</name>
<vendor url="https://github.com/Nilzor/build-variant-matrix">Frode Nilsen</vendor>
<idea-version since-build="221.6008.13" />
<idea-version since-build="223.8836.35" />
<description><![CDATA[<p>Select variant by selecting flavors in a matrix instead of through the drop down lists provdided by IntelliJ/Android Studio
in the "Build Variants" view. In addition this plugin selects variants for all modules at the same time, even
when there are multiple leaf modules. This results in a very fast and intuitive way of switching variants
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.nilsenlabs.flavormatrix

import com.nilsenlabs.flavormatrix.actions.DimensionList
import org.junit.Assert.assertEquals
import org.junit.Test
import kotlin.test.assertEquals

class DimensionListTest {
@Test
Expand Down

0 comments on commit 42f715f

Please sign in to comment.