mirror of
https://github.com/erlang/rebar3.git
synced 2025-04-19 02:04:00 +03:00
Add powershell scripts bootstrap and escriptize
This commit is contained in:
parent
7c4b1a7e9b
commit
256db79f81
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -50,6 +50,6 @@ jobs:
|
||||
- name: Install Erlang
|
||||
run: choco install erlang
|
||||
- name: Compile
|
||||
run: cmd.exe /c 'bootstrap.bat'
|
||||
run: bootstrap.ps1
|
||||
- name: CT tests
|
||||
run: cmd.exe /c 'rebar3.cmd ct'
|
||||
run: rebar3.ps1 ct
|
||||
|
1
bootstrap.ps1
Normal file
1
bootstrap.ps1
Normal file
@ -0,0 +1 @@
|
||||
& escript.exe bootstrap @args
|
@ -24,6 +24,7 @@
|
||||
]}.
|
||||
|
||||
{escript_name, rebar3}.
|
||||
{escript_wrappers_windows, ["cmd", "powershell"]}.
|
||||
{escript_comment, "%%Rebar3 3.14.0-rc1\n"}.
|
||||
{escript_emu_args, "%%! +sbtu +A1\n"}.
|
||||
%% escript_incl_extra is for internal rebar-private use only.
|
||||
|
@ -149,6 +149,8 @@
|
||||
{escript_main_app, application}.
|
||||
%% Name of the resulting escript executable
|
||||
{escript_name, "application"}.
|
||||
%% Wrapper type(s) for escript executable on windows
|
||||
{escript_wrappers_windows, ["cmd","powershell"]}.
|
||||
%% apps (other than main and deps) to be included
|
||||
{escript_incl_apps, []}.
|
||||
%% Executable escript lines
|
||||
|
1
rebar3.ps1
Normal file
1
rebar3.ps1
Normal file
@ -0,0 +1 @@
|
||||
& escript.exe (Get-Item $PSCommandPath).Basename @args
|
@ -143,7 +143,7 @@ escriptize(State0, App) ->
|
||||
{ok, #file_info{mode = Mode}} = file:read_file_info(Filename),
|
||||
ok = file:change_mode(Filename, Mode bor 8#00111);
|
||||
{win32, _} ->
|
||||
write_windows_script(Filename)
|
||||
write_windows_scripts(Filename, rebar_state:get(State, escript_wrappers_windows, []))
|
||||
end,
|
||||
{ok, State}.
|
||||
|
||||
@ -272,9 +272,17 @@ def(Rm, State, Key, Default) ->
|
||||
rm_newline(String) ->
|
||||
[C || C <- String, C =/= $\n].
|
||||
|
||||
write_windows_script(Target) ->
|
||||
write_windows_scripts(Target, Wrappers) ->
|
||||
lists:foreach(fun(Wrapper) -> write_windows_script(Target, Wrapper) end, Wrappers).
|
||||
|
||||
write_windows_script(Target, "powershell") ->
|
||||
CmdPath = unicode:characters_to_list(Target) ++ ".ps1",
|
||||
CmdScript="& escript.exe (Get-Item $PSCommandPath).Basename @args\r\n",
|
||||
ok = file:write_file(CmdPath, CmdScript);
|
||||
write_windows_script(Target, _) ->
|
||||
CmdPath = unicode:characters_to_list(Target) ++ ".cmd",
|
||||
CmdScript=
|
||||
"@echo off\r\n"
|
||||
"escript.exe \"%~dpn0\" %*\r\n",
|
||||
ok = file:write_file(CmdPath, CmdScript).
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user