`dex_desugar_aspect` fails to traverse proto runtime deps under `--incompatible_enable_proto_toolchain_resolution`
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- java
- 領域
- build-system
調査の方向性
提供された Bazel コマンドと proto_library/java_lite_proto_library 依存関係を使って失敗を再現します。rules/dex_desugar_aspect.bzl の _ATTR_ASPECTS と rules/dex.bzl の _to_dexed_classpath を読み、toolchain によって解決されるランタイム JAR に注目します。android_binary が --incompatible_enable_proto_toolchain_resolution を指定して、JAR が見つからないことによる失敗なしに分析およびビルドできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
Any android_binary with a transitive dependency on java_lite_proto_library fails at analysis time when --incompatible_enable_proto_toolchain_resolution is enabled (the Bazel 9 default):
Error in fail: Dependencies on .jar artifacts are not allowed in Android binaries,
please use a java_import to depend on ../protobuf+/java/core/liblite.jar.
If this is an implicit dependency then the rule that introduces it will need to be fixed to account for it correctly.
Root Cause
dex_desugar_aspect traverses dependencies via the attributes listed in _ATTR_ASPECTS (rules/dex_desugar_aspect.bzl). This list includes _aspect_proto_toolchain_for_javalite and _proto_toolchain_for_javalite, which are the legacy (pre-toolchain-resolution) attributes that java_lite_proto_library used to wire in the proto runtime.
With --incompatible_enable_proto_toolchain_resolution, proto runtime dependencies are resolved via Bazel's toolchain mechanism (@protobuf//bazel/private:javalite_toolchain_type) instead of those explicit rule attributes. The runtime jar (@protobuf//java/core:lite → liblite.jar) is still added to JavaInfo.transitive_runtime_jars by java_lite_proto_library, so it appears on the classpath. But because the dex_desugar_aspect never traversed it, the jar is absent from dex_archives_dict.
In _to_dexed_classpath (rules/dex.bzl), any classpath jar missing from both dex_archives_dict and runtime_jars_dict triggers a fail().
How to Reproduce
- Create a
proto_library+java_lite_proto_librarytarget - Depend on it (transitively or directly) from an
android_binary - Build with
--incompatible_enable_proto_toolchain_resolution(Bazel 9 default)
bazel build --incompatible_enable_proto_toolchain_resolution //my:android_app
Environment
- Bazel 9.1.0
- protobuf 33.4
- rules_android 0.7.2
Expected Behavior
The dex_desugar_aspect should handle proto runtime jars resolved via toolchain resolution the same way it handles those discovered through legacy rule attributes.
Workaround
Setting --noincompatible_enable_proto_toolchain_resolution restores the legacy behavior, but this flag is deprecated in Bazel 9.
- 主要言語
- Java
- スター
- 205
- フォーク
- 113
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bazelbuild/rules_android のほかの issue
-
build_java8_legacy_dex.sh does not set JAVA_RUNFILES for the d8/r8 launchers対応中かも @TrapsterDK が 17 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
bazelbuild/rules_android#599 ·
メンテナーはふだん 6 日以内に返信
-
`Desugar` actions don't run on multiplex workers対応中かも @lukaciko が 46 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bazelbuild/rules_android#539 · コメント 2 件 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bazelbuild/rules_android#535 · リアクション 2 件 ·
メンテナーはふだん 6 日以内に返信
-
desugar_globals output is not reproducible (zip entry order varies)対応中かも @TrapsterDK が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
bazelbuild/rules_android#610 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 42/100
bazelbuild/rules_android#602 ·
メンテナーはふだん 6 日以内に返信
bazelbuild/rules_android の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Lincoln-cn/JAiRouter#1473 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
exercism/java-analyzer#379 ·
-
area: ui bug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
tetsuji16/microProject#1893 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
liberation-data/fornax4j#325 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: FE and Kinesis extraction pipes render flow starting at the centre and scroll the source arm backwards対応中かも @chonkzillaofficial が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
BCCE-team/BuildCraft#85 ·