forked from xo/xo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen.sh
executable file
·53 lines (35 loc) · 964 Bytes
/
gen.sh
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
#!/bin/bash
set -e
EXTRA=$1
SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
XOBIN=$(which xo)
if [ -e $SRC/../../xo ]; then
XOBIN=$SRC/../../xo
fi
XO_ORACLE=$($XOBIN --has-oracle-support)
USQL_ORACLE=$(usql --has-oracle-support)
pushd $SRC &> /dev/null
for i in */config; do
i=$(dirname $i)
# skip
if [ -f $i/skip ]; then
continue
fi
# skip oracle if no oracle support
if [[ $i == "oracle" && ( "$XO_ORACLE" != "1" || "$USQL_ORACLE" != "1" ) ]]; then
continue
fi
source $i/config
MODELS=$i.xo.go
OUT=pokedex-$i
rm -f $OUT $MODELS
echo -e "------------------------------------------------------\n$i='$DB'"
echo -e "\nxo $DB --single-file -o $MODELS -p main -tags $i -x"
$XOBIN $EXTRA $DB --single-file -o $MODELS -p main -tags $i -x
echo -e "\ngo build -o $OUT -tags $i"
go build -o $OUT -tags $i
echo -e "\n./$OUT -url $DB"
./$OUT $EXTRA -url $DB
echo ""
done
popd &> /dev/null