mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Search plugin sources in base_dir and plugin_dir
This commit is contained in:
parent
00b3d9d3cc
commit
93128f2f6b
2 changed files with 13 additions and 4 deletions
|
@ -407,10 +407,14 @@ load_plugin_modules(Config, Modules) ->
|
|||
Dir
|
||||
end,
|
||||
|
||||
%% Find relevant sources
|
||||
%% Find relevant sources in base_dir and plugin_dir
|
||||
Erls = string:join([atom_to_list(M)++"\\.erl" || M <- Modules], "|"),
|
||||
RE = ".*" ++ Erls ++ "\$",
|
||||
Sources = rebar_utils:find_files(PluginDir, RE),
|
||||
RE = "^" ++ Erls ++ "\$",
|
||||
BaseDir = rebar_config:get_global(base_dir, []),
|
||||
%% If a plugin is found in base_dir and plugin_dir the clash
|
||||
%% will provoke an error and we'll abort.
|
||||
Sources = rebar_utils:find_files(PluginDir, RE, false)
|
||||
++ rebar_utils:find_files(BaseDir, RE, false),
|
||||
|
||||
%% Compile and load plugins
|
||||
Loaded = [load_plugin(Src) || Src <- Sources],
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
wordsize/0,
|
||||
sh/2,
|
||||
find_files/2,
|
||||
find_files/3,
|
||||
now_str/0,
|
||||
ensure_dir/1,
|
||||
beam_to_mod/2, beams/1,
|
||||
|
@ -127,7 +128,11 @@ patch_on_windows(Cmd, Env) ->
|
|||
end.
|
||||
|
||||
find_files(Dir, Regex) ->
|
||||
filelib:fold_files(Dir, Regex, true, fun(F, Acc) -> [F | Acc] end, []).
|
||||
find_files(Dir, Regex, true).
|
||||
|
||||
find_files(Dir, Regex, Recursive) ->
|
||||
filelib:fold_files(Dir, Regex, Recursive,
|
||||
fun(F, Acc) -> [F | Acc] end, []).
|
||||
|
||||
now_str() ->
|
||||
{{Year, Month, Day}, {Hour, Minute, Second}} = calendar:local_time(),
|
||||
|
|
Loading…
Reference in a new issue