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

Java Android Library Support

Open realbarisbasturk opened this issue 3 years ago • 6 comments

Binary compatibility plugin configures necessary tasks like 'apiDump' and 'apiCheck' only if kotlin, kotlin-android or kotlin-multiplatform plugins are applied as can be seen here

Although it can be used for Java libraries, due to missing the plugins listed above, necessary tasks are not created.

Java Android libraries can be supported if the tasks are also created for projects where com.android.library plugin is applied.

realbarisbasturk avatar Jul 22 '22 13:07 realbarisbasturk

Good point.

I'm not sure how hard it would be to add it and if there are any caveats that may prevent us from implementing it though. I'm ready to properly review and evaluate a contribution (or a PoC) for this functionality

qwwdfsad avatar Aug 31 '22 09:08 qwwdfsad

Unfortunately, kotlin-android and com.android.library interact in an unpredictable way that prevents major libs from updating (#103, as well as few other libs I've tested).

Unfortunately, I'm short on time in order to properly investigate and fix it, so in order to unblock libraries from updating, I'm reverting this feature and releasing 0.12.1

qwwdfsad avatar Oct 26 '22 09:10 qwwdfsad

The first bug in the implementation is its non-laziness, which misses the applied kotlin-android plugin in some scenarios (the expected way to check is project.pluginManager.hasPlugin(...).

The problem itself is deeper -- it's not the plugin check, but the fact these two tasks (kotlin-android and com.android.library) work exclusively, meaning that only the result of one of them should be present. Instead, when com.android.library is detected, its outputs should be added both as input and as input dependency for kotlin-android task if it is present, or a separate task should've created otherwise

qwwdfsad avatar Oct 26 '22 09:10 qwwdfsad

I did not test the case where plugin is applied to the root project (as it is recommended). Since the functional tests I added also does not cover this case but instead applies the plugin to the individual java/kotlin modules, I missed it during development. Thanks for sharing your findings, I will look into it asap (hopefully this weekend) and create a new PR to fix the issue.

realbarisbasturk avatar Oct 26 '22 10:10 realbarisbasturk

No need to hurry, bugs happen. I've rather posted it here so it's easier to catch the fix when somebody is ready to work on it

qwwdfsad avatar Oct 26 '22 10:10 qwwdfsad

Hi @qwwdfsad, it's been a while since I've created a PR for this issue. I'd appreciate if you could take a look when you have a chance.

realbarisbasturk avatar Jul 29 '23 16:07 realbarisbasturk