google / google/bazel-common

jarjar_runner.sh fails incorrectly on jars that contain files ending in ~

Open
#137 1 comment 0 reactions 0 assignees View on GitHub
bug P4
Dominant language
Starlark
Stars
91
Forks
45
Avg merge
14m
Merged PRs (30d)
7

Description

## Issue
When jarjar_runner.sh processes a jar that contains a file ending in `~`, it fails.

## BUILD.bazel:
```
jarjar_library(
name="test_shaded",
rules=[],
jars=["test2.jar"]
)
```
## Steps to reproduce:
```bash
mkdir jar
cd jar
touch test~ build-data.properties
jar cf test2.jar *
bazel build :test_shaded
```
```
INFO: Analyzed target //:test_shaded (0 packages loaded, 0 targets configured).
INFO: Found 1 target...

ERROR: /Users/*snip*/BUILD.bazel:11:15: Action test_shaded.jar failed: (Exit 1): bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Error: duplicate files in merged jar: test~
Target //:test_shaded failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.191s, Critical Path: 0.09s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
```

## Possible solution
It should be simple to use `comm` to filter out any files from `duplicate_files` that are present in any of the source jars.

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.