Bazel 8 Migration - Dagger Bump& Patched Android Tools Javapoet Bump#207
Open
edwin-grabtaxi wants to merge 1 commit intomigration/bazel_8_main_branchfrom
Open
Bazel 8 Migration - Dagger Bump& Patched Android Tools Javapoet Bump#207edwin-grabtaxi wants to merge 1 commit intomigration/bazel_8_main_branchfrom
edwin-grabtaxi wants to merge 1 commit intomigration/bazel_8_main_branchfrom
Conversation
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.
rules_kotlin 2.1.2 (required for Bazel 8) bundles the Kotlin 2.1.0 compiler. This makes a Dagger upgrade mandatory and surfaces a classpath conflict between Dagger and
all_android_tools_deploy.jar. Both are fixed together here.Without this fix
kotlinx-metadata-jvmto read Kotlin class metadata at annotation processing time, but the version it ships with only understands metadata up to format 2.0.0, causing it to reject any Kotlin 2.1.0-compiled class:Bumping to Dagger 2.53+ ships a newer
kotlinx-metadata-jvmthat understands the Kotlin 2.1.0 metadata format.all_android_tools_deploy.jarbundles JavaPoet 1.8.0 which shadows Maven's JavaPoet 1.13.0. ClassName.canonicalName() was only added as a method in JavaPoet 1.12.0, so when Dagger's ComponentProcessor calls it, it hits the older version first:With this fix
Root cause
all_android_tools_deploy.jaris a self-contained JAR that bundles JavaPoet 1.8.0. The canonicalName() method was added in JavaPoet 1.12.0. Any Dagger version that calls it will conflict with the bundled JavaPoet. We observed this with 2.59.1, and a similar conflict is reported for 2.57.1 (NoSuchMethodError in AggregateDepsTask due to JavaPoet/KotlinPoet version conflict with Hilt 2.57.1 google/dagger#4976).Changes
rules/dagger/dagger.bzl. A local wrapper around the upstream dagger_rules() that explicitly adds dagger-spi and dagger as deps on the dagger-compiler plugin, working around Bazel 8's strict classpath isolation. We can't patch the upstream @bazel_common_dagger repository directly, so a local wrapper is the only practical option.rules/repositories.bzl.all_android_tools_deploy.jarto replace bundled JavaPoet 1.8.0 with JavaPoet 1.13.0. The JavaPoet API used by databinding (JavaFile, TypeSpec, MethodSpec, etc.) is stable across all versions.