fork-openpgpjs/scripts/minimize.sh
Brian Bloniarz ef3c0ecc60 minimize.sh make file ordering deterministic
Do find | sort | cat instead of find -exec cat when building
resources/openpgp.js. The order of files returned by find isn't
deterministic, which could lead to spurious differences.
2013-02-13 22:34:35 -08:00

20 lines
494 B
Bash
Executable File

#!/bin/bash
echo "Setup..."
_src="src";
_tmp="resources/openpgp.js.tmp";
_raw="resources/openpgp.js";
_min="resources/openpgp.min.js";
_compiler="resources/compiler.jar";
_majorVersion=".1"
:>"$_raw"
:>"$_min"
echo "Concatenating..."
find "$_src" -name "*.js" | sort | xargs --delimiter='\n' cat > "$_tmp"
sed "s/OpenPGP.js VERSION/OpenPGP.js v$_majorVersion.$(date +%Y%m%d)/g" "$_tmp" > "$_raw";
rm "$_tmp";
echo "Minimizing..."
java -jar "$_compiler" --js "$_raw" --js_output_file "$_min"