Parcelize: More robust code for locating layoutlib.jar

This commit is contained in:
Steven Schäfer
2020-07-20 16:08:35 +02:00
committed by Yan Zhulanow
parent 9bf3f105d9
commit a2418484bb
@@ -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"