diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-02-23 21:48:46 -0500 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2017-02-23 22:23:45 -0500 |
commit | 1810ae30abdddc95dc93d96f5c9d0f27182f0e62 (patch) | |
tree | cb517e9d68ebf4a8df6baee1786328982b354257 /test | |
parent | e498f603df66be8fa662fb4eafa9e2d6cef2d222 (diff) |
Fix detection of src_dirs in unknown apps/deps
First find the rebar.config file, and if any data is found, check for
src_dirs config. If nothing is there or no app is found, default to src/
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_src_dirs_SUITE.erl | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/test/rebar_src_dirs_SUITE.erl b/test/rebar_src_dirs_SUITE.erl index 1982301..677dbaf 100644 --- a/test/rebar_src_dirs_SUITE.erl +++ b/test/rebar_src_dirs_SUITE.erl @@ -15,7 +15,8 @@ extra_src_dirs_at_root_and_in_erl_opts/1, build_basic_app/1, build_multi_apps/1, - src_dir_takes_precedence_over_extra/1]). + src_dir_takes_precedence_over_extra/1, + src_dir_checkout_dep/1]). -include_lib("common_test/include/ct.hrl"). @@ -39,7 +40,8 @@ all() -> src_dirs_at_root_and_in_erl_opts, dupe_src_dirs_at_root_and_in_erl_opts, extra_src_dirs_at_root_and_in_erl_opts, - build_basic_app, build_multi_apps, src_dir_takes_precedence_over_extra]. + build_basic_app, build_multi_apps, src_dir_takes_precedence_over_extra, + src_dir_checkout_dep]. src_dirs_at_root(Config) -> AppDir = ?config(apps, Config), @@ -271,3 +273,37 @@ src_dir_takes_precedence_over_extra(Config) -> [{application, _, KVs}] = App, Mods = proplists:get_value(modules, KVs), true = lists:member(extra, Mods). + +src_dir_checkout_dep(Config) -> + AppDir = ?config(apps, Config), + AppName = rebar_test_utils:create_random_name("src_dir_checkout_app"), + DepName = rebar_test_utils:create_random_name("src_dir_checkout_dep"), + AtomDep = list_to_atom(DepName), + + Vsn = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(AppDir, AppName, Vsn, [kernel, stdlib]), + RebarConfig = [{deps, [AtomDep]}], + + DepDir = filename:join([?config(checkouts, Config), DepName]), + ct:pal("checkouts dir: ~p", [DepDir]), + rebar_test_utils:create_app(DepDir, DepName, Vsn, [kernel, stdlib]), + + + %% move the .app.src file to one of the subdirs, out of src/ + rebar_file_utils:mv(filename:join([DepDir, "src"]), + filename:join([DepDir, "qux"])), + DepRebarConfig = [{erl_opts, [{src_dirs, ["foo", "bar"]}]}, + {src_dirs, ["baz", "qux"]}], + file:write_file(filename:join([DepDir, "rebar.config"]), + io_lib:format("~p.~n~p.~n", DepRebarConfig)), + + rebar_test_utils:run_and_check( + Config, RebarConfig, ["compile"], + {ok, [{checkout, DepName}, {app, AppName}]} + ), + + % {ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return), + % ["bar", "baz", "foo", "qux"] = rebar_dir:src_dirs(rebar_state:opts(State), []), + % rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], + % {ok, [{app, Name}]}), + ok. |