This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
APP=$(basename "$PWD")
|
||||
|
||||
SRC="_build/default/lib/$APP"
|
||||
DST="$PWD/_build/zomp/lib/$APP"
|
||||
IGNORE_FILE="zomp.ignore"
|
||||
|
||||
mkdir -p "$DST"
|
||||
|
||||
# Remove broken symlinks
|
||||
find "$SRC" -type l ! -exec test -e {} \; -delete || true
|
||||
|
||||
# Build ignore matcher
|
||||
IGNORE_TEMP=$(mktemp)
|
||||
trap "rm -f $IGNORE_TEMP" EXIT
|
||||
|
||||
# Expand globs in zomp.ignore to patterns suitable for grep
|
||||
if [ -e "$IGNORE_FILE" ]; then
|
||||
grep -v '^\s*#' "$IGNORE_FILE" | sed 's#/#\\/#g' | sed 's/\./\\./g' | sed 's/\*/.*/g' > "$IGNORE_TEMP"
|
||||
fi
|
||||
|
||||
# Copy Git-tracked and Zomp-allowed files
|
||||
git ls-files -z | while IFS= read -r -d '' file; do
|
||||
# Skip if ignored
|
||||
echo "$file" | grep -Eq -f "$IGNORE_TEMP" && continue
|
||||
# Only copy if file exists in the build dir
|
||||
if [ -e "$SRC/$file" ]; then
|
||||
mkdir -p "$DST/$(dirname "$file")"
|
||||
cp -a "$SRC/$file" "$DST/$file"
|
||||
fi
|
||||
done
|
||||
|
||||
rm "$IGNORE_TEMP"
|
||||
|
||||
# Copy metadata
|
||||
cp "$PWD/zomp.meta" "$DST/"
|
||||
cp "$PWD/Emakefile" "$DST/"
|
||||
|
||||
# copy generated schema
|
||||
SCHEMA="$SRC/priv/gmhc_schema.json"
|
||||
if [ -e "$SCHEMA" ]; then
|
||||
mkdir -p "$DST/priv"
|
||||
cp -a "$SCHEMA" "$DST/priv/$(basename "$SCHEMA")"
|
||||
fi
|
||||
|
||||
# Clean up beam files just in case
|
||||
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true
|
||||
Reference in New Issue
Block a user