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

Aperta
#431 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp, java
Ambito
build-system

Direzione di ricerca

Inizia dai file Bazel indicati, src/tools/singlejar/output_jar.cc e src/tools/singlejar/output_jar_simple_test.cc, e analizza il test esistente intorno alla riga 646. Riproduci il filtraggio di META-INF/MANIFEST.MF e confronta il risultato con la voce esclusa prevista. Il lavoro è completato quando la regressione è coperta e il filtro non lascia più quel manifest nell'output JAR.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
205
Fork
113
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bazelbuild/rules_android

Tutte le issue di bazelbuild/rules_android

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.