summaryrefslogtreecommitdiff
path: root/src/rebar_prv_clean.erl
diff options
context:
space:
mode:
authoralisdair sullivan <alisdairsullivan@yahoo.ca>2015-10-15 23:32:43 -0700
committeralisdair sullivan <alisdairsullivan@yahoo.ca>2015-10-26 21:57:32 -0700
commitd1409d0b3b2f7fe5c491f866ef983dd7df7d0f42 (patch)
treed9267423c504dd0b61fd189396fa0cebf816ec67 /src/rebar_prv_clean.erl
parent621d8a94856df629a94fac7a77b68fd841267510 (diff)
refactor `rebar_erlc_compiler`
* modify compiler interface to work on either application objects or directories containing source files * compile all sources in `src_dirs` to the application `ebin` dir and all sources in `extra_src_dirs` to a directory mirroring it's position in the app's `_build` directory. for example, `apps/foo/more` would compile to `_build/default/lib/foo/more` for `extra_src_dirs` in the root of a project with multiple applications (so orphan directories that don't "belong" to an application) compile to `_build/default/extras/more` * copy directories specified in `extra_src_dirs` into the `_build` directory so tools like `ct` and `xref` that expect source to be in a particular location still work * clean compiled artifacts from all `extra_src_dirs` * alter `eunit`, `ct` and `cover` to work with the new directory structure * billions of new tests
Diffstat (limited to 'src/rebar_prv_clean.erl')
-rw-r--r--src/rebar_prv_clean.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rebar_prv_clean.erl b/src/rebar_prv_clean.erl
index a2b537a..6694dc0 100644
--- a/src/rebar_prv_clean.erl
+++ b/src/rebar_prv_clean.erl
@@ -49,6 +49,7 @@ do(State) ->
Cwd = rebar_dir:get_cwd(),
rebar_hooks:run_all_hooks(Cwd, pre, ?PROVIDER, Providers, State),
clean_apps(State, Providers, ProjectApps),
+ clean_extras(State),
rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, State),
{ok, State}.
@@ -66,10 +67,14 @@ clean_apps(State, Providers, Apps) ->
?INFO("Cleaning out ~s...", [rebar_app_info:name(AppInfo)]),
AppDir = rebar_app_info:dir(AppInfo),
AppInfo1 = rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, AppInfo, State),
- rebar_erlc_compiler:clean(rebar_app_info:out_dir(AppInfo1)),
+ rebar_erlc_compiler:clean(AppInfo1),
rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, AppInfo1, State)
end || AppInfo <- Apps].
+clean_extras(State) ->
+ BaseDir = rebar_dir:base_dir(State),
+ rebar_file_utils:rm_rf(filename:join([BaseDir, "extras"])).
+
handle_args(State) ->
{Args, _} = rebar_state:command_parsed_args(State),
All = proplists:get_value(all, Args, false),