forked from OpenACD/OpenACD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhooks.sh
executable file
·107 lines (92 loc) · 1.93 KB
/
hooks.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
BASEDIR="$( cd "$( dirname "$0" )" && pwd)"
REBAR="$BASEDIR/rebar"
function do_included_apps {
for file in "$BASEDIR"/include_apps/*
do
echo "das file: $file"
cd "$file"
$REBAR "$1"
cd "$BASEDIR"
done
}
function post_compile {
do_included_apps "compile"
}
function pre_compile {
ebinDir="$BASEDIR/ebin"
if [ ! -d "$ebinDir" ]; then
mkdir "$ebinDir"
fi
for file in "$BASEDIR"/proto_src/*.proto
do
nameBase=`echo "$file" | sed -e "s/^proto_src\///"`
nameBase="src/${nameBase}"
if [ ! -e $nameBase -o $file -nt $nameBase ]
then
cp $file src/
fi
done
# hack for include_apps
# hack for reltool
oaDir="$BASEDIR/OpenACD"
if [ ! -d "$oaDir" ]; then
mkdir "$oaDir"
ln -sf ../ebin "$oaDir"/ebin
ln -sf ../src "$oaDir"/src
ln -sf ../include "$oaDir"/include
ln -sf ../priv "$oaDir"/priv
ln -sf ../deps "$oaDir"/deps
fi
# record what commit/version openacd is at
OPENACD_COMMIT=""
if [ -d ".git" ]
then
OPENACD_COMMIT=`git log -1 --pretty=format:%H`
fi
if [ -e "include/commit_ver.hrl" ] && [ ! $OPENACD_COMMIT ]
then
exit 0
else
if [ ! $OPENACD_COMMIT ]
then
OPENACD_COMMIT="undefined"
else
OPENACD_COMMIT="\"$OPENACD_COMMIT\""
fi
fi
echo "%% automatically generated by OpenACD precompile script. Editing means
%% it will just get overwritten again.
-define(OPENACD_COMMIT, $OPENACD_COMMIT)." > include/commit_ver.hrl
}
function pre_get-deps {
if [ "${GIT_UPDATE_DISABLED}" != "1" ]; then
echo "Updating submodules..."
cd "$BASEDIR"
git submodule init && git submodule update
cd -
fi
}
function post_get-deps {
do_included_apps "get-deps"
}
function pre_clean {
rm -rf "$BASEDIR/OpenACD"
}
function post_clean {
do_included_apps clean
}
case "$1" in
"pre_get-deps")
pre_get-deps;;
"post_get-deps")
post_get-deps;;
"pre_compile")
pre_compile;;
"post_compile")
post_compile;;
"pre_clean")
pre_clean;;
"post_clean")
post_clean;;
esac