From d1409d0b3b2f7fe5c491f866ef983dd7df7d0f42 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Thu, 15 Oct 2015 23:32:43 -0700 Subject: 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 --- test/rebar_src_dirs_SUITE.erl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'test/rebar_src_dirs_SUITE.erl') diff --git a/test/rebar_src_dirs_SUITE.erl b/test/rebar_src_dirs_SUITE.erl index e29dcf0..5a00515 100644 --- a/test/rebar_src_dirs_SUITE.erl +++ b/test/rebar_src_dirs_SUITE.erl @@ -132,9 +132,9 @@ build_basic_app(Config) -> rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], {ok, [{app, Name}]}), - %% check that `extra.erl` was compiled to the `ebin` dir - Ebin = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]), - true = filelib:is_file(filename:join([Ebin, "extra.beam"])), + %% check that `extra.erl` was compiled to the `extra` dir + ExtraOut = filename:join([AppDir, "_build", "default", "lib", Name, "extra"]), + true = filelib:is_file(filename:join([ExtraOut, "extra.beam"])), %% check that `extra.erl` is not in the `modules` key of the app {ok, App} = file:consult(filename:join([AppDir, @@ -176,11 +176,11 @@ build_multi_apps(Config) -> ), %% check that `extraX.erl` was compiled to the `ebin` dir - Ebin1 = filename:join([AppDir, "_build", "default", "lib", Name1, "ebin"]), - true = filelib:is_file(filename:join([Ebin1, "extra1.beam"])), + ExtraOut1 = filename:join([AppDir, "_build", "default", "lib", Name1, "extra"]), + true = filelib:is_file(filename:join([ExtraOut1, "extra1.beam"])), - Ebin2 = filename:join([AppDir, "_build", "default", "lib", Name2, "ebin"]), - true = filelib:is_file(filename:join([Ebin2, "extra2.beam"])), + ExtraOut2 = filename:join([AppDir, "_build", "default", "lib", Name2, "extra"]), + true = filelib:is_file(filename:join([ExtraOut2, "extra2.beam"])), %% check that `extraX.erl` is not in the `modules` key of the app {ok, App1} = file:consult(filename:join([AppDir, @@ -221,10 +221,9 @@ src_dir_takes_precedence_over_extra(Config) -> rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], {ok, [{app, Name}]}), - %% check that `extra.erl` was compiled to the `ebin` dir - %% check that `extraX.erl` was compiled to the `ebin` dir - Ebin = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]), - true = filelib:is_file(filename:join([Ebin, "extra.beam"])), + %% check that `extra.erl` was compiled to the `extra` dir + ExtraOut = filename:join([AppDir, "_build", "default", "lib", Name, "extra"]), + true = filelib:is_file(filename:join([ExtraOut, "extra.beam"])), %% check that `extra.erl` is in the `modules` key of the app {ok, App} = file:consult(filename:join([AppDir, -- cgit v1.1