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

Abierto
#431 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 6 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
cpp, java
Área
build-system

Línea de trabajo

Comienza con los archivos Bazel referenciados, src/tools/singlejar/output_jar.cc y src/tools/singlejar/output_jar_simple_test.cc, e inspecciona la prueba existente alrededor de la línea 646. Reproduce el filtrado de META-INF/MANIFEST.MF y compara el resultado con la entrada excluida esperada. Se considera terminado cuando la regresión está cubierta y el filtro ya no deja ese manifiesto en el output JAR.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
205
Forks
113
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bazelbuild/rules_android

Todos los issues de bazelbuild/rules_android

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.