Build: fix finding layout-api jar in parcelize box test due to platform change
This commit is contained in:
+6
-2
@@ -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'")
|
||||
}
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ abstract class AbstractParcelizeIrBoxTest : AbstractParcelizeBoxTest() {
|
||||
abstract class AbstractParcelizeBoxTest : CodegenTestCase() {
|
||||
companion object {
|
||||
val LIBRARY_KT = File("plugins/parcelize/parcelize-compiler/testData/boxLib.kt")
|
||||
private const val ANDROID_TOOLS_PREFIX = "studio.android.sdktools."
|
||||
|
||||
private val androidPluginPath: String by lazy {
|
||||
System.getProperty("ideaSdk.androidPlugin.path")?.takeIf { File(it).isDirectory }
|
||||
@@ -39,7 +40,7 @@ abstract class AbstractParcelizeBoxTest : CodegenTestCase() {
|
||||
}
|
||||
|
||||
private fun getLayoutLibFile(pattern: String): File {
|
||||
val nameRegex = "^$pattern-[0-9\\.]+\\.jar$".toRegex()
|
||||
val nameRegex = "^($ANDROID_TOOLS_PREFIX)?$pattern-[0-9\\.]+\\.jar$".toRegex()
|
||||
return File(androidPluginPath).listFiles().orEmpty().singleOrNull { it.name.matches(nameRegex) }
|
||||
?: error("Can't find file for pattern $nameRegex in $androidPluginPath. " +
|
||||
"Available files: \n${File(androidPluginPath).list().orEmpty().asList()}")
|
||||
|
||||
Reference in New Issue
Block a user