Skip to content

Commit

Permalink
Use apps directory for the apps
Browse files Browse the repository at this point in the history
Create a temporary apps directory for the OpenACD and
include_apps for lib_dir
  • Loading branch information
jvliwanag committed Jul 30, 2012
1 parent 1fb9b20 commit 7b8d7f5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -27,6 +27,7 @@ ebin
OpenACD/ OpenACD/
include/commit_ver.hrl include/commit_ver.hrl


apps/*
include_apps/**/doc include_apps/**/doc


# unique config files # unique config files
Expand Down Expand Up @@ -65,4 +66,4 @@ install-sh
missing missing


#editor swap files #editor swap files
*~ *~
42 changes: 22 additions & 20 deletions hooks.sh
Expand Up @@ -12,11 +12,11 @@ function pre_compile {


# record what commit/version openacd is at # record what commit/version openacd is at
OPENACD_COMMIT="" OPENACD_COMMIT=""
if [ -d ".git" ] if [ -d "$BASEDIR/.git" ]
then then
OPENACD_COMMIT=`git log -1 --pretty=format:%H` OPENACD_COMMIT=`git log -1 --pretty=format:%H`
fi fi
if [ -e "include/commit_ver.hrl" ] && [ ! $OPENACD_COMMIT ] if [ -e "$BASEDIR/include/commit_ver.hrl" ] && [ ! $OPENACD_COMMIT ]
then then
exit 0 exit 0
else else
Expand All @@ -30,7 +30,7 @@ function pre_compile {
echo "%% automatically generated by OpenACD precompile script. Editing means echo "%% automatically generated by OpenACD precompile script. Editing means
%% it will just get overwritten again. %% it will just get overwritten again.
-define(OPENACD_COMMIT, $OPENACD_COMMIT)." > include/commit_ver.hrl -define(OPENACD_COMMIT, $OPENACD_COMMIT)." > "$BASEDIR"/include/commit_ver.hrl
} }


function pre_get-deps { function pre_get-deps {
Expand All @@ -42,21 +42,29 @@ function pre_get-deps {
fi fi
} }


function pre_generate { function post_get-deps {
# hack for reltool # needed by rebar to be added to lib path
oaDir="$BASEDIR/OpenACD" mkdir -p "$BASEDIR/ebin"
if [ ! -d "$oaDir" ]; then
# create temp apps directory
appsDir="$BASEDIR/apps"
if [ ! -d "$appsDir" ]; then
mkdir -p "$appsDir"
ln -s "$BASEDIR"/include_apps/* "$appsDir"

oaDir="$appsDir"/OpenACD
mkdir "$oaDir" mkdir "$oaDir"
ln -sf ../ebin "$oaDir"/ebin ln -sf "$BASEDIR"/ebin "$oaDir"/ebin
ln -sf ../src "$oaDir"/src ln -sf "$BASEDIR"/src "$oaDir"/src
ln -sf ../include "$oaDir"/include ln -sf "$BASEDIR"/include "$oaDir"/include
ln -sf ../priv "$oaDir"/priv ln -sf "$BASEDIR"/priv "$oaDir"/priv
ln -sf ../deps "$oaDir"/deps ln -sf "$BASEDIR"/deps "$oaDir"/deps
fi fi
} }


function post_generate { function post_clean {
rm -rf "$BASEDIR/OpenACD" appsDir="$BASEDIR/apps"
rm -Rf "$appsDir"
} }


case "$1" in case "$1" in
Expand All @@ -68,12 +76,6 @@ case "$1" in
pre_compile;; pre_compile;;
"post_compile") "post_compile")
post_compile;; post_compile;;
"pre_clean")
pre_clean;;
"post_clean") "post_clean")
post_clean;; post_clean;;
"pre_generate")
pre_generate;;
"post_generate")
post_generate;;
esac esac
2 changes: 1 addition & 1 deletion include_apps/oacd_dummy/rebar.config
@@ -1,6 +1,6 @@
{erl_opts, [{src_dirs, ["contrib/"]}]}. {erl_opts, [{src_dirs, ["contrib/"]}]}.


{lib_dirs, ["../.."]}. {lib_dirs, ["../../apps"]}.


{post_hooks, [{compile, "cat success_message"}]}. {post_hooks, [{compile, "cat success_message"}]}.


Expand Down
3 changes: 1 addition & 2 deletions include_apps/oacd_freeswitch/rebar.config
@@ -1,7 +1,6 @@
{erl_opts, [{src_dirs, ["contrib/"]}]}. {erl_opts, [{src_dirs, ["contrib/"]}]}.


%{sub_dirs, ["rel"]}. {lib_dirs, ["../../apps", "../../deps"]}.
{lib_dirs, ["../..", "../../deps"]}.


{post_hooks, [{compile, "./hooks.sh post_compile"}]}. {post_hooks, [{compile, "./hooks.sh post_compile"}]}.


Expand Down
5 changes: 3 additions & 2 deletions rebar.config
Expand Up @@ -24,11 +24,12 @@
]}. ]}.


{pre_hooks, [ {pre_hooks, [
{compile, "./hooks.sh pre_compile"},
{'get-deps', "./hooks.sh pre_get-deps"}, {'get-deps', "./hooks.sh pre_get-deps"},
{clean, "./hooks.sh pre_clean"} {'compile', "./hooks.sh pre_compile"}
]}. ]}.
{post_hooks, [ {post_hooks, [
{'get-deps', "./hooks.sh post_get-deps"},
{clean, "./hooks.sh post_clean"}
]}. ]}.


{cover_enabled, true}. {cover_enabled, true}.
Expand Down
2 changes: 1 addition & 1 deletion rel/reltool.config
@@ -1,5 +1,5 @@
{sys, [ {sys, [
{lib_dirs, ["../deps", "..", "../include_apps"]}, {lib_dirs, ["../deps", "../apps"]},
{rel, "openacd", "1", {rel, "openacd", "1",
[ [
kernel, kernel,
Expand Down

0 comments on commit 7b8d7f5

Please sign in to comment.