generated: add (generated, scripts)
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Pull files from repo/hytale-server/src into vendor/hytale-server/src
|
||||
# Pull files from generated/ into src/
|
||||
# Only overrides files that exist in both locations
|
||||
# Run from project root
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
HYTALE_SERVER_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
PROJECT_ROOT="$(dirname "$(dirname "$HYTALE_SERVER_ROOT")")"
|
||||
PATCHED_SRC="vendor/hytale-server/src"
|
||||
GENERATED_SRC="vendor/hytale-server/generated"
|
||||
|
||||
SRC_DIR="$HYTALE_SERVER_ROOT/src"
|
||||
REPO_SRC="$PROJECT_ROOT/repo/hytale-server/src"
|
||||
|
||||
if [ ! -d "$SRC_DIR" ]; then
|
||||
echo "Error: src does not exist"
|
||||
if [ ! -d "$PATCHED_SRC" ]; then
|
||||
echo "Error: vendor/hytale-server/src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$REPO_SRC" ]; then
|
||||
echo "Error: repo/hytale-server/src does not exist"
|
||||
if [ ! -d "$GENERATED_SRC" ]; then
|
||||
echo "Error: vendor/hytale-server/generated does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -25,18 +22,18 @@ count=0
|
||||
|
||||
# Find all files in src
|
||||
while IFS= read -r -d '' file; do
|
||||
# Get relative path from SRC_DIR
|
||||
rel_path="${file#$SRC_DIR/}"
|
||||
# Get relative path from PATCHED_SRC
|
||||
rel_path="${file#$PATCHED_SRC/}"
|
||||
|
||||
# Check if corresponding file exists in repo
|
||||
repo_file="$REPO_SRC/$rel_path"
|
||||
# Check if corresponding file exists in generated
|
||||
generated_file="$GENERATED_SRC/$rel_path"
|
||||
|
||||
if [ -f "$repo_file" ]; then
|
||||
cp "$repo_file" "$file"
|
||||
if [ -f "$generated_file" ]; then
|
||||
cp "$generated_file" "$file"
|
||||
echo "Updated: $rel_path"
|
||||
count=$((count + 1))
|
||||
fi
|
||||
done < <(find "$SRC_DIR" -type f -print0)
|
||||
done < <(find "$PATCHED_SRC" -type f -print0)
|
||||
|
||||
echo ""
|
||||
echo "Done. Updated $count file(s)."
|
||||
|
||||
Reference in New Issue
Block a user