bazelbuild / bazelbuild/rules_android

Bug: Unable to Exclude `META-INF/MANIFEST.MF` in ZipFilterAction After rules_android v0.6.5 Update

Open
#431 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
203
Forks
95
PR merge metrics
No merged PRs in 30d

Description

### Description
Since the update to rules_android v0.6.5, which migrates the `ZipFilterAction` to use the C++ singlejar implementation instead of the legacy Java implementation, we are unable to successfully exclude the `META-INF/MANIFEST.MF` file using zip filters.

The new C++ singlejar implementation incorporates logic from the upstream Bazel change ([bazelbuild/bazel@1a70d7e](https://github.com/bazelbuild/bazel/commit/1a70d7e5e3d977e054fc18f925f3e7c3fc452370)). Specifically, the output_jar.cc source file appears to contain logic that persists the META-INF/MANIFEST.MF file in the output JAR, effectively ignoring any defined filter for this specific path:

Relevant code in Bazel: https://github.com/bazelbuild/bazel/blob/1a70d7e5e3d977e054fc18f925f3e7c3fc452370/src/tools/singlejar/output_jar.cc#L68

This change breaks existing build configurations that rely on excluding this manifest file during JAR merging/filtering operations.

### Reproduction
The issue can be observed when attempting to filter out META-INF/MANIFEST.MF in a rule using _common.filter_zip_exclude:

#### Example Code Snippet:
```Python

_common.filter_zip_exclude(
ctx,
out,
merged_jar,
filters = ["META-INF/MANIFEST.MF"] + exclude_filters,
)
```
Expected Result: The resulting out JAR file should not contain META-INF/MANIFEST.MF.
Actual Result: The resulting out JAR file still contains `META-INF/MANIFEST.MF`.

#### Simple Reproduction (Based on Bazel's Code)
Take the existing simple unit test for output_jar in Bazel: https://github.com/bazelbuild/bazel/blob/1a70d7e5e3d977e054fc18f925f3e7c3fc452370/src/tools/singlejar/output_jar_simple_test.cc#L646.

Add a new test case that attempts to filter out the META-INF/MANIFEST.MF entry.

The test case will fail, demonstrating that the exclusion filter is ignored for this specific entry.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.