Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databinding: Build failure when enabling --persistent_android_resource_processor #13649

Closed
arunkumar9t2 opened this issue Jul 6, 2021 · 0 comments
Labels

Comments

@arunkumar9t2
Copy link
Contributor

Description of the problem / feature request:

When databinding is used, specifically if layout xml has databinding expressions, persistent workers for Android resource work cannot be enabled. Enabling it causes the build to fail with the following message.

Merging compiled Android resources for //:A failed: Worker process did not return a WorkResponse:

---8<---8<--- Start of log, file at /private/var/tmp/_bazel_arun.sampathkumar/b612b0579661b9b8cf8dbfbec098862c/bazel-workers/worker-18-AndroidCompiledResourceMerger.log ---8<---8<---
Exception in thread "main" com.google.common.base.VerifyException: layout/activity_main.xml-0 is not a valid resource name. Expected ^((?<package>[^:]+):)?(?<type>\w+)/(?<name>[A-Za-z0-9_.$]+)$
        at com.google.common.base.Verify.verify(Verify.java:424)
        at com.google.devtools.build.android.ResourceName.parse(ResourceName.java:54)
        at com.google.devtools.build.android.AndroidCompiledDataDeserializer.consumeCompiledFile(AndroidCompiledDataDeserializer.java:530)
        at com.google.devtools.build.android.AndroidCompiledDataDeserializer.read(AndroidCompiledDataDeserializer.java:675)
        at com.google.devtools.build.android.SerializedAndroidData.deserialize(SerializedAndroidData.java:108)
        at com.google.devtools.build.android.AndroidResourceMerger.mergeCompiledData(AndroidResourceMerger.java:258)
        at com.google.devtools.build.android.AndroidCompiledResourceMergingAction.main(AndroidCompiledResourceMergingAction.java:231)
        at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$3.call(ResourceProcessorBusyBox.java:81)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:233)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.runPersistentWorker(ResourceProcessorBusyBox.java:198)
        at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:175)
---8<---8<--- End of log ---8<---8<---
Target //:app failed to build

Feature requests: what underlying problem are you trying to solve with this feature?

Ability to enable workers for android resource work for performance.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

databinding_workers.zip

bazelisk build app

# observe errors 

What operating system are you running Bazel on?

Mac OS Catalina

What's the output of bazel info release?

release 4.1.0

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

NA

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

NA

Have you found anything relevant by searching the web?

TBA

Any other information, logs, or outputs that you want to share?

Bazel Rc contents

build --verbose_failures
build --nouse_workers_with_dexbuilder
build --incompatible_disable_depset_items
build --strategy=Desugar=sandboxed

# Databinding flags
build --experimental_android_databinding_v2
build --android_databinding_use_v3_4_args
#build --android_databinding_use_androidx

# Flags to enable latest android providers in rules
build --experimental_google_legacy_api

build --persistent_android_resource_processor

try-import local.bazelrc

Related #2694

arunkumar9t2 added a commit to arunkumar9t2/bazel that referenced this issue Oct 29, 2021
…ResourceCompiler when running with workers.

When `--persistent_android_resource_processor` is used alongside databinding, ResourceCompiler reads `databinding-processed-resources` during resource merging and that folder can contain ``*.params` file for each processed layout resource. This causes resource compiler's file name validation to fail. This CL simply ignores staging the intermediate files for resource compilation.

Additionally this CL also excludes *.tmp files which were observed when using dynamic execution.

Fixes bazelbuild#13649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants