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

Đang mở
#431 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp, java
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với các tệp Bazel được tham chiếu, src/tools/singlejar/output_jar.cc và src/tools/singlejar/output_jar_simple_test.cc, rồi kiểm tra test hiện có quanh dòng 646. Tái hiện việc lọc META-INF/MANIFEST.MF và so sánh kết quả với entry bị loại trừ được mong đợi. Hoàn thành nghĩa là regression đã được bao phủ và bộ lọc không còn để manifest đó lại trong output JAR.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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). 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:

_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.

Ngôn ngữ chính
Java
Star
205
Fork
113
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bazelbuild/rules_android

Tất cả issue của bazelbuild/rules_android

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.