`dex_desugar_aspect` fails to traverse proto runtime deps under `--incompatible_enable_proto_toolchain_resolution`
Los mantenedores suelen responder en 6 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- java
- Área
- build-system
Línea de trabajo
Reproduce el fallo con el comando de Bazel proporcionado y una dependencia proto_library/java_lite_proto_library. Lee _ATTR_ASPECTS en rules/dex_desugar_aspect.bzl y _to_dexed_classpath en rules/dex.bzl, centrándote en los JAR de runtime resueltos mediante la toolchain. Se considera completado cuando android_binary se analiza y se compila con --incompatible_enable_proto_toolchain_resolution sin que se produzca el fallo por la ausencia del JAR.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 205
- Forks
- 113
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de bazelbuild/rules_android
-
build_java8_legacy_dex.sh does not set JAVA_RUNFILES for the d8/r8 launchersPosiblemente ocupada @TrapsterDK la tomó hace 17 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
bazelbuild/rules_android#599 ·
Los mantenedores suelen responder en 6 días
-
`Desugar` actions don't run on multiplex workersPosiblemente ocupada @lukaciko la tomó hace 46 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
bazelbuild/rules_android#539 · 2 comentarios ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
bazelbuild/rules_android#535 · 2 reacciones ·
Los mantenedores suelen responder en 6 días
-
desugar_globals output is not reproducible (zip entry order varies)Posiblemente ocupada @TrapsterDK la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
bazelbuild/rules_android#610 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
bazelbuild/rules_android#602 ·
Los mantenedores suelen responder en 6 días
Todos los issues de bazelbuild/rules_android
Issues similares
-
[P2] 生产环境下启动门闩的失败明细不进容器标准输出Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Lincoln-cn/JAiRouter#1473 ·
Los mantenedores suelen responder en 1 día
-
Link not working in the feedback concerning String.format() in exercise 'Tim from Marketing'Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
exercism/java-analyzer#379 ·
-
area: ui bug priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
tetsuji16/microProject#1893 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
liberation-data/fornax4j#325 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: FE and Kinesis extraction pipes render flow starting at the centre and scroll the source arm backwardsPosiblemente ocupada @chonkzillaofficial la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
BCCE-team/BuildCraft#85 ·