binary-compatibility-validator icon indicating copy to clipboard operation
binary-compatibility-validator copied to clipboard

`apiDump` task is always in `SKIPPED` state when plugin applied on Android project.

Open nevack opened this issue 3 years ago • 4 comments

This check is always false https://github.com/Kotlin/binary-compatibility-validator/blob/master/src/main/kotlin/BinaryCompatibilityValidatorPlugin.kt#L87 for Android project. This is because source files are located in src/main/java or src/main/kotlin by convention, but sourceSets list points only to src/release/kotlin and src/release/java. There's no KotlinJvmAndroidCompilation with name main.

If I remove compilation.allKotlinSourceSets.any { it.kotlin.srcDirs.any { it.exists() } } check, API dump is generated.

nevack avatar Jul 01 '21 18:07 nevack

Could you please provide a simple reproducing project?

The fix is slightly more complicated than that because this check is necessary to filter out root projects without sources

qwwdfsad avatar Jul 05 '21 08:07 qwwdfsad

@qwwdfsad any progress with this issue?

yaroslav-zayats-ring avatar Dec 08 '21 13:12 yaroslav-zayats-ring

I'm working on an Android library project and tried to use this plugin version '0.8.0'. In our project we have a lot of modules and we keep our sources in java folder instead of src/main/java or src/main/kotlin.

android {
    sourceSets {
        main.java.srcDir 'java'
    }
}

With such configuration apiDump doesn't dump public API.

But it works if an empty src/main/java directory is present in the project(in each module). So with empty project/src/main/java 'apiDump' task dumps public API for the code located in project/java

yaroslav-zayats-ring avatar Dec 09 '21 12:12 yaroslav-zayats-ring

No progress. I'm ready to accept a contribution (as long as it's accompanied with a corresponding test) or a reproducing project to help me reproduce and fix the issue

qwwdfsad avatar Jan 31 '22 14:01 qwwdfsad