`Desugar` actions don't run on multiplex workers

Open Beginner friendly
#539 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
android

Research direction

Read rules/desugar.bzl and compare its execution requirements with rules/dex.bzl, using the persistent Android desugar configuration fields exposed through AndroidConfigurationApi as the entry point. Verify that the requirements differ correctly for persistent and persistent multiplex workers, then confirm the relevant flag behavior with the Bazel flag expansion described in the issue.

Written by the indexing model from the issue text.

Description

Desugar action runs on a singleplex workers even when --persistent_multiplex_android_dex_desugar is set.

rules/desugar.bzl hardcodes execution_requirements = {"supports-workers": "1"} — it never checks persistent_multiplex_android_dex_desugar, so the --persistent_multiplex_android_dex_desugar flag has no effect on Desugar actions. This is apparently a Starlark migration regression. rules/dex.bzl does this correctly for DexBuilder.

Fixing this issue on the Spotify app brought down Desugar's critical path contribution from 60s to 7s on our API change scenario.

Fix

Mirror what dex.bzl already does:

execution_requirements = {}
if ctx.fragments.android.persistent_android_dex_desugar:
    execution_requirements["supports-workers"] = "1"
    if ctx.fragments.android.persistent_multiplex_android_dex_desugar:
        execution_requirements["supports-multiplex-workers"] = "1"

Everything else is already wired — the flag expands correctly (bazel canonicalize-flags shows --internal_persistent_multiplex_android_dex_desugar=1), AndroidConfigurationApi exposes the field to Starlark, and the Desugar tool uses WorkRequestHandler which supports multiplex.

Confirmed still present in v0.7.3. Tested against v0.7.1 / Bazel 8.6.0.

Dominant language
Java
Stars
203
Forks
95
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/rules_android

All issues in bazelbuild/rules_android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.