summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml6
-rwxr-xr-xbootstrap/bootstrap91
-rw-r--r--priv/templates/plugin.erl.dtl3
-rw-r--r--rebar.config5
4 files changed, 8 insertions, 97 deletions
diff --git a/.travis.yml b/.travis.yml
index 1135f6e..2ee3458 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,8 @@
language: erlang
otp_release:
- 17.0
- - R16B02
- - R16B01
- - R15B01
- - R14B04
+ - R16B03-1
+ - R15B03
script: make travis
branches:
only:
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap
index e34f033..4e3d304 100755
--- a/bootstrap/bootstrap
+++ b/bootstrap/bootstrap
@@ -11,14 +11,6 @@ main(Args) ->
ok
end,
- %% Get a string repr of build time
- Built = build_time(),
-
- %% Get a string repr of first matching VCS changeset
- VcsInfo = vcs_info([{hg, ".hg", "hg identify -i", "hg status"},
- {git, ".git", "git describe --always --tags",
- "git status -s"}]),
-
%% Check for force=1 flag to force a rebuild
case lists:member("force=1", Args) of
true ->
@@ -27,62 +19,9 @@ main(Args) ->
rm("ebin/rebar.beam")
end,
- %% Add check for debug flag
- DebugFlag = case lists:member("debug", Args) of
- true -> debug_info;
- false -> undefined
- end,
-
%% Extract the system info of the version of OTP we use to compile rebar
- OtpInfo = string:strip(erlang:system_info(otp_release), both, $\n),
-
- %% Types dict:dict() and digraph:digraph() have been introduced in
- %% Erlang 17.
- %% At the same time, their counterparts dict() and digraph() are to be
- %% deprecated in Erlang 18. namespaced_types option is used to select
- %% proper type name depending on the OTP version used.
- NamespacedTypes = case is_otp(OtpInfo, "^[0-9]+") of
- true -> {d, namespaced_types};
- false -> undefined
- end,
-
- os:cmd("./bootstrap/rebar get-deps compile"),
-
- %% Compile all src/*.erl to ebin
- %% To not accidentally try to compile files like Mac OS X resource forks,
- %% we only look for rebar source files that start with a letter.
- case make:files(filelib:wildcard("src/[a-zA-Z]*.erl"),
- [{outdir, "ebin"}, {i, "include"},
- DebugFlag,
- NamespacedTypes,
- {d, 'BUILD_TIME', Built},
- {d, 'VCS_INFO', VcsInfo},
- {d, 'OTP_INFO', OtpInfo}]) of
- up_to_date ->
- ok;
- error ->
- io:format("Failed to compile rebar files!\n"),
- halt(1)
- end,
-
- %% Make sure file:consult can parse the .app file
- case file:consult("ebin/rebar.app") of
- {ok, _} ->
- ok;
- {error, Reason} ->
- io:format("Invalid syntax in ebin/rebar.app: ~p\n", [Reason]),
- halt(1)
- end,
-
- %% Add ebin/ to our path
- true = code:add_path("ebin"),
- %% Run rebar compile to do proper .app validation etc.
- %% and rebar escriptize to create the rebar script
- %RebarArgs = Args -- ["debug"], %% Avoid trying to run 'debug' command
- %rebar:main(["compile", "escriptize"] ++ RebarArgs),
-
- os:cmd("./bootstrap/rebar compile escriptize"),
+ os:cmd("./bootstrap/rebar get-deps compile escriptize"),
%% Finally, update executable perms for our script on *nix,
%% or write out script files on win32.
@@ -109,12 +48,6 @@ usage() ->
io:format(" force=1 unconditional build~n"),
io:format(" debug add debug information~n").
-is_otp(OtpInfo, Regex) ->
- case re:run(OtpInfo, Regex, [{capture, none}]) of
- match -> true;
- nomatch -> false
- end.
-
rm(Path) ->
NativePath = filename:nativename(Path),
Cmd = case os:type() of
@@ -124,28 +57,6 @@ rm(Path) ->
[] = os:cmd(Cmd ++ NativePath),
ok.
-build_time() ->
- {{Y, M, D}, {H, Min, S}} = calendar:now_to_universal_time(now()),
- lists:flatten(io_lib:format("~4..0w~2..0w~2..0w_~2..0w~2..0w~2..0w",
- [Y, M, D, H, Min, S])).
-
-vcs_info([]) ->
- "No VCS info available.";
-vcs_info([{Id, Dir, VsnCmd, StatusCmd} | Rest]) ->
- case filelib:is_dir(Dir) of
- true ->
- Vsn = string:strip(os:cmd(VsnCmd), both, $\n),
- Status = case string:strip(os:cmd(StatusCmd), both, $\n) of
- [] ->
- "";
- _ ->
- "-dirty"
- end,
- lists:concat([Id, " ", Vsn, Status]);
- false ->
- vcs_info(Rest)
- end.
-
write_windows_scripts() ->
CmdScript=
"@echo off\r\n"
diff --git a/priv/templates/plugin.erl.dtl b/priv/templates/plugin.erl.dtl
index af85d7f..e525ab3 100644
--- a/priv/templates/plugin.erl.dtl
+++ b/priv/templates/plugin.erl.dtl
@@ -19,7 +19,7 @@ init(State) ->
{bare, true}, % The task can be run by the user, always true
{deps, ?DEPS}, % The list of dependencies
{example, "rebar {{name}}"}, % How to use the plugin
- {opts, []} % list of options understood by the plugin
+ {opts, []}, % list of options understood by the plugin
{short_desc, "{{desc}}"},
{desc, ""}
]),
@@ -33,4 +33,3 @@ do(State) ->
-spec format_error(any()) -> iolist().
format_error(Reason, State) ->
io_lib:format("~p", [Reason]).
-
diff --git a/rebar.config b/rebar.config
index abbb3fb..7bc15ca 100644
--- a/rebar.config
+++ b/rebar.config
@@ -6,7 +6,7 @@
{escript_incl_extra, [{"priv/templates/*", "."}, {"rebar/include/*", "."}]}.
{escript_incl_apps,
- [getopt, erlydtl, erlware_commons, relx, providers, rebar]}.
+ [getopt, merl, erlydtl, erlware_commons, relx, providers, rebar]}.
{escript_top_level_app, rebar}.
{escript_name, rebar3}.
@@ -33,6 +33,9 @@
{providers, "",
{git, "https://github.com/tsloughter/providers.git",
{branch, "format_error1"}}},
+ {erlydtl, ".*",
+ {git, "https://github.com/erlydtl/erlydtl.git",
+ {tag, "0.9.4"}}},
{relx, "",
{git, "https://github.com/tsloughter/relx.git",
{branch, "format_error1"}}},