Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
11538ac
{xref_ignores} now properly works on module, by taking into account f…
Feb 12, 2021
5e0d71d
Fix optimistic registry update of plugins being upgraded
ferd May 26, 2021
1d2a8c1
Merge pull request #2568 from ferd/fix-optimistic-plugin-cache-update
ferd May 26, 2021
e033a9d
back to git-based versioning
ferd May 24, 2021
bb79156
added SSL cacert patch for corporate mitm
davebryson May 27, 2021
9a189b5
changed cacerts_path to ssl_cacerts_path
davebryson May 28, 2021
f0a0f9f
Merge pull request #2570 from davebryson/ssl_proxy
ferd May 28, 2021
f065219
Normalize Dialyzer PLT paths
ferd Jun 9, 2021
63a7373
Merge branch 'erlang:master' into xref_ignores_module
acw224 Jun 10, 2021
7476e80
{xref_ignores} now properly works on module, by taking into account f…
Feb 12, 2021
fe3a062
Merge pull request #2578 from ferd/normalize-dialyzer-plt-paths
ferd Jun 10, 2021
ee12ac2
Merge pull request #2497 from acw224/xref_ignores_module
ferd Jun 10, 2021
4bf81cb
Fix ssl check hostname options for wildcard certificate
belltoy Jun 12, 2021
a7ceae0
Merge pull request #2579 from belltoy/fix/ssl-checkhost-opts
ferd Jun 12, 2021
30ca805
Prevent crashes on recursive src_dir definitions in deps
ferd Jun 18, 2021
a0951e3
Apply suggestions from code review
ferd Jun 21, 2021
a575f0e
Merge pull request #2582 from ferd/fix-recursive-dep-discover
ferd Jun 21, 2021
b74912e
Drop bootstrap URI handling functions warnings
ferd Jun 25, 2021
548a466
Merge pull request #2585 from ferd/drop-bootstrap-parse_uri-warnings
ferd Jun 25, 2021
b283414
add run of shelltestrunner to CI
tsloughter Jun 27, 2021
9b132f0
fix app discover to prefer erlang app to mix project
tsloughter Jun 27, 2021
8c8b5fd
Merge pull request #2588 from tsloughter/prefer-erlang-app
ferd Jun 27, 2021
25d66c5
fix yaml syntax on shelltest workflow
ferd Jun 27, 2021
35c0086
fixing workflow items, debugging
ferd Jun 27, 2021
6e79ef6
Merge pull request #2590 from ferd/fix-shelltests-workflow
tsloughter Jun 27, 2021
519c3fb
Handle abstract code starting with a non-file attribute
filmor Jul 7, 2021
5a78a08
Merge pull request #2595 from filmor/skip-non-file-attrs
ferd Jul 12, 2021
d43a5fd
Make `rebar_file_utils:system_tmpdir/1` take `TMPDIR` envvar into acc…
jaen Jul 13, 2021
a3f4f26
Mock the `TMPDIR` envvar value for `rebar_file_utils:system_tmpdir/1`…
jaen Jul 13, 2021
1105538
Merge pull request #2597 from jaen/take-tmpdir-into-account
ferd Jul 13, 2021
15ce0a8
Interleave DAG app orders
ferd Jul 31, 2021
6d78d19
Make escript_incl_extra work with _checkouts
mxxk Jul 31, 2021
ce3d2d4
Merge pull request #2602 from mxxk/mxxk/fix-escript_incl_extra-with-_…
ferd Aug 2, 2021
48b0640
Build compiler order DAG without topological sort
ferd Aug 16, 2021
ec84641
switch from maps to sets in DAG dedupe ops
ferd Aug 24, 2021
3169392
Merge pull request #2606 from ferd/interleave-dag-app-order
ferd Aug 24, 2021
623a529
rebar3 release to honour the ignore-xref attribute
acw224 Aug 27, 2021
c46b429
Bump relx to 4.5.0
ferd Sep 2, 2021
7c5dc35
Merge pull request #2612 from ferd/bump-relx-4.5.0
ferd Sep 2, 2021
7f9b68e
Merge branch 'pass_filter_method_as_callback' of https://github.com/a…
ferd Sep 2, 2021
ae78355
Merge pull request #2613 from ferd/acw224-pass_filter_method_as_callback
ferd Sep 2, 2021
513577c
bump to 3.17.0
ferd Sep 3, 2021
e008a2f
Actually run the 3.17.0 release fine
ferd Sep 3, 2021
e8e26c5
Merge commit 'e008a2ff40f708494a7c259a1fd8c2e77f7cd6a0' into vht_erla…
clevesque22 Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/shelltests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Shell tests

