aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md17
-rw-r--r--rebar.config2
-rw-r--r--src/rcl_app_discovery.erl10
-rw-r--r--src/rcl_app_info.erl1
-rw-r--r--src/rcl_prv_discover.erl51
-rw-r--r--src/rcl_rel_discovery.erl11
-rw-r--r--src/rcl_state.erl9
-rw-r--r--test/rclt_command_SUITE.erl4
-rw-r--r--test/rclt_discover_SUITE.erl9
-rw-r--r--test/rclt_release_SUITE.erl2
10 files changed, 70 insertions, 46 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ea4ef0d..e63ac46 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,12 +17,6 @@ your computer. The remote repository `origin` refers to your fork of the
project's repository that you can find in your GitHub account. The remote
repository `upstream` refers to the official repository for this project.
-Following this document will ensure prompt merging of your work in the
-`next` branch of the project. The `master` branch has `next` merged to
-it when we are satisfied with stability of the branch and any new
-features. Please submit all pull requests to the `next` branch and
-base your work off the `upstream` `next` branch.
-
Reporting bugs
--------------
@@ -63,7 +57,7 @@ To update the current branch to `upstream`, you can use the following commands.
``` bash
$ git fetch upstream
-$ git rebase upstream/next
+$ git rebase upstream/master
```
It may ask you to stash your changes, in which case you stash with:
@@ -82,12 +76,11 @@ You SHOULD use these commands both before working on your patch and before
submitting the pull request. If conflicts arise it is your responsability
to deal with them.
-You MUST create a new branch for your work. First, ensure you are on `next`.
-You MUST update `next` to `upstream` before doing anything. Then create a
-new branch `$BRANCH` and switch to it.
+You MUST create a new branch for your work. First make sure you have
+'fetched' `master`
``` bash
-$ git checkout -b $BRANCH
+$ git checkout -b $BRANCH upstream/master
```
You MUST use a an insightful branch name.
@@ -142,5 +135,5 @@ $ git push origin $BRANCH
```
You MUST then submit the pull request by using the GitHub interface to
-the `next` branch. You SHOULD provide an explanatory message and refer
+the `master` branch. You SHOULD provide an explanatory message and refer
to any previous ticket related to this patch.
diff --git a/rebar.config b/rebar.config
index 8ffc212..63ec977 100644
--- a/rebar.config
+++ b/rebar.config
@@ -7,7 +7,7 @@
{git, "https://github.com/seancribbs/neotoma.git", {branch, "master"}}},
{erlware_commons, ".*",
{git, "https://github.com/erlware/erlware_commons.git",
- {branch, "next"}}},
+ {branch, "master"}}},
{erlydtl, ".*",
{git, "https://github.com/evanmiller/erlydtl.git",
{branch, "master"}}},
diff --git a/src/rcl_app_discovery.erl b/src/rcl_app_discovery.erl
index 43557c4..1f1ecc8 100644
--- a/src/rcl_app_discovery.erl
+++ b/src/rcl_app_discovery.erl
@@ -86,7 +86,7 @@ setup_overrides(State, AppMetas0) ->
Overrides = rcl_state:overrides(State),
AppMetas1 = [AppMeta || AppMeta <- AppMetas0,
not lists:keymember(app_name(AppMeta), 1, Overrides)],
- [case is_valid_otp_app(filename:join([FileName, "ebin",
+ [case is_valid_otp_app(filename:join([FileName, <<"ebin">>,
erlang:atom_to_list(AppName) ++ ".app"])) of
{noresult, false} ->
{error, {invalid_override, AppName, FileName}};
@@ -134,11 +134,11 @@ is_valid_otp_app(File) ->
%% Is this an ebin dir?
EbinDir = filename:dirname(File),
case filename:basename(EbinDir) of
- "ebin" ->
- case lists:suffix(".app", File) of
- true ->
+ <<"ebin">> ->
+ case filename:extension(File) of
+ <<".app">> ->
has_at_least_one_beam(EbinDir, File);
- false ->
+ _ ->
{noresult, false}
end;
_ ->
diff --git a/src/rcl_app_info.erl b/src/rcl_app_info.erl
index f2afa0b..dadc579 100644
--- a/src/rcl_app_info.erl
+++ b/src/rcl_app_info.erl
@@ -91,7 +91,6 @@ new(AppName, Vsn, Dir, ActiveDeps, LibraryDeps) ->
{ok, t()} | relcool:error().
new(AppName, Vsn, Dir, ActiveDeps, LibraryDeps, Link)
when erlang:is_atom(AppName),
- erlang:is_list(Dir),
erlang:is_list(ActiveDeps),
erlang:is_list(LibraryDeps) ->
case parse_version(Vsn) of
diff --git a/src/rcl_prv_discover.erl b/src/rcl_prv_discover.erl
index 10fb28b..fa810a6 100644
--- a/src/rcl_prv_discover.erl
+++ b/src/rcl_prv_discover.erl
@@ -79,29 +79,54 @@ get_lib_dirs(State) ->
true ->
LibDirs0;
false ->
- add_current_dir(State, LibDirs0)
+ lists:flatten([LibDirs0,
+ add_common_project_dirs(State),
+ add_system_lib_dir(State),
+ add_release_output_dir(State)])
end.
--spec add_current_dir(rcl_state:t(), [file:name()]) -> [file:name()].
-add_current_dir(State, LibDirs) ->
+-spec add_common_project_dirs(rcl_state:t()) -> [file:name()].
+add_common_project_dirs(State) ->
%% Check to see if there is a rebar.config. If so then look for a deps
%% dir. If both are there then we add that to the lib dirs.
- Root = rcl_state:root_dir(State),
- add_system_lib_dir(State, [filename:absname(Root) | LibDirs]).
+ case rcl_state:get(State, disable_project_subdirs, false) of
+ true ->
+ [];
+ false ->
+ Root = rcl_state:root_dir(State),
+ Apps = filename:join(Root, "apps"),
+ Lib = filename:join(Root, "lib"),
+ Deps = filename:join(Root, "deps"),
+ lists:foldl(fun(Dir, LibDirs) ->
+ case ec_file:exists(Dir) of
+ true ->
+ [erlang:iolist_to_binary(Dir) | LibDirs];
+ false ->
+ LibDirs
+ end
+ end, [], [Deps, Lib, Apps])
+ end.
--spec add_system_lib_dir(rcl_state:t(), [file:name()]) -> [file:name()].
-add_system_lib_dir(State, LibDirs) ->
+-spec add_system_lib_dir(rcl_state:t()) -> [file:name()].
+add_system_lib_dir(State) ->
ExcludeSystem = rcl_state:get(State, discover_exclude_system, false),
-
case ExcludeSystem of
true ->
- LibDirs;
+ [];
+ false ->
+ erlang:iolist_to_binary(code:lib_dir())
+ end.
+
+add_release_output_dir(State) ->
+ case rcl_state:get(State, disable_discover_release_output, false) of
+ true ->
+ [];
false ->
- SystemLibDir0 = code:lib_dir(),
- case filelib:is_dir(SystemLibDir0) of
+ Output = erlang:iolist_to_binary(rcl_state:output_dir(State)),
+ case ec_file:exists(erlang:binary_to_list(Output)) of
true ->
- [SystemLibDir0 | LibDirs];
+ Output;
false ->
- LibDirs
+ []
end
end.
diff --git a/src/rcl_rel_discovery.erl b/src/rcl_rel_discovery.erl
index 38d7913..d9012ea 100644
--- a/src/rcl_rel_discovery.erl
+++ b/src/rcl_rel_discovery.erl
@@ -74,12 +74,13 @@ resolve_rel_metadata(State, LibDirs, AppMeta) ->
case Errors of
[] ->
+ ReleaseMeta1 = [RelMeta || {ok, RelMeta} <- ReleaseMeta0],
rcl_log:debug(rcl_state:log(State),
fun() ->
["Resolved the following OTP Releases from the system: \n",
- [[rcl_release:format(1, Rel), "\n"] || Rel <- ReleaseMeta0]]
+ [[rcl_release:format(1, Rel), "\n"] || Rel <- ReleaseMeta1]]
end),
- {ok, ReleaseMeta0};
+ {ok, ReleaseMeta1};
_ ->
?RCL_ERROR(Errors)
end.
@@ -105,10 +106,10 @@ discover_dir(File, AppMeta, file) ->
| {error, Reason::term()}
| {noresult, false}.
is_valid_release(File, AppMeta) ->
- case lists:suffix(".rel", File) of
- true ->
+ case filename:extension(File) of
+ <<".rel">>->
resolve_release(File, AppMeta);
- false ->
+ _ ->
{noresult, false}
end.
diff --git a/src/rcl_state.erl b/src/rcl_state.erl
index 6568541..7247818 100644
--- a/src/rcl_state.erl
+++ b/src/rcl_state.erl
@@ -103,7 +103,7 @@ new(PropList, Target)
State0 =
#state_t{log = proplists:get_value(log, PropList, rcl_log:new(error)),
output_dir=proplists:get_value(output_dir, PropList, ""),
- lib_dirs=proplists:get_value(lib_dirs, PropList, ""),
+ lib_dirs=[to_binary(Dir) || Dir <- proplists:get_value(lib_dirs, PropList, [])],
config_file=proplists:get_value(config, PropList, undefined),
action = Target,
goals=proplists:get_value(goals, PropList, []),
@@ -292,6 +292,13 @@ create_logic_providers(State0) ->
State5#state_t{providers=[ConfigProvider, DiscoveryProvider,
ReleaseProvider, OverlayProvider, AssemblerProvider]}.
+to_binary(Dir)
+ when erlang:is_list(Dir) ->
+ erlang:list_to_binary(Dir);
+to_binary(Dir)
+ when erlang:is_binary(Dir) ->
+ Dir.
+
%%%===================================================================
%%% Test Functions
%%%===================================================================
diff --git a/test/rclt_command_SUITE.erl b/test/rclt_command_SUITE.erl
index 3d06dad..9c96005 100644
--- a/test/rclt_command_SUITE.erl
+++ b/test/rclt_command_SUITE.erl
@@ -45,8 +45,8 @@ all() ->
normal_passing_case(Config) ->
DataDir = proplists:get_value(data_dir, Config),
- Lib1 = filename:join([DataDir, "lib1"]),
- Lib2 = filename:join([DataDir, "lib2"]),
+ Lib1 = filename:join([DataDir, <<"lib1">>]),
+ Lib2 = filename:join([DataDir, <<"lib2">>]),
Outdir = filename:join([DataDir, "outdir"]),
ok = rcl_util:mkdir_p(Lib1),
ok = rcl_util:mkdir_p(Lib2),
diff --git a/test/rclt_discover_SUITE.erl b/test/rclt_discover_SUITE.erl
index 4b6cb2a..e3a2861 100644
--- a/test/rclt_discover_SUITE.erl
+++ b/test/rclt_discover_SUITE.erl
@@ -111,7 +111,7 @@ no_beam_case(Config) ->
write_app_file(AppDir, BadName, BadVsn),
State0 = proplists:get_value(state, Config),
{DiscoverProvider, {ok, State1}} = rcl_provider:new(rcl_prv_discover, State0),
- EbinDir = filename:join([LibDir2, BadName, "ebin"]),
+ EbinDir = filename:join([LibDir2, BadName, <<"ebin">>]),
?assertMatch({error, {_, [{no_beam_files, EbinDir}]}},
rcl_provider:do(DiscoverProvider, State1)).
@@ -135,14 +135,12 @@ bad_ebin_case(Config) ->
BadName = create_random_name("error_bad"),
BadVsn = create_random_vsn(),
AppDir = filename:join([LibDir2, BadName]),
- Filename = filename:join([AppDir, "ebin", BadName ++ ".app"]),
- io:format("BAD -> ~p~n", [Filename]),
+ Filename = filename:join([AppDir, <<"ebin">>, BadName ++ ".app"]),
ok = filelib:ensure_dir(Filename),
ok = ec_file:write_term(Filename, get_bad_app_metadata(BadName, BadVsn)),
write_beam_file(AppDir, BadName),
State0 = proplists:get_value(state, Config),
{DiscoverProvider, {ok, State1}} = rcl_provider:new(rcl_prv_discover, State0),
-
?assertMatch({error, {_, [{invalid_app_file, Filename}]}},
rcl_provider:do(DiscoverProvider, State1)).
@@ -154,7 +152,8 @@ create_app(Dir, Name, Vsn) ->
AppDir = filename:join([Dir, Name]),
write_app_file(AppDir, Name, Vsn),
write_beam_file(AppDir, Name),
- {ok, App} = rcl_app_info:new(erlang:list_to_atom(Name), Vsn, AppDir,
+ {ok, App} = rcl_app_info:new(erlang:list_to_atom(Name), Vsn,
+ erlang:iolist_to_binary(AppDir),
[kernel, stdlib], []),
App.
diff --git a/test/rclt_release_SUITE.erl b/test/rclt_release_SUITE.erl
index fccdfcc..c774619 100644
--- a/test/rclt_release_SUITE.erl
+++ b/test/rclt_release_SUITE.erl
@@ -290,7 +290,7 @@ make_rerun_overridden_release(Config) ->
OutputDir = filename:join([proplists:get_value(data_dir, Config),
create_random_name("relcool-output")]),
{ok, Cwd} = file:get_cwd(),
- {ok, State} = relcool:do(Cwd, undefined, undefined, [], [LibDir1], 2,
+ {ok, _} = relcool:do(Cwd, undefined, undefined, [], [LibDir1], 2,
OutputDir, [{OverrideAppName, OverrideAppDir}],
ConfigFile),