Skip to content

Commit

Permalink
Compatibility with 2024.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pbreault committed Nov 18, 2024
1 parent db3f208 commit ffe8f10
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [[Unreleased]]

## [1.6.19] - 2024-11-17
- Compatibility with AS Ladybug Feature Drop 2024.2.2

## [1.6.18] - 2024-08-18
- Compatibility with AS Ladybug

Expand Down Expand Up @@ -212,6 +215,7 @@
- Command to clear data and restart

[Unreleased]: https://github.com/pbreault/adb-idea/compare/1.6.18...HEAD
[1.6.19]: https://github.com/pbreault/adb-idea/compare/1.6.18...1.6.19
[1.6.18]: https://github.com/pbreault/adb-idea/compare/1.6.17...1.6.18
[1.6.17]: https://github.com/pbreault/adb-idea/compare/1.6.16...1.6.17
[1.6.16]: https://github.com/pbreault/adb-idea/compare/1.6.15...1.6.16
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
// Must match the Kotlin version bundled with the IDE
// https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
// https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
id("org.jetbrains.kotlin.jvm") version "1.9.24"
id("org.jetbrains.kotlin.jvm") version "2.0.21"

// https://github.com/JetBrains/intellij-platform-gradle-plugin
id("org.jetbrains.intellij.platform") version "2.0.1"
id("org.jetbrains.intellij.platform") version "2.1.0"

// https://github.com/ajoberstar/reckon
id("org.ajoberstar.reckon") version "0.14.0"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Android Studio Version
# Get it from `list-studio-versions.sh`
ideVersion=2024.1.3.1
ideVersion=2024.3.1.2

# Minimum Intellij PLatform version supported by this plugin
# see https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
sinceBuild=241.18034
sinceBuild=242.23339

# The path to a local Android Studio installation.
# This will enable the `runLocalIde` task.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ package com.developerphil.adbidea.adb
import com.android.ddmlib.IDevice
import com.android.tools.idea.insights.isAndroidApp
import com.android.tools.idea.model.AndroidModel
import com.android.tools.idea.projectsystem.getHolderModule
import com.android.tools.idea.projectsystem.gradle.getHolderModule
import com.android.tools.idea.util.androidFacet
import com.developerphil.adbidea.adb.DeviceResult.DeviceNotFound
import com.developerphil.adbidea.adb.DeviceResult.SuccessfulDeviceResult
import com.developerphil.adbidea.compatibility.BackwardCompatibleGetter
import com.developerphil.adbidea.ui.DeviceChooserDialog
import com.developerphil.adbidea.ui.ModuleChooserDialogHelper
import com.developerphil.adbidea.ui.NotificationHelper
import com.intellij.facet.ProjectFacetManager
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.impl.ModuleImpl
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogWrapper
import org.jetbrains.android.facet.AndroidFacet
import org.joor.Reflect


class DeviceResultFetcher constructor(
Expand Down Expand Up @@ -53,7 +57,7 @@ class DeviceResultFetcher constructor(

private fun getFacet(facets: List<AndroidFacet>): AndroidFacet? {
val appFacets = facets
.map { it.module.getHolderModule() }
.map { HolderModuleGetter(it).get() }
.filter { it.isAndroidApp }
.mapNotNull { it.androidFacet }
.distinct()
Expand All @@ -65,6 +69,19 @@ class DeviceResultFetcher constructor(
}
}

// Can be removed after 242.23339
class HolderModuleGetter(private val facet: AndroidFacet) : BackwardCompatibleGetter<Module>() {
override fun getCurrentImplementation(): Module {
return facet.module.getHolderModule()
}

override fun getPreviousImplementation(): Module {
return Reflect.onClass("com.android.tools.idea.projectsystem.ModuleSystemUtil")
.call("getHolderModule", facet.module).get<ModuleImpl>()
}
}


private fun showDeviceChooserDialog(facet: AndroidFacet, packageName: String): DeviceResult {
val chooser = DeviceChooserDialog(facet)
chooser.show()
Expand Down

0 comments on commit ffe8f10

Please sign in to comment.