summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorMatwey V. Kornilov <matwey.kornilov@gmail.com>2014-06-05 21:50:04 +0400
committerMatwey V. Kornilov <matwey.kornilov@gmail.com>2014-06-08 14:34:10 +0400
commit4de9ea557412d88556e6de483c5ccc1b545a3180 (patch)
tree261bf52f33fd17600bb3b80aa7f367fbbc782cdd /bootstrap
parenta7e05f57d1134243cb4506f1cf9581b29af62da8 (diff)
downloadrebar-4de9ea557412d88556e6de483c5ccc1b545a3180.tar.gz
Add namespaced_types to bootstrap script.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap16
1 files changed, 16 insertions, 0 deletions
diff --git a/bootstrap b/bootstrap
index 019aaea..f6aa6cc 100755
--- a/bootstrap
+++ b/bootstrap
@@ -28,10 +28,20 @@ main(Args) ->
%% 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 of the OTP version used.
+ NamespacedTypes = case is_otp(OtpInfo, "^[0-9]+") of
+ true -> {d, namespaced_types};
+ false -> undefined
+ end,
+
%% Compile all src/*.erl to ebin
case make:files(filelib:wildcard("src/*.erl"),
[{outdir, "ebin"}, {i, "include"},
DebugFlag,
+ NamespacedTypes,
{d, 'BUILD_TIME', Built},
{d, 'VCS_INFO', VcsInfo},
{d, 'OTP_INFO', OtpInfo}]) of
@@ -79,6 +89,12 @@ main(Args) ->
"Place this script anywhere in your path\n"
"and you can use rebar to build OTP-compliant apps.\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