mirror of
https://github.com/correl/rebar.git
synced 2024-12-24 03:00:16 +00:00
Merging w/ mainline
This commit is contained in:
commit
0f7b47ce7b
4 changed files with 24 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env escript
|
||||
%% -*- erlang -*-
|
||||
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
|
||||
%% ex: ft=erlang ts=4 sw=4 et
|
||||
|
||||
main(Args) ->
|
||||
%% Get a string repr of build time
|
||||
|
|
|
@ -106,13 +106,20 @@ inspect(Source, IncludePath) ->
|
|||
-spec inspect_epp(Epp::pid(), Module::string(), Includes::[string()]) -> {string(), [string()]}.
|
||||
inspect_epp(Epp, Module, Includes) ->
|
||||
case epp:parse_erl_form(Epp) of
|
||||
{ok, {attribute, _, module, ActualModule}} ->
|
||||
%% If the module name includes package info, we get a list of atoms...
|
||||
case is_list(ActualModule) of
|
||||
true ->
|
||||
{ok, {attribute, _, module, ModInfo}} ->
|
||||
case ModInfo of
|
||||
%% Typical module name, single atom
|
||||
ActualModule when is_atom(ActualModule) ->
|
||||
ActualModuleStr = atom_to_list(ActualModule);
|
||||
%% Packag-ized module name, list of atoms
|
||||
ActualModule when is_list(ActualModule) ->
|
||||
ActualModuleStr = string:join([atom_to_list(P) || P <- ActualModule], ".");
|
||||
false ->
|
||||
ActualModuleStr = atom_to_list(ActualModule)
|
||||
%% Parameterized module name, single atom
|
||||
{ActualModule, _} when is_atom(ActualModule) ->
|
||||
ActualModuleStr = atom_to_list(ActualModule);
|
||||
%% Parameterized and packagized module name, list of atoms
|
||||
{ActualModule, _} when is_list(ActualModule) ->
|
||||
ActualModuleStr = string:join([atom_to_list(P) || P <- ActualModule], ".")
|
||||
end,
|
||||
inspect_epp(Epp, ActualModuleStr, Includes);
|
||||
{ok, {attribute, 1, file, {Module, 1}}} ->
|
||||
|
|
|
@ -253,7 +253,9 @@ default_env() ->
|
|||
" -I", filename:join(erts_dir(), include),
|
||||
" "])},
|
||||
{"DRIVER_LDFLAGS", lists:concat([" -L", code:lib_dir(erl_interface, lib),
|
||||
" -lerl_interface -lei"])}].
|
||||
" -lerl_interface -lei"])},
|
||||
{"ERLANG_ARCH", integer_to_list(8 * erlang:system_info(wordsize))},
|
||||
{"ERLANG_TARGET", rebar_utils:get_arch()}].
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
-export([get_cwd/0,
|
||||
is_arch/1,
|
||||
get_arch/0,
|
||||
get_os/0,
|
||||
sh/2, sh/3,
|
||||
sh_failfast/2,
|
||||
|
@ -48,14 +49,17 @@ get_cwd() ->
|
|||
|
||||
|
||||
is_arch(ArchRegex) ->
|
||||
Arch = erlang:system_info(system_architecture),
|
||||
case re:run(Arch, ArchRegex, [{capture, none}]) of
|
||||
case re:run(get_arch(), ArchRegex, [{capture, none}]) of
|
||||
match ->
|
||||
true;
|
||||
nomatch ->
|
||||
false
|
||||
end.
|
||||
|
||||
get_arch() ->
|
||||
Words = integer_to_list(8 * erlang:system_info(wordsize)),
|
||||
erlang:system_info(system_architecture) ++ "-" ++ Words.
|
||||
|
||||
get_os() ->
|
||||
Arch = erlang:system_info(system_architecture),
|
||||
case match_first([{"linux", linux}, {"darwin", darwin}], Arch) of
|
||||
|
|
Loading…
Reference in a new issue