Build: fix finding layout-api jar in parcelize box test due to platform change

This commit is contained in:
Dmitriy Novozhilov
2020-11-25 14:29:41 +03:00
parent cc1a0bf6d7
commit e251a9be14
2 changed files with 8 additions and 3 deletions
@@ -28,20 +28,24 @@ abstract class AbstractParcelBoxTest : CodegenTestCase() {
companion object {
val LIBRARY_KT = File("plugins/android-extensions/android-extensions-compiler/testData/parcel/boxLib.kt")
private fun String.withoutAndroidPrefix(): String = removePrefix("studio.android.sdktools.")
private val androidPluginPath: String by lazy {
System.getProperty("ideaSdk.androidPlugin.path")?.takeIf { File(it).isDirectory }
?: throw RuntimeException("Unable to get a valid path from 'ideaSdk.androidPlugin.path' property, please point it to the Idea android plugin location")
}
val layoutlibJar: File by lazy {
File(androidPluginPath).listFiles { _, name ->
File(androidPluginPath).listFiles { _, rawName ->
val name = rawName.withoutAndroidPrefix()
name.startsWith("layoutlib-") && name.endsWith(".jar")
&& !name.startsWith("layoutlib-api-") && !name.startsWith("layoutlib-loader")
}?.firstOrNull() ?: error("Unable to locate layoutlib jar in '$androidPluginPath'")
}
val layoutlibApiJar: File by lazy {
File(androidPluginPath).listFiles { _, name ->
File(androidPluginPath).listFiles { _, rawName ->
val name = rawName.withoutAndroidPrefix()
name.startsWith("layoutlib-api-") && name.endsWith(".jar")
}?.firstOrNull() ?: error("Unable to locate layoutlib-api jar in '$androidPluginPath'")
}