瀏覽代碼

Annotate generated escript with last release

End result should allow to look like this:

    $ head -n 3 rebar3
    #!/usr/bin/env escript
    %% Rebar3 3.14.0-rc1
    %%! +sbtu +A1

This will allow tools like mix to read the top of the file to know the
version being used in the current path (when using features that aren't
forwards-compatible) without having to invoke the tool itself.

The version (full dynamic one) is also added to the local install:

    $ head -n 2 /home/ferd/.cache/rebar3/bin/rebar3
    #!/usr/bin/env sh
    ## Rebar3 3.14.0-rc1+build.4599.ref6b0f90d

The `##` comments are used to keep a fixed width over the other form.

To be backported to 3.13.2 as well.
pull/2265/head
Fred Hebert 5 年之前
父節點
當前提交
488b167ec4
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. +1
    -0
      rebar.config
  2. +2
    -1
      src/rebar_prv_local_install.erl

+ 1
- 0
rebar.config 查看文件

@ -24,6 +24,7 @@
]}.
{escript_name, rebar3}.
{escript_comment, "%%Rebar3 3.14.0-rc1\n"}.
{escript_emu_args, "%%! +sbtu +A1\n"}.
%% escript_incl_extra is for internal rebar-private use only.
%% Do not use outside rebar. Config interface is not stable.

+ 2
- 1
src/rebar_prv_local_install.erl 查看文件

@ -62,8 +62,9 @@ format_error(Reason) ->
io_lib:format("~p", [Reason]).
bin_contents(OutputDir) ->
{ok, Vsn} = application:get_key(rebar, vsn),
<<"#!/usr/bin/env sh
## Rebar3 ", (iolist_to_binary(Vsn))/binary, "
erl -pz ", (rebar_utils:to_binary(OutputDir))/binary,"/*/ebin +sbtu +A1 -noshell -boot start_clean -s rebar3 main $REBAR3_ERL_ARGS -extra \"$@\"
">>.

Loading…
取消
儲存