summaryrefslogtreecommitdiff
path: root/test/rebar_compile_SUITE.erl
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2015-03-08 15:06:54 -0500
committerTristan Sloughter <tristan.sloughter@gmail.com>2015-03-08 15:06:54 -0500
commit963f9754233b53933e7febda350666400f439fdd (patch)
tree2b81916a49b1c7625277b4e4f940a481c9601d75 /test/rebar_compile_SUITE.erl
parent5f61bd5b0610a2fd0d8f558fb84864133e625304 (diff)
parentab84fc89ccf7fbbff8457afefdc301e37de6a6c9 (diff)
Merge pull request #249 from talentdeficit/compile_from_build
compile source from the symlinked directories under `_build`
Diffstat (limited to 'test/rebar_compile_SUITE.erl')
-rw-r--r--test/rebar_compile_SUITE.erl27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl
index b42b6b7..2c5a11f 100644
--- a/test/rebar_compile_SUITE.erl
+++ b/test/rebar_compile_SUITE.erl
@@ -9,6 +9,7 @@
build_release_apps/1,
build_checkout_apps/1,
build_checkout_deps/1,
+ build_all_srcdirs/1,
recompile_when_opts_change/1,
dont_recompile_when_opts_dont_change/1,
dont_recompile_yrl_or_xrl/1]).
@@ -32,6 +33,7 @@ init_per_testcase(_, Config) ->
all() ->
[build_basic_app, build_release_apps,
build_checkout_apps, build_checkout_deps,
+ build_all_srcdirs,
recompile_when_opts_change, dont_recompile_when_opts_dont_change,
dont_recompile_yrl_or_xrl].
@@ -94,6 +96,31 @@ build_checkout_deps(Config) ->
Loaded = application:loaded_applications(),
{_, _, Vsn2} = lists:keyfind(list_to_atom(Name2), 1, Loaded).
+build_all_srcdirs(Config) ->
+ AppDir = ?config(apps, Config),
+
+ RebarConfig = [{erl_opts, [{src_dirs, ["src", "extra"]}]}],
+
+ Name = rebar_test_utils:create_random_name("app1_"),
+ Vsn = rebar_test_utils:create_random_vsn(),
+ rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]),
+
+ ExtraSrc = <<"-module(extra_src).\n"
+ "-export([ok/0]).\n"
+ "ok() -> ok.\n">>,
+
+ ok = filelib:ensure_dir(filename:join([AppDir, "extra", "dummy"])),
+ ok = file:write_file(filename:join([AppDir, "extra", "extra_src.erl"]), ExtraSrc),
+
+ rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], {ok, [{app, Name}]}),
+
+ %% check a beam corresponding to the src in the extra src_dir exists in ebin
+ EbinDir = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]),
+ true = filelib:is_file(filename:join([EbinDir, "extra_src.beam"])),
+
+ %% check the extra src_dir was linked into the _build dir
+ true = filelib:is_dir(filename:join([AppDir, "_build", "default", "lib", Name, "extra"])).
+
recompile_when_opts_change(Config) ->
AppDir = ?config(apps, Config),