Skip to content

Commit

Permalink
Merge pull request #130 from ndtp/intellij-multi-module-support
Browse files Browse the repository at this point in the history
Intellij multi module support
  • Loading branch information
DanielJette authored May 7, 2023
2 parents e3fa9b7 + d7498aa commit 55ec61d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Plugins/IntelliJ/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [2.0.0-rc02]

- Added support for Android Studio Hedgehog | 2023.1.1 Canary 2 | 231.+
- Fix bug parsing nested module names


## [2.0.0-rc01]

- Added support for Android Studio Giraffe | 2022.3.1 Canary 2 | 223.+
Expand Down
2 changes: 1 addition & 1 deletion Plugins/IntelliJ/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ tasks {
runIde {
// Absolute path to installed target 3.5 Android Studio to use as
// IDE Development Instance (the "Contents" directory is macOS specific):
ideDir.set(file("/Applications/Android Studio Preview 2022.3.1.2.app/Contents"))
ideDir.set(file("/Applications/Android Studio.app/Contents"))
}
}
9 changes: 2 additions & 7 deletions Plugins/IntelliJ/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
# -> https://www.jetbrains.org/intellij/sdk/docs/reference_guide/intellij_artifacts.html

pluginGroup = dev.testify
version = 2.0.0-rc01
version = 2.0.0-rc02
pluginSinceBuild = 211
pluginUntilBuild = 223.*
pluginUntilBuild = 231.*

platformType = IC
platformDownloadSources = true

# Determines which IDE to run when using the "./gradlew runIdea" command.
# This is useful to test the plugin on older versions of Android Studio or Intellij
# Default value: $StudioCompilePath
# StudioRunPath=/Applications/Android Studio Preview 2021.3.1.8.app/Contents

# Set the explicit compiler version
InstrumentCodeVersion=223.7571.182

Expand Down
11 changes: 10 additions & 1 deletion Plugins/IntelliJ/src/main/kotlin/dev/testify/PsiExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,22 @@ import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedFunction

private const val ANDROID_TEST_MODULE = ".androidTest"
private const val PROJECT_FORMAT = "%1s."

val AnActionEvent.moduleName: String
get() {
val psiFile = this.getData(PlatformDataKeys.PSI_FILE)
val ktFile = (psiFile as? KtFile)
val projectName = ktFile?.project?.name?.replace(' ', '_') ?: ""
val moduleName = ktFile?.module?.name ?: ""
return moduleName.removeSuffix(".androidTest").removePrefix("$projectName.")

val modules = moduleName.removePrefix(PROJECT_FORMAT.format(projectName))
val psiModule = modules.removeSuffix(ANDROID_TEST_MODULE)
val gradleModule = psiModule.replace(".", ":")
println("$modules $psiModule $gradleModule")

return gradleModule
}

val PsiElement.baselineImageName: String
Expand Down

0 comments on commit 55ec61d

Please sign in to comment.