summaryrefslogtreecommitdiff
path: root/src/rebar_prv_compile.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_prv_compile.erl')
-rw-r--r--src/rebar_prv_compile.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 7c6802d..937b9bf 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -71,7 +71,7 @@ build_app(State, AppInfo) ->
AppDir = rebar_app_info:dir(AppInfo),
OutDir = rebar_app_info:out_dir(AppInfo),
- copy_app_dirs(AppDir, OutDir),
+ copy_app_dirs(State, AppDir, OutDir),
S = case rebar_app_info:state(AppInfo) of
undefined ->
@@ -91,7 +91,7 @@ build_app(State, AppInfo) ->
compile(State, AppInfo) ->
?INFO("Compiling ~s", [rebar_app_info:name(AppInfo)]),
- rebar_erlc_compiler:compile(State, ec_cnv:to_list(rebar_app_info:dir(AppInfo)), ec_cnv:to_list(rebar_app_info:out_dir(AppInfo))),
+ rebar_erlc_compiler:compile(State, ec_cnv:to_list(rebar_app_info:out_dir(AppInfo))),
case rebar_otp_app:compile(State, AppInfo) of
{ok, AppInfo1} ->
AppInfo1;
@@ -108,7 +108,7 @@ handle_args(State) ->
Jobs = proplists:get_value(jobs, Args, ?DEFAULT_JOBS),
{ok, rebar_state:set(State, jobs, Jobs)}.
-copy_app_dirs(OldAppDir, AppDir) ->
+copy_app_dirs(State, OldAppDir, AppDir) ->
case ec_cnv:to_binary(filename:absname(OldAppDir)) =/=
ec_cnv:to_binary(filename:absname(AppDir)) of
true ->
@@ -123,8 +123,10 @@ copy_app_dirs(OldAppDir, AppDir) ->
ok
end,
filelib:ensure_dir(filename:join(AppDir, "dummy")),
- %% link to src to be adjacent to ebin is needed for R15 use of cover/xref
- [symlink_or_copy(OldAppDir, AppDir, Dir) || Dir <- ["priv", "include", "src", "test"]];
+ %% link to src_dirs to be adjacent to ebin is needed for R15 use of cover/xref
+ ErlOpts = rebar_utils:erl_opts(State),
+ SrcDirs = proplists:get_value(src_dirs, ErlOpts, ["src"]),
+ [symlink_or_copy(OldAppDir, AppDir, Dir) || Dir <- ["priv", "include", "test"] ++ SrcDirs];
false ->
ok
end.