mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Slightly different fix for bug#5 that avoids running preprocess twice
This commit is contained in:
parent
d6b79fb8c4
commit
a2f1b62d74
2 changed files with 7 additions and 15 deletions
|
@ -316,18 +316,6 @@ process_subdirs(Dir, Modules, Config, ModuleSetFile, Command, ProcessedDirs) ->
|
||||||
end,
|
end,
|
||||||
NewProcessedDirs = lists:foldl(F, sets:add_element(parent, ProcessedDirs), Dirs),
|
NewProcessedDirs = lists:foldl(F, sets:add_element(parent, ProcessedDirs), Dirs),
|
||||||
|
|
||||||
%% http://bitbucket.org/basho/rebar/issue/5
|
|
||||||
%% If the compiler ran, run the preprocess again because a new ebin dir
|
|
||||||
%% may have been produced.
|
|
||||||
%% {UpdatedConfig1, _} = case (Dirs =/= [] andalso compile == Command) of
|
|
||||||
%% true ->
|
|
||||||
%% acc_modules(Modules, preprocess, UpdatedConfig,
|
|
||||||
%% ModuleSetFile);
|
|
||||||
%% false ->
|
|
||||||
%% {UpdatedConfig, Dirs}
|
|
||||||
%% end,
|
|
||||||
UpdatedConfig1 = UpdatedConfig,
|
|
||||||
|
|
||||||
%% Make sure the CWD is reset properly; processing subdirs may have caused it
|
%% Make sure the CWD is reset properly; processing subdirs may have caused it
|
||||||
%% to change
|
%% to change
|
||||||
ok = file:set_cwd(Dir),
|
ok = file:set_cwd(Dir),
|
||||||
|
@ -339,11 +327,11 @@ process_subdirs(Dir, Modules, Config, ModuleSetFile, Command, ProcessedDirs) ->
|
||||||
false ->
|
false ->
|
||||||
%% Get the list of plug-in modules from rebar.config. These modules are
|
%% Get the list of plug-in modules from rebar.config. These modules are
|
||||||
%% processed LAST and do not participate in preprocess.
|
%% processed LAST and do not participate in preprocess.
|
||||||
{ok, PluginModules} = plugin_modules(UpdatedConfig1),
|
{ok, PluginModules} = plugin_modules(UpdatedConfig),
|
||||||
|
|
||||||
%% Finally, process the current working directory
|
%% Finally, process the current working directory
|
||||||
?DEBUG("Command: ~p Modules: ~p Plugins: ~p\n", [Command, Modules, PluginModules]),
|
?DEBUG("Command: ~p Modules: ~p Plugins: ~p\n", [Command, Modules, PluginModules]),
|
||||||
apply_command(Command, Modules ++ PluginModules, UpdatedConfig1, ModuleSetFile)
|
apply_command(Command, Modules ++ PluginModules, UpdatedConfig, ModuleSetFile)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
%% Repeat the process if there are new SeenDirs
|
%% Repeat the process if there are new SeenDirs
|
||||||
|
@ -351,7 +339,7 @@ process_subdirs(Dir, Modules, Config, ModuleSetFile, Command, ProcessedDirs) ->
|
||||||
true ->
|
true ->
|
||||||
ok;
|
ok;
|
||||||
false ->
|
false ->
|
||||||
process_subdirs(Dir, Modules, UpdatedConfig1, ModuleSetFile, Command,
|
process_subdirs(Dir, Modules, UpdatedConfig, ModuleSetFile, Command,
|
||||||
NewProcessedDirs)
|
NewProcessedDirs)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,10 @@ preprocess(AppSrcFile) ->
|
||||||
%% Setup file .app filename and write new contents
|
%% Setup file .app filename and write new contents
|
||||||
AppFile = rebar_app_utils:app_src_to_app(AppSrcFile),
|
AppFile = rebar_app_utils:app_src_to_app(AppSrcFile),
|
||||||
ok = file:write_file(AppFile, Spec),
|
ok = file:write_file(AppFile, Spec),
|
||||||
|
|
||||||
|
%% Make certain that the ebin/ directory is available on the code path
|
||||||
|
code:add_path(filename:absname(filename:dirname(AppFile))),
|
||||||
|
|
||||||
AppFile;
|
AppFile;
|
||||||
|
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
|
|
Loading…
Reference in a new issue