diff options
author | Jakob Odersky <jakob@odersky.com> | 2018-12-11 18:58:55 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2018-12-11 19:08:35 -0800 |
commit | 3fe296294d00af43a148cb6ce83193805fd9ec56 (patch) | |
tree | b053c0543c8c94db0f97d264ab910baffe8254a6 /scripts | |
download | scala-makefile-3fe296294d00af43a148cb6ce83193805fd9ec56.tar.gz scala-makefile-3fe296294d00af43a148cb6ce83193805fd9ec56.tar.bz2 scala-makefile-3fe296294d00af43a148cb6ce83193805fd9ec56.zip |
Initial commit
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/combinejars | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/combinejars b/scripts/combinejars new file mode 100755 index 0000000..338bd6d --- /dev/null +++ b/scripts/combinejars @@ -0,0 +1,26 @@ +#!/bin/bash +# Usage: combinejars <destination> <jars...> +# +# Combines contents of jars into a single destination jar. The +# destination jar will have all it entries dates set to the unix +# epoch, hence making it reproducible for the same input. +# +# Contents at same paths are overwritten, the latter overwriting the earlier. + +destination="$(realpath "$1")" +shift +sources=("$@") + +workdir="$(mktemp -d)" + +cleanup() { + rm -rf "$workdir" +} +trap cleanup EXIT + +for s in "${sources[@]}"; do + absolute=$(realpath "$s") + (cd "$workdir" || exit 1; unzip -uo "$absolute" > /dev/null) +done +find "$workdir" -exec touch -t 197001010000 {} \; +jar -cMf "$destination" -C "$workdir" . |