Pill: Fix launching debuggable Android Studio on 'as' bunches

This commit is contained in:
Yan Zhulanow
2018-04-24 16:15:50 +03:00
parent 614033d64c
commit 923fbaaca6
+6 -2
View File
@@ -222,8 +222,9 @@ class JpsCompatiblePlugin : Plugin<Project> {
.map { it.trim() }
.filter { it.isNotEmpty() }
fun addOrReplaceOptionValue(name: String, value: Any) {
options = options.filter { !it.startsWith("-D$name=") } + listOf("-D$name=$value")
fun addOrReplaceOptionValue(name: String, value: Any?) {
val optionsWithoutNewValue = options.filter { !it.startsWith("-D$name=") }
options = if (value == null) optionsWithoutNewValue else (optionsWithoutNewValue + listOf("-D$name=$value"))
}
val robolectricClasspath = project.rootProject
@@ -236,6 +237,9 @@ class JpsCompatiblePlugin : Plugin<Project> {
addOrReplaceOptionValue("robolectric.classpath", robolectricClasspath)
addOrReplaceOptionValue("use.pill", "true")
val isAndroidStudioBunch = project.findProperty("versions.androidStudioRelease") != null
addOrReplaceOptionValue("idea.platform.prefix", if (isAndroidStudioBunch) "AndroidStudio" else null)
val androidJarPath = project.configurations.findByName("androidJar")?.singleFile
val androidSdkPath = project.configurations.findByName("androidSdk")?.singleFile