From 3fe296294d00af43a148cb6ce83193805fd9ec56 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Tue, 11 Dec 2018 18:58:55 -0800 Subject: Initial commit --- scripts/combinejars | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/combinejars (limited to 'scripts') 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 +# +# 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" . -- cgit v1.2.3