on:
pull_request:
branches:
- 'master'
push:
branches:
- 'master'

jobs:
shelltests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: '24.0.1'
elixir-version: '1.12'
- name: Compile
run: ./bootstrap
- name: Install
run: |
sudo cp ./rebar3 /usr/local/bin/

- name: Checkout shell tests
run: git clone https://github.com/tsloughter/rebar3_tests

- name: Install and run shelltestrunner
run: |
sudo apt-get update
sudo apt-get install -y shelltestrunner build-essential
cd rebar3_tests
mix local.hex --force
./run_tests.sh
40 changes: 21 additions & 19 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ main(_) ->
bootstrap_rebar3(),

%% Build rebar.app from rebar.app.src
{ok, App} = rebar_app_info:new(rebar, "3.16.1", filename:absname("_build/default/lib/rebar/")),
{ok, App} = rebar_app_info:new(rebar, "3.17.0", filename:absname("_build/default/lib/rebar/")),
rebar_otp_app:compile(rebar_state:new(), App),

%% Because we are compiling files that are loaded already we want to silence
Expand Down Expand Up @@ -747,30 +747,32 @@ chr([], _C, _I) -> 0.
%% These two functions are ports of rebar_uri module calls that
%% can't be called before the app is built; they're utility functions for
%% forwards and backwards compat so we need them to be current.
-ifdef(OTP_RELEASE).
rebar_uri_parse(URIString) ->
%% we drop rebar_uri:apply_opts since it's a noop as called here
try uri_string:parse(URIString) of
case uri_string:parse(URIString) of
Map = #{userinfo := _} -> Map;
Map when is_map(Map) -> Map#{userinfo => ""};
Res -> Res
catch
error:undef ->
%% Taken from rebar_uri and trimmed down.
case http_uri:parse(URIString, []) of
{error, Reason} ->
{error, "", Reason};
{ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
#{
scheme => atom_to_list(Scheme),
host => Host, port => Port, path => Path,
query => case Query of
[] -> "";
_ -> string:substr(Query, 2)
end,
userinfo => UserInfo
}
end
end.
-else.
rebar_uri_parse(URIString) ->
%% Taken from rebar_uri and trimmed down.
case http_uri:parse(URIString, []) of
{error, Reason} ->
{error, "", Reason};
{ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
#{
scheme => atom_to_list(Scheme),
host => Host, port => Port, path => Path,
query => case Query of
[] -> "";
_ -> string:substr(Query, 2)
end,
userinfo => UserInfo
}
end.
-endif.

%% Taken from rebar_uri.erl
rebar_uri_percent_decode(URIMap) when is_map(URIMap)->
Expand Down
13 changes: 5 additions & 8 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@

{escript_name, rebar3}.
{escript_wrappers_windows, ["cmd", "powershell"]}.
{escript_comment, "%%Rebar3 3.16.1\n"}.
{escript_comment, "%%Rebar3 3.17.0\n"}.
{escript_emu_args, "%%! +sbtu +A1\n"}.
%% escript_incl_extra is for internal rebar-private use only.
%% escript_incl_priv is for internal rebar-private use only.
%% Do not use outside rebar. Config interface is not stable.
{escript_incl_extra, [{"relx/priv/templates/*", "_build/default/lib/"},
{"rebar/priv/templates/*", "_build/default/lib/"}]}.
{escript_incl_priv, [{relx, "templates/*"},
{rebar, "templates/*"}]}.

{overrides, [{add, relx, [{erl_opts, [{d, 'RLX_LOG', rebar_log}]}]}]}.

{erl_opts, [warnings_as_errors,
{platform_define, "^(2[1-9])|(20\\\\.3)", filelib_find_source},
{platform_define, "^(1|(20))", no_customize_hostname_check},
{platform_define, "^(20)", fun_stacktrace}
]}.

Expand Down Expand Up @@ -66,10 +67,6 @@
{bootstrap, []},

