From a2418484bbde648c5ad357193457a22f6e2e6611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Sch=C3=A4fer?= Date: Mon, 20 Jul 2020 16:08:35 +0200 Subject: [PATCH] Parcelize: More robust code for locating layoutlib.jar --- .../kotlin/android/parcel/AbstractParcelBoxTest.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt b/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt index a6c81561072..be080254098 100644 --- a/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt +++ b/plugins/android-extensions/android-extensions-compiler/test/org/jetbrains/kotlin/android/parcel/AbstractParcelBoxTest.kt @@ -33,8 +33,18 @@ abstract class AbstractParcelBoxTest : CodegenTestCase() { ?: 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, "layoutlib-26.5.0.2.jar") } - val layoutlibApiJar: File by lazy { File(androidPluginPath, "layoutlib-api-26.5.0.jar") } + val layoutlibJar: File by lazy { + File(androidPluginPath).listFiles { _, name -> + 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 -> + name.startsWith("layoutlib-api-") && name.endsWith(".jar") + }?.firstOrNull() ?: error("Unable to locate layoutlib-api jar in '$androidPluginPath'") + } private val JUNIT_GENERATED_TEST_CLASS_BYTES by lazy { constructSyntheticTestClass() } private const val JUNIT_GENERATED_TEST_CLASS_FQNAME = "test.JunitTest"