Skip to content

Support local plugins with is_umbrella settings #2729

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

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions src/rebar.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-define(DEFAULT_ROOT_DIR, ".").
-define(DEFAULT_PROJECT_APP_DIRS, ["apps/*", "lib/*", "."]).
-define(DEFAULT_PROJECT_PLUGIN_DIRS, ["plugins/*"]).
-define(DEFAULT_UMBRELLA, false).
-define(DEFAULT_CHECKOUTS_DIR, "_checkouts").
-define(DEFAULT_CHECKOUTS_OUT_DIR, "checkouts").
-define(DEFAULT_DEPS_DIR, "lib").
Expand Down
17 changes: 11 additions & 6 deletions src/rebar_plugins.erl
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,17 @@ is_umbrella(State) ->
%% So what we do here is look for the library directories without the ".",
%% and if none of these paths exist but one of the src_dirs exist, then
%% we know this is not an umbrella application.
Root = rebar_dir:root_dir(State),
LibPaths = lists:usort(rebar_dir:lib_dirs(State)) -- ["."],
SrcPaths = rebar_dir:src_dirs(rebar_state:opts(State), ["src"]),
lists:any(fun(Dir) -> [] == filelib:wildcard(filename:join(Root, Dir)) end, LibPaths)
andalso
lists:all(fun(Dir) -> not filelib:is_dir(filename:join(Root, Dir)) end, SrcPaths).
case rebar_state:get(State, is_umbrella, ?DEFAULT_UMBRELLA) of
?DEFAULT_UMBRELLA ->
Root = rebar_dir:root_dir(State),
LibPaths = lists:usort(rebar_dir:lib_dirs(State)) -- ["."],
SrcPaths = rebar_dir:src_dirs(rebar_state:opts(State), ["src"]),
lists:any(fun(Dir) -> [] == filelib:wildcard(filename:join(Root, Dir)) end, LibPaths)
andalso
lists:all(fun(Dir) -> not filelib:is_dir(filename:join(Root, Dir)) end, SrcPaths);
true ->
true
end.

prepare_plugin(AppInfo) ->
%% We need to handle plugins as dependencies to avoid re-building them
Expand Down