Selaa lähdekoodia

Fix a bug in compiler path handling

Also handle some formatting
pull/1907/head
Fred Hebert 6 vuotta sitten
vanhempi
commit
311ee6b137
3 muutettua tiedostoa jossa 10 lisäystä ja 12 poistoa
  1. +3
    -4
      src/rebar_compiler.erl
  2. +6
    -7
      src/rebar_paths.erl
  3. +1
    -1
      src/rebar_prv_compile.erl

+ 3
- 4
src/rebar_compiler.erl Näytä tiedosto

@ -34,11 +34,10 @@
-define(RE_PREFIX, "^(?!\\._)").
compile_all(Compilers, AppInfo) ->
OutDir = rebar_utils:to_list(rebar_app_info:out_dir(AppInfo)),
EbinDir = rebar_utils:to_list(rebar_app_info:ebin_dir(AppInfo)),
%% Make sure that outdir is on the path
ok = rebar_file_utils:ensure_dir(OutDir),
true = code:add_patha(filename:absname(OutDir)),
ok = rebar_file_utils:ensure_dir(EbinDir),
true = code:add_patha(filename:absname(EbinDir)),
%% necessary for erlang:function_exported/3 to work as expected
%% called here for clarity as it's required by both opts_changed/2

+ 6
- 7
src/rebar_paths.erl Näytä tiedosto

@ -130,11 +130,10 @@ misloaded_modules(Mods, GoodAppPaths, ModPaths) ->
%% Identify paths that are invalid; i.e. app paths that cover an
%% app in the desired group, but are not in the desired group.
lists:usort(
[purge_mod(Mod)
|| Mod <- Mods,
{_, Path} <- [lists:keyfind(Mod, 1, ModPaths)],
is_list(Path), % not 'preloaded' or mocked
not any_prefix(Path, GoodAppPaths)]
[Mod || Mod <- Mods,
{_, Path} <- [lists:keyfind(Mod, 1, ModPaths)],
is_list(Path), % not 'preloaded' or mocked
not any_prefix(Path, GoodAppPaths)]
).
any_prefix(Path, Paths) ->
@ -168,10 +167,10 @@ get_apps(deps, State) ->
%% The code paths for deps also include the top level apps
%% and the extras, which we don't have here; we have to
%% add the apps by hand
rebar_state:all_deps(State) ++
case rebar_state:project_apps(State) of
undefined -> [];
List -> List
end;
end ++
rebar_state:all_deps(State);
get_apps(plugins, State) ->
rebar_state:all_plugin_deps(State).

+ 1
- 1
src/rebar_prv_compile.erl Näytä tiedosto

@ -115,7 +115,7 @@ copy_and_build_project_apps(State, Providers, Apps) ->
rebar_app_info:dir(AppInfo),
rebar_app_info:out_dir(AppInfo))
|| AppInfo <- Apps],
code:add_pathsa([rebar_app_info:out_dir(AppInfo) || AppInfo <- Apps]),
code:add_pathsa([rebar_app_info:ebin_dir(AppInfo) || AppInfo <- Apps]),
[compile(State, Providers, AppInfo) || AppInfo <- Apps].

Ladataan…
Peruuta
Tallenna