diff --git a/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt b/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt index ca09ff625..1d3fe709d 100644 --- a/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt +++ b/buildSrc/src/main/kotlin/BinaryCompatibilityConfigurator.kt @@ -68,7 +68,10 @@ object BinaryCompatibilityConfigurator { dir.resolve("build.gradle.kts").writeTextIfNeeded( applyTemplate( project.path, - if (targetName == null) "classes/kotlin/main" else "classes/kotlin/$targetName/main" + listOfNotNull( + if (targetName == null) "classes/kotlin/main" else "classes/kotlin/$targetName/main", + if (targetName?.contains("android") == true) "tmp/kotlin-classes/debug" else "" + ) ) ) dir.resolve(".gitignore").writeTextIfNeeded( @@ -80,7 +83,12 @@ object BinaryCompatibilityConfigurator { findProject(getValidatorDir(dir)) ?.afterEvaluate { if (targetName == null) { - tasks.findByName("apiBuild")?.dependsOn(project.tasks.getByName("jar")) + tasks.findByName("apiBuild")?.dependsOn( + *listOfNotNull( + project.tasks.getByName("jar"), + project.tasks.findByName("compileDebugKotlinAndroid") + ).toTypedArray() + ) } else { tasks.findByName("apiBuild")?.dependsOn( if (targetName.contains("android")) { @@ -94,13 +102,13 @@ object BinaryCompatibilityConfigurator { } } - fun applyTemplate(projectPath: String, buildDir: String): String { + fun applyTemplate(projectPath: String, buildDirs: List): String { return this::class.java.classLoader .getResourceAsStream("binary-compatibility-validator-build.txt")!! .useToRun { readBytes() } .decodeToString() .replace("$\$PROJECT_PATH$$", projectPath) - .replace("$\$BUILD_DIR$$", buildDir) + .replace("$\$BUILD_DIR$$", buildDirs.joinToString("\n")) .replace("$\$PLUGIN_VERSION$$", Versions.binaryValidator) } } diff --git a/buildSrc/src/main/resources/binary-compatibility-validator-build.txt b/buildSrc/src/main/resources/binary-compatibility-validator-build.txt index 9981e1feb..e3b00020b 100644 --- a/buildSrc/src/main/resources/binary-compatibility-validator-build.txt +++ b/buildSrc/src/main/resources/binary-compatibility-validator-build.txt @@ -15,8 +15,12 @@ plugins { description = "Binary compatibility validator for project $$PROJECT_PATH$$" tasks.withType(kotlinx.validation.KotlinApiBuildTask::class) { + val paths = """ + $$BUILD_DIR$$ + """ + .lines().filter { it.isNotBlank() }.map { project("$$PROJECT_PATH$$").buildDir.resolve(it.trim()) } inputClassesDirs = - files(inputClassesDirs.files, project("$$PROJECT_PATH$$").buildDir.resolve("$$BUILD_DIR$$")) + files(inputClassesDirs.files, *paths.toTypedArray()) } apiValidation {