Skip to content

Commit 5f3aec7

Browse files
committed
Merge pull request #2237 from ferd/allow-bare-compile-outdir
Allow specifying the outdir in bare compiler
1 parent 0ba1f04 commit 5f3aec7

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

src/rebar_prv_bare_compile.erl

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@
1919

2020
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
2121
init(State) ->
22-
State1 =
23-
rebar_state:add_provider(State,
24-
providers:create([{name, ?PROVIDER},
25-
{module, ?MODULE},
26-
{namespace, ?NAMESPACE},
27-
{bare, false},
28-
{deps, ?DEPS},
29-
{example, ""},
30-
{short_desc, ""},
31-
{desc, ""},
32-
{opts, [{paths, $p, "paths", string, "Wildcard paths of ebin directories to add to code path, separated by a colon"},
33-
{separator, $s, "separator", string, "In case of multiple return paths, the separator character to use to join them."}]}])),
22+
State1 = rebar_state:add_provider(
23+
State,
24+
providers:create([
25+
{name, ?PROVIDER},
26+
{module, ?MODULE},
27+
{namespace, ?NAMESPACE},
28+
{bare, false},
29+
{deps, ?DEPS},
30+
{example, ""},
31+
{short_desc, ""},
32+
{desc, ""},
33+
{opts, [
34+
{paths, $p, "paths", string,
35+
"Wildcard paths of ebin directories to add to code path, "
36+
"separated by a colon"},
37+
{separator, $s, "separator", string,
38+
"In case of multiple return paths, the separator character "
39+
"to use to join them."},
40+
{outdir, $o, "outdir", string,
41+
"Path where build artifacts are located. Defaults to the "
42+
"current directory."}
43+
]}
44+
])
45+
),
3446
{ok, State1}.
3547

3648
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
@@ -41,11 +53,12 @@ do(State) ->
4153
{RawOpts, _} = rebar_state:command_parsed_args(State),
4254
Paths = proplists:get_value(paths, RawOpts),
4355
Sep = proplists:get_value(separator, RawOpts, " "),
56+
OutDir = proplists:get_value(outdir, RawOpts, rebar_dir:get_cwd()),
4457
[ code:add_pathsa(filelib:wildcard(PathWildcard))
4558
|| PathWildcard <- rebar_string:lexemes(Paths, Sep) ],
4659

4760
[AppInfo] = rebar_state:project_apps(State),
48-
AppInfo1 = rebar_app_info:out_dir(AppInfo, rebar_dir:get_cwd()),
61+
AppInfo1 = rebar_app_info:out_dir(AppInfo, OutDir),
4962

5063
%% run compile in the default namespace
5164
rebar_prv_compile:compile(rebar_state:namespace(State, default), AppInfo1),

0 commit comments

Comments
 (0)