Skip to content

The Starlark implementaiton of process_deploy_jar fails to execute java.create_deploy_jar #212

Closed
@Bencodes

Description

@Bencodes

The recently enabled implementation of desugaring fails to compile with types missing from the classpath.

I was able to repro this in the basic sample app https://github.com/bazelbuild/rules_android/compare/main...Bencodes:rules_android:single-jar-failure-repro?expand=1

Example building basic app:

➜ bazel build //... --enable_bzlmod=false
INFO: Analyzed 3 targets (0 packages loaded, 0 targets configured).
ERROR: /Users/blee/Projects/rules_android/examples/basicapp/java/com/basicapp/BUILD:3:15: Building deploy jar java/com/basicapp/basic_app_RESOURCES_DO_NOT_USE_migrated_deploy.jar failed: (Exit 2): singlejar_local failed: error executing JavaDeployJar command (from target //java/com/basicapp:basic_app_RESOURCES_DO_NOT_USE) external/remote_java_tools_darwin_arm64/java_tools/src/tools/singlejar/singlejar_local --output bazel-out/darwin_arm64-fastbuild/bin/java/com/basicapp/basic_app_RESOURCES_DO_NOT_USE_migrated_deploy.jar ... (remaining 54 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
singlejar_local: androidx/lifecycle/ViewModelProvider$Factory needed on the classpath for desugaring leakcanary/internal/ViewModelClearedWatcher$Companion$install$provider$1.  Please add the missing dependency to the target containing the latter.
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.214s, Critical Path: 0.06s
INFO: 3 processes: 3 internal.
ERROR: Build did NOT complete successfully

I confirmed that the view models are in fact on the classpath for the singlejar action looking at the subcommands:

bazel-out/darwin_arm64-fastbuild-android-ST-5b74a929aefd/bin/external/example_deps/_dx_migrated/androidx_lifecycle_lifecycle_viewmodel/classes_and_libs_merged.jar_desugared.jar

And I have confirmed that the jar itself contains the requested classes:

❯ zipinfo bazel-out/darwin_arm64-fastbuild-android-ST-5b74a929aefd/bin/external/example_deps/_dx_migrated/androidx_lifecycle_lifecycle_viewmodel/classes_and_libs_merged.jar_desugared.jar | grep "ViewModelProvider\$Factory.class"
-rw----     1.0 fat     1568 bx stor 69-Dec-31 16:00 androidx/lifecycle/ViewModelProvider$Factory.class

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions