Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run compile provider in default namespace from bare #1810

Merged
merged 1 commit into from
Jun 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/rebar_prv_bare_compile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ do(State) ->

[AppInfo] = rebar_state:project_apps(State),
AppInfo1 = rebar_app_info:out_dir(AppInfo, rebar_dir:get_cwd()),
rebar_prv_compile:compile(State, AppInfo1),

%% run compile in the default namespace
rebar_prv_compile:compile(rebar_state:namespace(State, default), AppInfo1),

rebar_utils:cleanup_code_path(OrigPath),

Expand Down
19 changes: 18 additions & 1 deletion test/rebar_hooks_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
run_hooks_for_plugins/1,
eunit_app_hooks/1,
deps_hook_namespace/1,
bare_compile_hooks_default_ns/1,
deps_clean_hook_namespace/1]).

-include_lib("common_test/include/ct.hrl").
Expand All @@ -37,7 +38,7 @@ end_per_testcase(_, _Config) ->
all() ->
[build_and_clean_app, run_hooks_once, run_hooks_once_profiles,
escriptize_artifacts, run_hooks_for_plugins, deps_hook_namespace,
deps_clean_hook_namespace, eunit_app_hooks].
bare_compile_hooks_default_ns, deps_clean_hook_namespace, eunit_app_hooks].

%% Test post provider hook cleans compiled project app, leaving it invalid
build_and_clean_app(Config) ->
Expand Down Expand Up @@ -135,6 +136,22 @@ deps_hook_namespace(Config) ->
{ok, [{dep, "some_dep"}]}
).

%% tests that hooks to compile when running bare compile run in the default namespace
bare_compile_hooks_default_ns(Config) ->
AppDir = ?config(apps, Config),

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]),

RConfFile = rebar_test_utils:create_config(AppDir,
[{provider_hooks, [{post, [{compile, clean}]}]}]),
{ok, RConf} = file:consult(RConfFile),
rebar_test_utils:run_and_check(
Config, RConf, ["bare", "compile", "--paths", "."],
{ok, []}
).

deps_clean_hook_namespace(Config) ->
mock_git_resource:mock([{deps, [{some_dep, "0.0.1"}]}]),
Deps = rebar_test_utils:expand_deps(git, [{"some_dep", "0.0.1", []}]),
Expand Down