diff options
7 files changed, 59 insertions, 5 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index 1c02a48..441521b 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -411,12 +411,13 @@ try_handle_app_src_file(_AppInfo, _, _AppDir, _AppSrcFile, valid) -> false; try_handle_app_src_file(AppInfo, _, AppDir, [File], Validate) when Validate =:= invalid ; Validate =:= all -> - AppInfo1 = create_app_info(AppInfo, AppDir, File), + AppInfo1 = rebar_app_info:app_file(AppInfo, undefined), + AppInfo2 = create_app_info(AppInfo1, AppDir, File), case filename:extension(File) of ".script" -> - {true, rebar_app_info:app_file_src_script(AppInfo1, File)}; + {true, rebar_app_info:app_file_src_script(AppInfo2, File)}; _ -> - {true, rebar_app_info:app_file_src(AppInfo1, File)} + {true, rebar_app_info:app_file_src(AppInfo2, File)} end; try_handle_app_src_file(_AppInfo, _, _AppDir, Other, _Validate) -> throw({error, {multiple_app_files, Other}}). diff --git a/systest/all_SUITE.erl b/systest/all_SUITE.erl index 6d2f14f..083fae9 100644 --- a/systest/all_SUITE.erl +++ b/systest/all_SUITE.erl @@ -12,7 +12,7 @@ init_per_suite(Config) -> ["rebar", Vsn | _] -> %% Copy all base cases to priv_dir rebar_file_utils:cp_r([?config(data_dir, Config)], - ?config(priv_dir, Config)), + ?config(priv_dir, Config)), Config; _ -> {skip, "expected current version "++Vsn++" in path " @@ -29,7 +29,7 @@ end_per_testcase(_Name, Config) -> Config. all() -> - [noop, resource_plugins, alias_clash, grisp_explode]. + [noop, resource_plugins, alias_clash, grisp_explode, compile_deps]. %groups() -> % [{plugins, [shuffle], []}, @@ -79,6 +79,19 @@ grisp_explode(Config) -> ), ok. +compile_deps() -> + [{doc, "When compiling a project multiple times, the deps should always be built event if refetched"}]. +compile_deps(Config) -> + rebar3("compile", Config), + rebar3("compile", Config), + + PrivDir = ?config(path, Config), + EbinDir = filename:join([PrivDir, "_build", "default", "lib", "fake_dep", "ebin"]), + + {ok, Beams} = file:list_dir(EbinDir), + ?assert(length(Beams) > 1). + + %%%%%%%%%%%%%%% %%% Helpers %%% %%%%%%%%%%%%%%% diff --git a/systest/all_SUITE_data/compile_deps/rebar.config b/systest/all_SUITE_data/compile_deps/rebar.config new file mode 100644 index 0000000..08e2f62 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/rebar.config @@ -0,0 +1,8 @@ +{deps, [ + {fake_dep, {localdep, "fake_dep"}} + ]}. + +{plugins, [{rebar_localdep, + {git, "https://github.com/alinpopa/rebar3-localdep-plugin.git", + {branch, "master"}}}]}. + diff --git a/systest/all_SUITE_data/compile_deps/rebar.config.script b/systest/all_SUITE_data/compile_deps/rebar.config.script new file mode 100644 index 0000000..c0ebab1 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/rebar.config.script @@ -0,0 +1,2 @@ +os:putenv("LOCALDEP_DIR", "./vendored/"). +CONFIG. diff --git a/systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config new file mode 100644 index 0000000..f618f3e --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/rebar.config @@ -0,0 +1,2 @@ +{erl_opts, [debug_info]}. +{deps, []}.
\ No newline at end of file diff --git a/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src new file mode 100644 index 0000000..8547c35 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.app.src @@ -0,0 +1,15 @@ +{application, fake_dep, + [{description, "An OTP library"}, + {vsn, "0.1.0"}, + {registered, []}, + {applications, + [kernel, + stdlib + ]}, + {env,[]}, + {modules, []}, + + {maintainers, []}, + {licenses, ["Apache 2.0"]}, + {links, []} + ]}. diff --git a/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl new file mode 100644 index 0000000..db8d9f0 --- /dev/null +++ b/systest/all_SUITE_data/compile_deps/vendored/fake_dep/src/fake_dep.erl @@ -0,0 +1,13 @@ +-module(fake_dep). + +%% API exports +-export([]). + +%%==================================================================== +%% API functions +%%==================================================================== + + +%%==================================================================== +%% Internal functions +%%==================================================================== |