diff options
author | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-03-08 15:06:54 -0500 |
---|---|---|
committer | Tristan Sloughter <tristan.sloughter@gmail.com> | 2015-03-08 15:06:54 -0500 |
commit | 963f9754233b53933e7febda350666400f439fdd (patch) | |
tree | 2b81916a49b1c7625277b4e4f940a481c9601d75 /src/rebar_prv_compile.erl | |
parent | 5f61bd5b0610a2fd0d8f558fb84864133e625304 (diff) | |
parent | ab84fc89ccf7fbbff8457afefdc301e37de6a6c9 (diff) |
Merge pull request #249 from talentdeficit/compile_from_build
compile source from the symlinked directories under `_build`
Diffstat (limited to 'src/rebar_prv_compile.erl')
-rw-r--r-- | src/rebar_prv_compile.erl | 12 |
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. |