Repository navigation
Conversation
The --classpath-aar argument was built by formatting aar.path and aar_dir.path into a string, so Bazel could not recognize the paths. With --experimental_output_paths=strip the inputs are staged under bazel-out/cfg while the argument kept the original configuration directory, and lint failed because the AARs did not exist there. Pass the Files to add_joined so that path mapping rewrites them, keeping the tree artifact as a single path.
With multiplex sandboxing, Bazel stages each work request's inputs under the request's WorkRequest.sandbox_dir, relative to the worker's working directory. The worker resolved the @flagfile and every path argument against its own working directory, and took the lint root directory, --path-variables PWD and --sdk-home from $PWD, so a sandboxed request could not find its inputs or write its report. Resolve the flagfile and every path argument against the request's execution root: its sandbox directory when Bazel sets one, otherwise the worker's working directory. The project XML, --xml, --sdk-home, --jdk-home and the root directory now all use absolute paths under it. The worker's working directory comes from $PWD only when it names the current directory, so a stale inherited $PWD can't misplace paths. AndroidLintCliInvokerCache keys on the lint jar's real path, so requests in different sandboxes still share one lint classloader. It now also loads the jar from that real path: the sandbox symlink the first request staged it through is deleted after that request, while the classloader keeps serving later ones. Write each request's error output to the PrintWriter whose contents WorkRequestHandler returns in that request's WorkResponse. It went to System.err, which WorkRequestHandler captures into one buffer shared by every in-flight request, so concurrent requests could report each other's errors. Lint's own console output still goes through that buffer. Also report checked exceptions as failed requests: WorkRequestHandler only answers RuntimeExceptions and InterruptedExceptions, so any other checked exception left the request without a response. Set user.home once per worker process, to a temporary directory that lives as long as the worker. Each request used to set the JVM-global property to a directory in its own working directory, which raced between concurrent requests and was deleted while lint, which caches the locations it derives from user.home per classloader, kept using it.
Declare supports-path-mapping and supports-multiplex-sandboxing on the AndroidLint action, so it shares remote cache entries across configurations under --experimental_output_paths=strip and keeps running as a multiplex worker under --experimental_worker_multiplex_sandboxing, instead of falling back to sandboxed singleplex workers. Every bazel-out path reaches the command line as a File, so path mapping can rewrite it, and the worker resolves every path against the request's sandbox. --android-home and --jdk-home pass toolchain roots, which live outside bazel-out and so don't change under path mapping. ExtractLintAar still formats paths into its shell command, so it doesn't declare supports-path-mapping. A new analysis test analyzes the lint action under --experimental_output_paths=strip and checks that every bazel-out path on its command line, including both halves of a joined --classpath-aar argument, moves to bazel-out/cfg.
06393993
force-pushed
the
t1-upstream-pr
branch
from
December 3, 2026 21:51
2625264 to
4b0eb6a
Compare
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.
Summary
Enable Bazel output path mapping (
--experimental_output_paths=strip) and multiplex worker sandboxing (--experimental_worker_multiplex_sandboxing) forAndroidLintactions:Fileobjects (rules/impl.bzl, authored by Jasmine Tang): replaces"%s:%s" % (aar.path, aar_dir.path)withargs.add_joined("--classpath-aar", [aar, aar_dir], join_with = ":", expand_directories = False)so Bazel's path mapper rewrites both paths while keeping theaar_dirtree artifact as a single directory path.WorkRequest.sandbox_dirin the persistent worker (src/worker/,src/cli/):@flagfileand all path arguments (inputs,--output,--android-home,--jdk-home,<root dir>,--path-variables PWD=...) against the request's execution root (workingDirectory.resolve(request.sandboxDir).normalize()).PWDlookup against stale inheritedPWDvalues.AndroidLintCliInvokerURLClassLoaders fromjar.toRealPath()(matching the cache key) so the shared classloader andUastEnvironmentsurvive after Bazel deletes the first request's sandbox symlink.WorkRequestHandler's per-requestPrintWriterinstead of sharedSystem.err, and convert checked callback exceptions into failedWorkResponses so requests never hang unanswered.user.homeonce per worker process (thread-safely) rather than mutating the JVM-global property per request.AndroidLint(rules/impl.bzl): addssupports-multiplex-sandboxingandsupports-path-mappingtoAndroidLint(leavingExtractLintAarexcluded).Testing
//tests/src/worker:WorkerTest,//tests/src/cli:AndroidLintActionTest,//tests/src/cli:AndroidLintActionArgsTest, and//tests/src/cli:AndroidLintCliInvokerCacheTestcovering concurrent multiplex sandboxes, per-request output isolation, checked exception handling,PWDhandling, and classloader reuse after sandbox deletion.//tests/rules:testsverifying execution requirements and confirming everybazel-out/path on theAndroidLintcommand line (including both halves of--classpath-aar) maps tobazel-out/cfg/under--experimental_output_paths=strip.bazel test //...passes (30/30) on both Bazel 8.x and Bazel 9.x with--strategy=AndroidLint=worker,--strategy=AndroidLint=local, and--strategy=AndroidLint=worker --experimental_output_paths=strip --experimental_worker_multiplex_sandboxing, plus//.github/workflows:buildifier.check.