Fix kt_android emitting an empty ABI .api dump (#112)#115
Draft
sugarmanz wants to merge 2 commits into
Draft
Conversation
07f6297 to
d101695
Compare
The published :{name} target is a source-less android_library that only
re-exports the kt_android_library base via exports, so its own output jar
carries no declarations and the ABI dump came out empty. Have
kt_android_library_and_test return the base label it creates, and dump that
instead of the wrapper; abi() stays in kt_android alongside lint/distribution.
Adds a kt_android example under examples/kotlin with a golden .api as
regression coverage (abi-check passes). The example moves to Bazel 9.1.1 to
match root (#111): the rules_android 0.7.2 -> rules_java 9.3.0 path needs
Bazel 9 for java_import's jars attr used by rules_kotlin's serialization ext.
d101695 to
5b0b5ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #112
kt_androidproduced an empty.apiABI dump, whilekt_jvmworked correctly.Root cause
kt_androidbuilds two targets: a:{name}-basekt_android_librarythat actually compiles the Kotlin (populated ABI jar), and the published:{name}android_librarythat only re-exports the base viaexportsand carries no sources of its own. The ABI dump (abi()) was pointed at:{name}— whose own output jar has no declarations — so the.apicame out empty.kt_jvmis unaffected because there the named target is the compiling library.Fix
kt_android_library_and_testnow returns the base target's label it created, andkt_androidpasses that label toabi(target = ...). Theabi()call stays inkt_androidalongsidelint/distribution(unchanged organization) — it just dumps the base library that actually holds the compiled public surface, using the exact label the owner produced instead of re-deriving the name. Generated target names ({name}-abi-dump/-abi-check/-abi-update) and the goldenapi/{name}.apipath are unchanged, matchingkt_jvmand the BCV layout.Verification
kt_androidexample underexamples/kotlinwith a checked-in golden.api;//:android_lib-abi-dumpnow emits the populated public surface and//:android_lib-abi-checkpasses.//examples:all_integration_tests— the CI image (playerui/bazel-docker) provides Android SDK (android-35) + JDK 17; the example auto-detects the SDK via$ANDROID_HOMEand pins no API level.Follow-up (separate, in the
playerrepo)playermust repoint its.apidump from//android/player:androidto the new:{name}-abitarget for the fix to take full effect downstream.