diff options
-rw-r--r-- | src/rebar.hrl | 2 | ||||
-rw-r--r-- | src/rebar_app_discover.erl | 12 | ||||
-rw-r--r-- | test/rebar_compile_SUITE.erl | 8 | ||||
-rw-r--r-- | test/rebar_deps_SUITE.erl | 4 | ||||
-rw-r--r-- | test/rebar_dialyzer_SUITE.erl | 4 | ||||
-rw-r--r-- | test/rebar_eunit_SUITE.erl | 38 | ||||
-rw-r--r-- | test/rebar_src_dirs_SUITE.erl | 12 | ||||
-rw-r--r-- | test/rebar_test_utils.erl | 8 |
8 files changed, 40 insertions, 48 deletions
diff --git a/src/rebar.hrl b/src/rebar.hrl index 4540b1a..8a702df 100644 --- a/src/rebar.hrl +++ b/src/rebar.hrl @@ -15,7 +15,7 @@ -define(DEFAULT_BASE_DIR, "_build"). -define(DEFAULT_ROOT_DIR, "."). --define(DEFAULT_PROJECT_APP_DIRS, ["apps", "lib", "."]). +-define(DEFAULT_PROJECT_APP_DIRS, ["apps/*", "lib/*", "."]). -define(DEFAULT_CHECKOUTS_DIR, "_checkouts"). -define(DEFAULT_DEPS_DIR, "lib"). -define(DEFAULT_PLUGINS_DIR, "plugins"). diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index 9c4a5ff..f55a4d5 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -94,25 +94,17 @@ all_app_dirs(LibDirs) -> app_dirs(LibDir) -> Path1 = filename:join([LibDir, - "*", - "src", - "*.app.src"]), - Path2 = filename:join([LibDir, "src", "*.app.src"]), - Path3 = filename:join([LibDir, - "*", - "ebin", - "*.app"]), - Path4 = filename:join([LibDir, + Path2 = filename:join([LibDir, "ebin", "*.app"]), lists:usort(lists:foldl(fun(Path, Acc) -> Files = filelib:wildcard(ec_cnv:to_list(Path)), [app_dir(File) || File <- Files] ++ Acc - end, [], [Path1, Path2, Path3, Path4])). + end, [], [Path1, Path2])). find_unbuilt_apps(LibDirs) -> find_apps(LibDirs, invalid). diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl index 3f95e4f..2c42549 100644 --- a/test/rebar_compile_SUITE.erl +++ b/test/rebar_compile_SUITE.erl @@ -65,10 +65,10 @@ build_release_apps(Config) -> Name1 = rebar_test_utils:create_random_name("relapp1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]), + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("relapp2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name2]), Name2, Vsn2, [kernel, stdlib]), + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), rebar_test_utils:run_and_check( Config, [], ["compile"], @@ -80,7 +80,7 @@ build_checkout_apps(Config) -> CheckoutsDir = ?config(checkouts, Config), Name1 = rebar_test_utils:create_random_name("checkapp1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]), + rebar_test_utils:create_app(AppDir, Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("checkapp2_"), Vsn2 = rebar_test_utils:create_random_vsn(), rebar_test_utils:create_app(filename:join([CheckoutsDir,Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -96,7 +96,7 @@ build_checkout_deps(Config) -> DepsDir = filename:join([AppDir, "_build", "default", "lib"]), Name1 = rebar_test_utils:create_random_name("checkapp1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]), + rebar_test_utils:create_app(AppDir, Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("checkapp2_"), Vsn2 = rebar_test_utils:create_random_vsn(), rebar_test_utils:create_app(filename:join([CheckoutsDir,Name2]), Name2, Vsn2, [kernel, stdlib]), diff --git a/test/rebar_deps_SUITE.erl b/test/rebar_deps_SUITE.erl index 73c4980..004d50b 100644 --- a/test/rebar_deps_SUITE.erl +++ b/test/rebar_deps_SUITE.erl @@ -222,7 +222,7 @@ sub_app_deps(Config) -> Name = rebar_test_utils:create_random_name("sub_app1_"), Vsn = rebar_test_utils:create_random_vsn(), - SubAppsDir = filename:join([AppDir, Name]), + SubAppsDir = filename:join([AppDir, "apps", Name]), SubDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []} ,{"b", "2.0.0", []}])), rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]), @@ -246,7 +246,7 @@ newly_added_dep(Config) -> Name = rebar_test_utils:create_random_name("app_"), Vsn = rebar_test_utils:create_random_vsn(), - SubAppsDir = filename:join([AppDir, Name]), + SubAppsDir = filename:join([AppDir, "apps", Name]), rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]), TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"b", "1.0.0", []}])), diff --git a/test/rebar_dialyzer_SUITE.erl b/test/rebar_dialyzer_SUITE.erl index 1160d2d..3158e8f 100644 --- a/test/rebar_dialyzer_SUITE.erl +++ b/test/rebar_dialyzer_SUITE.erl @@ -112,11 +112,11 @@ build_release_plt(Config) -> Name1 = rebar_test_utils:create_random_name("relapp1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [erts]), Name2 = rebar_test_utils:create_random_name("relapp2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name2]), Name2, Vsn2, + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [erts, ec_cnv:to_atom(Name1)]), rebar_test_utils:run_and_check(Config, RebarConfig, ["dialyzer"], diff --git a/test/rebar_eunit_SUITE.erl b/test/rebar_eunit_SUITE.erl index ac74146..79decac 100644 --- a/test/rebar_eunit_SUITE.erl +++ b/test/rebar_eunit_SUITE.erl @@ -59,13 +59,13 @@ test_multi_app(Config) -> Name1 = rebar_test_utils:create_random_name("multi_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -117,13 +117,13 @@ test_multi_exports(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -172,13 +172,13 @@ test_multi_defines(Config) -> Name1 = rebar_test_utils:create_random_name("multi_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -208,13 +208,13 @@ test_single_app_flag(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -245,13 +245,13 @@ test_multiple_app_flag(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -288,7 +288,7 @@ test_nonexistent_app_flag(Config) -> [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -306,13 +306,13 @@ test_single_suite_flag(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -331,13 +331,13 @@ test_suite_in_app_flag(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -360,13 +360,13 @@ test_suite_in_wrong_app_flag(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), @@ -388,13 +388,13 @@ test_nonexistent_suite_flag(Config) -> Name1 = rebar_test_utils:create_random_name("multi_exports_app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name1]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("multi_exports_app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_eunit_app(filename:join([AppDir,Name2]), + rebar_test_utils:create_eunit_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), diff --git a/test/rebar_src_dirs_SUITE.erl b/test/rebar_src_dirs_SUITE.erl index 1804fbf..e322190 100644 --- a/test/rebar_src_dirs_SUITE.erl +++ b/test/rebar_src_dirs_SUITE.erl @@ -153,17 +153,17 @@ build_multi_apps(Config) -> Name1 = rebar_test_utils:create_random_name("app1_"), Vsn1 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]), + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, [kernel, stdlib]), Name2 = rebar_test_utils:create_random_name("app2_"), Vsn2 = rebar_test_utils:create_random_vsn(), - rebar_test_utils:create_app(filename:join([AppDir,Name2]), Name2, Vsn2, [kernel, stdlib]), + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, [kernel, stdlib]), - Extra1 = filename:join([AppDir, Name1, "extra", "extra1.erl"]), + Extra1 = filename:join([AppDir, "apps", Name1, "extra", "extra1.erl"]), ok = filelib:ensure_dir(Extra1), Src1 = io_lib:format("-module(extra1).~n-export([x/0]).~nx() -> ok.", []), ok = ec_file:write(Extra1, Src1), - Extra2 = filename:join([AppDir, Name2, "extra", "extra2.erl"]), + Extra2 = filename:join([AppDir, "apps", Name2, "extra", "extra2.erl"]), ok = filelib:ensure_dir(Extra2), Src2 = io_lib:format("-module(extra2).~n-export([x/0]).~nx() -> ok.", []), ok = ec_file:write(Extra2, Src2), @@ -178,7 +178,7 @@ 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"])), - + Ebin2 = filename:join([AppDir, "_build", "default", "lib", Name2, "ebin"]), true = filelib:is_file(filename:join([Ebin2, "extra2.beam"])), @@ -236,4 +236,4 @@ src_dir_takes_precedence_over_extra(Config) -> Name ++ ".app"])), [{application, _, KVs}] = App, Mods = proplists:get_value(modules, KVs), - true = lists:member(extra, Mods).
\ No newline at end of file + true = lists:member(extra, Mods). diff --git a/test/rebar_test_utils.erl b/test/rebar_test_utils.erl index 4a13e03..3fdb547 100644 --- a/test/rebar_test_utils.erl +++ b/test/rebar_test_utils.erl @@ -169,10 +169,10 @@ top_level_deps([{{Name, Vsn, Ref}, _} | Deps]) -> %%% Helpers %%% %%%%%%%%%%%%%%% check_results(AppDir, Expected, ProfileRun) -> - BuildDirs = filelib:wildcard(filename:join([AppDir, "_build", ProfileRun, "lib"])), - PluginDirs = filelib:wildcard(filename:join([AppDir, "_build", ProfileRun, "plugins"])), - GlobalPluginDirs = filelib:wildcard(filename:join([AppDir, "global", "plugins"])), - CheckoutsDir = filename:join([AppDir, "_checkouts"]), + BuildDirs = filelib:wildcard(filename:join([AppDir, "_build", ProfileRun, "lib", "*"])), + PluginDirs = filelib:wildcard(filename:join([AppDir, "_build", ProfileRun, "plugins", "*"])), + GlobalPluginDirs = filelib:wildcard(filename:join([AppDir, "global", "plugins", "*"])), + CheckoutsDir = filename:join([AppDir, "_checkouts", "*"]), LockFile = filename:join([AppDir, "rebar.lock"]), Locks = lists:flatten(rebar_config:consult_lock_file(LockFile)), |