-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate
executable file
·45 lines (36 loc) · 1.09 KB
/
generate
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
#!/bin/bash
# This script generates source code for each stage (aka version)
# the help of Feature Tool: https://bitbucket.org/ogstudio/feature-tool
# Make sure we have at least Bash 3.
if ((BASH_VERSINFO[0] < 3)); then
echo "ERROR You need to have Bash 3+"
exit 1
fi
DIR=`dirname $0`
# Stages may be treated as versions.
STAGES="
01.Editor
02.Share
03.Clean
"
# Directories with variants.
VARIANTS=()
for stage in $STAGES; do
echo "Generating '$stage' stage"
cfg=$DIR/$stage/Variants.txt
stageVariants=$DIR/$stage/variants
templates=$DIR/$stage/templates
# Collect variant directories each stage.
VARIANTS+=($stageVariants)
echo "> feature-tool --exclude-variant-ornament $cfg $templates ${VARIANTS[@]}"
feature-tool --exclude-variant-ornament $cfg $templates ${VARIANTS[@]}
# Execute stage specific `generate` script if it's present.
stageGenerate=$DIR/$stage/generate
if [ -f "$stageGenerate" ];
then
cwd=`pwd`
echo "Executing stage specific '$stageGenerate' script"
bash $stageGenerate "$DIR/$stage"
cd $cwd
fi
done