-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·61 lines (43 loc) · 1.45 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /usr/bin/env sh
set -e
# set -x
OUT_DIR="${OUT_DIR:-$(pwd)/dist}"
SRC_DIR="${SRC_DIR:-$(pwd)}"
if [ ! -d "$SRC_DIR/CCEmuX" ]; then
git clone https://github.com/CCEmuX/CCEmuX.git "$SRC_DIR/CCEmuX"
FORCE_BUILD=1
fi
cd "$SRC_DIR/CCEmuX"
OLD_SHA=$(git rev-parse --verify HEAD)
git remote update --prune
git reset -q --hard origin/revival
NEW_SHA=$(git rev-parse --verify HEAD)
# Extract some useful information about the latest commit
NEW_SHA_SHORT=$(git rev-parse --verify --short=8 HEAD)
COMMIT_DATE=$(git show -s --format=%ad --date=short HEAD)
# Building the JAR
##############################
# Check to see if we have a new commit
if [ -n "$FORCE_BUILD" -o "$OLD_SHA" != "$NEW_SHA" ]
then
echo "Rebuilding JARs"
JAR_DIR="$SRC_DIR/CCEmuX/build/libs"
# Clean the build directory and recompile
rm -rf "$JAR_DIR"
./gradlew -q clean build
CC_JAR="$(find "$JAR_DIR" -type f -name '*-cc-min.jar')"
CCT_JAR="$(find "$JAR_DIR" -type f -name '*-cct-min.jar')"
# Deploy our new files
SUB_DIR="$OUT_DIR/versions/$NEW_SHA_SHORT"
mkdir -p "$SUB_DIR"
cp "$CC_JAR" "$SUB_DIR/CCEmuX-cc.jar"
cp "$CCT_JAR" "$SUB_DIR/CCEmuX-cct.jar"
fi
echo "$NEW_SHA_SHORT" > "$OUT_DIR/versions/latest"
# Website regeneration
##############################
echo "Rebuilding website"
# Now prepare to regenerate the site
cd $SRC_DIR
# And regenerate everything else
make "OUT=$OUT_DIR" "SHA_SHORT=$NEW_SHA_SHORT" "SHA=$NEW_SHA" "COMMIT_DATE=$COMMIT_DATE" "$OUT_DIR" -B