Skip to content

Asset exclusion in android targets is broken when --persistent_android_resource_processor is enabledΒ #310

@ThomasCJY

Description

@ThomasCJY

Description of the problem / feature request:

In android targets, we should be able to exclude certain resources from root directory. Example

assets = glob(
        ["assets/**"],
        exclude = [
              "assets/abc.txt", "**/.DS_Store"
        ]
),
assets_dir = "assets",

However, when --persistent_android_resource_processor is enabled. The exclude will not work.

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

I created a test branch to repro this issue. You can easily follow the steps in readme to repro it.

What operating system are you running Bazel on?

macos

What's the output of bazel info release?

bazelisk version 
Bazelisk version: v1.3.0
Build label: 4.2.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Aug 30 15:24:28 2021 (1630337068)
Build timestamp: 1630337068
Build timestamp as int: 1630337068

Investigation

This bug is caused by this line where we only parse the root directory of the assets and send them as data params into resource busy box processor. Considering the fact that resource merger only takes directory as the param, I think a possible fix would be copy and paste valid assets to a temporary folder and use that directory as the input param in the resource merge action.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority P2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions