瀏覽代碼

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

Allow specifying the outdir in bare compiler
pull/2243/head
Tristan Sloughter 5 年之前
committed by GitHub
父節點
當前提交
9952736e6a
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 26 行新增13 行删除
  1. +26
    -13
      src/rebar_prv_bare_compile.erl

+ 26
- 13
src/rebar_prv_bare_compile.erl 查看文件

@ -19,18 +19,30 @@
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}. -spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) -> 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}. {ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
@ -41,11 +53,12 @@ do(State) ->
{RawOpts, _} = rebar_state:command_parsed_args(State), {RawOpts, _} = rebar_state:command_parsed_args(State),
Paths = proplists:get_value(paths, RawOpts), Paths = proplists:get_value(paths, RawOpts),
Sep = proplists:get_value(separator, RawOpts, " "), Sep = proplists:get_value(separator, RawOpts, " "),
OutDir = proplists:get_value(outdir, RawOpts, rebar_dir:get_cwd()),
[ code:add_pathsa(filelib:wildcard(PathWildcard)) [ code:add_pathsa(filelib:wildcard(PathWildcard))
|| PathWildcard <- rebar_string:lexemes(Paths, Sep) ], || PathWildcard <- rebar_string:lexemes(Paths, Sep) ],
[AppInfo] = rebar_state:project_apps(State), [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 %% run compile in the default namespace
rebar_prv_compile:compile(rebar_state:namespace(State, default), AppInfo1), rebar_prv_compile:compile(rebar_state:namespace(State, default), AppInfo1),

Loading…
取消
儲存