-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·51 lines (43 loc) · 1.07 KB
/
build.sh
File metadata and controls
executable file
·51 lines (43 loc) · 1.07 KB
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
#!/bin/bash
function die { echo "$@"; exit 1; };
if [[ "$#" != "2" ]]; then
die "Usage: ${0} <branch> <commit>"
fi
BRANCH="${1}"
shift
COMMIT="${1}"
shift
mkdir -p "output"
cd scripts || die "Failed to cd into scripts folder";
find . -maxdepth 1 -name '*.gradle' | while read -r z; do
gpp -o "../output/${z}" \
-U "#[" "]" "(" "," ")]" "(" ")" "#" "" \
-M "#" "\n" " " " " "\n" "(" ")" \
-D "MODUTILS_VERSION=${BRANCH}" \
-D "MODUTILS_COMMIT=${COMMIT}" \
+ssss "'''" "'''" "\\" +sSSS '"""' '"""' "\\" \
+ssss "'" "'" "\\" +sSSS '"' '"' "\\" \
--include "../build.h" \
--nostdinc +z \
"${z}"
EC="$?"
if [[ "${EC}" != "0" ]]; then
exit "${EC}"
fi
grep 'import' "../output/${z}" > /dev/null
EC="$?"
if [[ "${EC}" == "0" ]]; then
grep -n 'import' "../output/${z}"
echo ""
echo "Imports are not allowed in ${z}"
exit 1
fi
grep '#\[' "../output/${z}" > /dev/null
EC="$?"
if [[ "${EC}" == "0" ]]; then
grep -n '#\[' "../output/${z}"
echo ""
echo "Unapplied macro detected in ${z}"
exit 1
fi
done