{prod, [
{escript_incl_extra, [
{"relx/priv/templates/*", "_build/prod/lib/"},
{"rebar/priv/templates/*", "_build/prod/lib/"}
]},
{erl_opts, [no_debug_info]},
{overrides, [
{override, erlware_commons, [
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{<<"eunit_formatters">>,{pkg,<<"eunit_formatters">>,<<"0.5.0">>},0},
{<<"getopt">>,{pkg,<<"getopt">>,<<"1.0.1">>},0},
{<<"providers">>,{pkg,<<"providers">>,<<"1.8.1">>},0},
{<<"relx">>,{pkg,<<"relx">>,<<"4.4.0">>},0},
{<<"relx">>,{pkg,<<"relx">>,<<"4.5.0">>},0},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},0}]}.
[
{pkg_hash,[
Expand All @@ -19,7 +19,7 @@
{<<"eunit_formatters">>, <<"6A9133943D36A465D804C1C5B6E6839030434B8879C5600D7DDB5B3BAD4CCB59">>},
{<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>},
{<<"providers">>, <<"70B4197869514344A8A60E2B2A4EF41CA03DEF43CFB1712ECF076A0F3C62F083">>},
{<<"relx">>, <<"A7483BF5B82821D9CC992EF51F0B2DBFE05ADACD976807D42907C02C0C038B9C">>},
{<<"relx">>, <<"2BF90A855023023EDD000641033D1AB9F4EBD4314D1739F691E16FE03CB35B85">>},
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>}]},
{pkg_hash_ext,[
{<<"bbmustache">>, <<"43EFFA3FD4BB9523157AF5A9E2276C493495B8459FC8737144AA186CB13CE2EE">>},
Expand All @@ -30,6 +30,6 @@
{<<"eunit_formatters">>, <<"D6C8BA213424944E6E05BBC097C32001CDD0ABE3925D02454F229B20D68763C9">>},
{<<"getopt">>, <<"53E1AB83B9CEB65C9672D3E7A35B8092E9BDC9B3EE80721471A161C10C59959C">>},
{<<"providers">>, <<"E45745ADE9C476A9A469EA0840E418AB19360DC44F01A233304E118A44486BA0">>},
{<<"relx">>, <<"55C0ED63BB5D55EB983A19EB94D7F3075DF6D126DBDFF43102A6660A91FCE925">>},
{<<"relx">>, <<"DDB58F20CCE6CA63F5A2725E925816DD7213476698A3F3C3CB4FA8C272202C52">>},
{<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>}]}
].
2 changes: 1 addition & 1 deletion src/rebar.app.src.script
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{application, rebar,
[{description, "Rebar: Erlang Build Tool"},
{vsn, "3.16.1"},
{vsn, "3.17.0"},
{modules, []},
{registered, []},
{applications, [kernel,
Expand Down
28 changes: 19 additions & 9 deletions src/rebar_app_discover.erl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ app_dirs(LibDir, SrcDirs, State) ->
]),

EbinPath = filename:join([LibDir, "ebin", "*.app"]),
MixExsPath = filename:join([LibDir, "src", "mix.exs"]),
MixExsPath = filename:join([LibDir, "mix.exs"]),

lists:usort(lists:foldl(fun(Path, Acc) ->
Files = filelib:wildcard(rebar_utils:to_list(Path)),
Expand Down Expand Up @@ -344,14 +344,18 @@ find_app(AppInfo, AppDir, SrcDirs, Validate, State) ->
{true, rebar_app_info:t()} | false.
find_app_(AppInfo, AppDir, SrcDirs, Validate, State) ->
Extensions = rebar_state:get(State, application_resource_extensions, ?DEFAULT_APP_RESOURCE_EXT),
NormSrcDirs = [case SrcDir of
{ActualSrcDir, _Opts} -> ActualSrcDir;
_ -> SrcDir
end || SrcDir <- SrcDirs],
ResourceFiles = [
{app, filelib:wildcard(filename:join([AppDir, "ebin", "*.app"]))},
{mix_exs, filelib:wildcard(filename:join([AppDir, "src", "mix.exs"]))} |
[
{extension_type(Ext), lists:append([ filelib:wildcard(filename:join([AppDir, SrcDir, "*" ++ Ext]))
|| SrcDir <- SrcDirs])}
|| Ext <- Extensions
]],
{mix_exs, filelib:wildcard(filename:join([AppDir, "mix.exs"]))}
| [{extension_type(Ext),
lists:append([filelib:wildcard(filename:join([AppDir, SrcDir, "*" ++ Ext]))
|| SrcDir <- NormSrcDirs])}
|| Ext <- Extensions]
],
FlattenedResourceFiles = flatten_resource_files(ResourceFiles),
try_handle_resource_files(AppInfo, AppDir, FlattenedResourceFiles, Validate).

Expand Down Expand Up @@ -447,8 +451,14 @@ try_handle_resource_files(AppInfo, AppDir, [{app, AppFile} | Rest], Validate) ->
try_handle_resource_files(AppInfo, AppDir, [{Type, AppSrcFile} | _Rest], Validate)
when Type =:= app_src orelse Type =:= script ->
try_handle_app_src_file(AppInfo, AppDir, AppSrcFile, Validate);
try_handle_resource_files(AppInfo, _AppDir, [{mix_exs, _AppSrcFile} | _Rest], _Validate) ->
{true, rebar_app_info:project_type(AppInfo, mix)};
try_handle_resource_files(AppInfo, AppDir, [{mix_exs, _MixExs} | Rest], Validate) ->
%% prefer a rebar3 buildable app if both are found
case try_handle_resource_files(AppInfo, AppDir, Rest, Validate) of
false ->
{true, rebar_app_info:project_type(AppInfo, mix)};
{true, _}=Result ->
Result
end;
try_handle_resource_files(_AppInfo, _AppDir, [], _Validate) ->
false.

Expand Down
49 changes: 46 additions & 3 deletions src/rebar_compiler_dag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,53 @@ compile_order(G, AppDefs, SrcExt, ArtifactExt) ->
end
end
end, new_cache(), digraph:edges(G)),
Sorted = lists:reverse(digraph_utils:topsort(AppDAG)),
Standalone = [Name || {Name, _} <- AppDefs],
Sorted = interleave(Standalone, AppDAG),
digraph:delete(AppDAG),
Standalone = [Name || {Name, _} <- AppDefs] -- Sorted,
Standalone ++ Sorted.
Sorted.

%% Assume that the standalone app list respects the
%% rebar.config deps order, and enforce the sorted app
%% constraints onto it such that we're always respecting
%% the hard dependencies.
%%
%% What we do here is a sort of run-length reordering based
%% on DAG information, which preserves the original dependency
%% order as declared, but successfully interleaves hard deps
%% to come first.
%%
%% Note that this approach is required as opposed to topsort
%% because when the original DAG reports two distinct set of
%% app dependencies that are joined by an invisible compile-time
%% one (e.g. a parse_transform runtime dep between both sets),
%% then the topological sort can't provide the right ordering
%% information because it's flattened into one list, but
%% this one can.
interleave(Apps, DAG) ->
interleave(Apps, DAG, sets:new()).

interleave([], _, _) ->
[];
interleave([App|Apps], DAG, Expanded) ->
case sets:is_element(App, Expanded) of
true ->
[App|interleave(Apps, DAG, Expanded)];
false ->
%% The DAG functions don't make it easy on insert to check for
%% duplicate edges across apps, so we clean them up here.
Deps = dedupe(digraph:out_neighbours(DAG, App)) -- sets:to_list(Expanded),
interleave(Deps ++ [App|Apps -- Deps], DAG, sets:add_element(App, Expanded))
end.

dedupe(L) -> dedupe(L, sets:new()).

dedupe([], _) ->
[];
dedupe([H|T], Set) ->
case sets:is_element(H, Set) of
true -> dedupe(T, Set);
false -> [H|dedupe(T, sets:add_element(H, Set))]
end.

add_one_dependency_to_digraph(V1, V2, Cache, AppDefs, AppDAG) ->
%% First resolve the file we depend on so that we can shortcut resolution
Expand Down
2 changes: 1 addition & 1 deletion src/rebar_file_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ system_tmpdir(PathComponents) ->
"win32" ->
"./tmp";
_SysArch ->
"/tmp"
os:getenv("TMPDIR", "/tmp")
end,
filename:join([Tmp|PathComponents]).

Expand Down
31 changes: 20 additions & 11 deletions src/rebar_prv_dialyzer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ read_plt(_State, Plt) ->
{error, not_valid} ->
error;
{error, read_error} ->
Error = io_lib:format("Could not read the PLT file ~ts", [rebar_dir:format_source_file_name(Plt)]),
Error = io_lib:format("Could not read the PLT file ~ts", [format_path(Plt)]),
throw({dialyzer_error, Error})
end.

Expand All @@ -370,7 +370,7 @@ read_plt_files(Plt, Files) ->
[] ->
{ok, Files};
Missing ->
?INFO("Could not find ~p files in ~ts...", [length(Missing), rebar_dir:format_source_file_name(Plt)]),
?INFO("Could not find ~p files in ~ts...", [length(Missing), format_path(Plt)]),
?DEBUG("Could not find files: ~p", [Missing]),
error
end.
Expand All @@ -389,19 +389,19 @@ check_plt(State, Plt, Output, OldList, FilesList) ->
remove_plt(State, _Plt, _Output, []) ->
{0, State};
remove_plt(State, Plt, Output, Files) ->
?INFO("Removing ~b files from ~ts...", [length(Files), rebar_dir:format_source_file_name(Plt)]),
?INFO("Removing ~b files from ~ts...", [length(Files), format_path(Plt)]),
run_plt(State, Plt, Output, plt_remove, Files).

check_plt(State, _Plt, _Output, []) ->
{0, State};
check_plt(State, Plt, Output, Files) ->
?INFO("Checking ~b files in ~ts...", [length(Files), rebar_dir:format_source_file_name(Plt)]),
?INFO("Checking ~b files in ~ts...", [length(Files), format_path(Plt)]),
run_plt(State, Plt, Output, plt_check, Files).

add_plt(State, _Plt, _Output, []) ->
{0, State};
add_plt(State, Plt, Output, Files) ->
?INFO("Adding ~b files to ~ts...", [length(Files), rebar_dir:format_source_file_name(Plt)]),
?INFO("Adding ~b files to ~ts...", [length(Files), format_path(Plt)]),
run_plt(State, Plt, Output, plt_add, Files).

run_plt(State, Plt, Output, Analysis, Files) ->
Expand All @@ -419,8 +419,7 @@ build_proj_plt(Args, State, Plt, Output, Files) ->
?INFO("Updating base plt...", []),
BaseFiles = base_plt_files(State),
{BaseWarnings, State1} = update_base_plt(State, BasePlt, Output, BaseFiles),
?INFO("Copying ~ts to ~ts...", [rebar_dir:format_source_file_name(BasePlt),
rebar_dir:format_source_file_name(Plt)]),
?INFO("Copying ~ts to ~ts...", [format_path(BasePlt), format_path(Plt)]),
_ = filelib:ensure_dir(Plt),
case file:copy(BasePlt, Plt) of
{ok, _} ->
Expand Down Expand Up @@ -462,7 +461,7 @@ update_base_plt(State, BasePlt, Output, BaseFiles) ->
end.

build_plt(State, Plt, _, []) ->
?INFO("Building with no files in ~ts...", [rebar_dir:format_source_file_name(Plt)]),
?INFO("Building with no files in ~ts...", [format_path(Plt)]),
Opts = [{get_warnings, false},
{output_plt, Plt},
{apps, [erts]}],
Expand All @@ -473,7 +472,7 @@ build_plt(State, Plt, _, []) ->
_ = dialyzer:run([{analysis_type, plt_remove}, {init_plt, Plt} | Opts]),
{0, State};
build_plt(State, Plt, Output, Files) ->
?INFO("Building with ~b files in ~ts...", [length(Files), rebar_dir:format_source_file_name(Plt)]),
?INFO("Building with ~b files in ~ts...", [length(Files), format_path(Plt)]),
GetWarnings = get_config(State, get_warnings, false),
Opts = [{analysis_type, plt_build},
{get_warnings, GetWarnings},
Expand All @@ -492,10 +491,10 @@ succ_typings(Args, State, Plt, Output) ->
end.

succ_typings_(State, Plt, _, []) ->
?INFO("Analyzing no files with ~ts...", [rebar_dir:format_source_file_name(Plt)]),
?INFO("Analyzing no files with ~ts...", [format_path(Plt)]),
{0, State};
succ_typings_(State, Plt, Output, Files) ->
?INFO("Analyzing ~b files with ~ts...", [length(Files), rebar_dir:format_source_file_name(Plt)]),
?INFO("Analyzing ~b files with ~ts...", [length(Files), format_path(Plt)]),
Opts = [{analysis_type, succ_typings},
{get_warnings, true},
{from, byte_code},
Expand Down Expand Up @@ -660,3 +659,13 @@ dialyzer_version() ->

version_tuple(Major, Minor, Patch) ->
{list_to_integer(Major), list_to_integer(Minor), list_to_integer(Patch)}.

format_path(Path) ->
Normalized = rebar_dir:format_source_file_name(Path),
case filelib:is_file(Normalized) of
true -> Normalized;
false -> rebar_dir:format_source_file_name(Path, abs_path_opts())
end.

abs_path_opts() ->
dict:from_list([{compiler_source_format, absolute}]).
Loading