Browse Source

Merge pull request #2237 from ferd/allow-bare-compile-outdir

Allow specifying the outdir in bare compiler
pull/2243/head
Tristan Sloughter 5 years ago
committed by GitHub
parent
commit
9952736e6a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 13 deletions
  1. +26
    -13
      src/rebar_prv_bare_compile.erl

+ 26
- 13
src/rebar_prv_bare_compile.erl View File

@ -19,18 +19,30 @@
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
State1 =
rebar_state:add_provider(State,
providers:create([{name, ?PROVIDER},
{module, ?MODULE},
{namespace, ?NAMESPACE},
{bare, false},
{deps, ?DEPS},
{example, ""},
{short_desc, ""},
{desc, ""},
{opts, [{paths, $p, "paths", string, "Wildcard paths of ebin directories to add to code path, separated by a colon"},
{separator, $s, "separator", string, "In case of multiple return paths, the separator character to use to join them."}]}])),
State1 = rebar_state:add_provider(
State,
providers:create([
{name, ?PROVIDER},
{module, ?MODULE},
{namespace, ?NAMESPACE},
{bare, false},
{deps, ?DEPS},
{example, ""},
{short_desc, ""},
{desc, ""},
{opts, [
{paths, $p, "paths", string,
"Wildcard paths of ebin directories to add to code path, "
"separated by a colon"},
{separator, $s, "separator", string,
"In case of multiple return paths, the separator character "
"to use to join them."},
{outdir, $o, "outdir", string,
"Path where build artifacts are located. Defaults to the "
"current directory."}
]}
])
),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
@ -41,11 +53,12 @@ do(State) ->
{RawOpts, _} = rebar_state:command_parsed_args(State),
Paths = proplists:get_value(paths, RawOpts),
Sep = proplists:get_value(separator, RawOpts, " "),
OutDir = proplists:get_value(outdir, RawOpts, rebar_dir:get_cwd()),
[ code:add_pathsa(filelib:wildcard(PathWildcard))
|| PathWildcard <- rebar_string:lexemes(Paths, Sep) ],
[AppInfo] = rebar_state:project_apps(State),
AppInfo1 = rebar_app_info:out_dir(AppInfo, rebar_dir:get_cwd()),
AppInfo1 = rebar_app_info:out_dir(AppInfo, OutDir),
%% run compile in the default namespace
rebar_prv_compile:compile(rebar_state:namespace(State, default), AppInfo1),

Loading…
Cancel
Save