Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions apps/rebar/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

%% Upgrade by calling 'rebar3 experimental vendor' and making sure
%% any manual patches (Eg. erlware_commons or relx) are kept.
{deps, [{erlware_commons, "1.8.0"},
{ssl_verify_fun, "1.1.6"},
{deps, [{ssl_verify_fun, "1.1.6"},
{certifi, "2.13.0"},
{providers, "1.9.0"},
{getopt, "1.0.2"},
Expand Down Expand Up @@ -63,10 +62,6 @@
{prod, [
{erl_opts, [no_debug_info]},
{overrides, [
{override, erlware_commons, [
{erl_opts, [no_debug_info,
warnings_as_errors]},
{deps, []}, {plugins, []}]},
{add, ssl_verify_hostname, [{erl_opts, [no_debug_info]}]},
{add, certifi, [{erl_opts, [no_debug_info]}]},
{add, cf, [{erl_opts, [no_debug_info]}]},
Expand Down
1 change: 0 additions & 1 deletion apps/rebar/src/rebar.app.src.script
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
edoc,
snmp,
getopt,
erlware_commons,
providers,
bbmustache,
ssl_verify_fun,
Expand Down
2 changes: 1 addition & 1 deletion apps/rebar/src/rebar_agent.erl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ refresh_paths(RState) ->
ShellBlacklist = proplists:get_value(app_reload_blacklist, ShellOpts, []),
Blacklist = lists:usort(
application:get_env(rebar, refresh_paths_blacklist, ShellBlacklist)
++ [rebar, erlware_commons, providers, cf, cth_readable]),
++ [rebar, providers, cf, cth_readable]),
%% Similar to rebar_utils:update_code/1, but also forces a reload
%% of used modules. Also forces to reload all of ebin/ instead
%% of just the modules in the .app file, because 'extra_src_dirs'
Expand Down
36 changes: 29 additions & 7 deletions apps/rebar/src/rebar_app_discover.erl
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%

%%% @doc utility functions to do the basic discovery of apps
%%% and layout for the project.
-module(rebar_app_discover).
Expand Down Expand Up @@ -78,13 +100,13 @@ do(State, LibDirs) ->
root | binary().
define_root_app(Apps, State) ->
RootDir = rebar_dir:root_dir(State),
case ec_lists:find(fun(X) ->
ec_file:real_dir_path(rebar_app_info:dir(X)) =:=
ec_file:real_dir_path(RootDir)
case lists:search(fun(X) ->
rebar_file_utils:real_dir_path(rebar_app_info:dir(X)) =:=
rebar_file_utils:real_dir_path(RootDir)
end, Apps) of
{ok, App} ->
{value, App} ->
rebar_app_info:name(App);
error ->
false ->
root
end.

Expand Down Expand Up @@ -177,7 +199,7 @@ parse_profile_deps(Profile, Name, Deps, Opts, State) ->
maybe_reset_hooks_plugins(AppInfo, State) ->
Dir = rebar_app_info:dir(AppInfo),
CurrentProfiles = rebar_state:current_profiles(State),
case ec_file:real_dir_path(rebar_dir:root_dir(State)) of
case rebar_file_utils:real_dir_path(rebar_dir:root_dir(State)) of
Dir ->
Opts = reset_hooks(rebar_state:opts(State), CurrentProfiles),
State1 = rebar_state:opts(State, Opts),
Expand Down Expand Up @@ -329,7 +351,7 @@ find_app(AppInfo, AppDir, Validate, State) ->
[file:filename_all()], valid | invalid | all, rebar_state:t()) ->
{true, rebar_app_info:t()} | false.
find_app(AppInfo, AppDir, SrcDirs, Validate, State) ->
AppInfo1 = case ec_file:real_dir_path(rebar_dir:root_dir(State)) of
AppInfo1 = case rebar_file_utils:real_dir_path(rebar_dir:root_dir(State)) of
AppDir ->
Opts = rebar_state:opts(State),
rebar_app_info:default(rebar_app_info:opts(AppInfo, Opts), Opts);
Expand Down
23 changes: 22 additions & 1 deletion apps/rebar/src/rebar_app_info.erl
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%
-module(rebar_app_info).

-export([new/0,
Expand Down Expand Up @@ -196,7 +217,7 @@ app_to_map(#app_info_t{name=Name,
optional_applications=OptionalApplications,
out_dir=OutDir,
ebin_dir=EbinDir}) ->
#{name => ec_cnv:to_atom(Name),
#{name => rebar_utils:to_atom(Name),
vsn => Vsn,
applications => Applications,
included_applications => IncludedApplications,
Expand Down
23 changes: 15 additions & 8 deletions apps/rebar/src/rebar_app_utils.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
%% -------------------------------------------------------------------

%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: MIT
%%
%% SPDX-FileCopyrightText: Copyright 2009 Dave Smith (dizzyd@dizzyd.com)
%%
%% rebar: Erlang Build Tools
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% Copyright (c) 2009 Dave Smith (dizzyd@dizzyd.com)
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,7 +28,9 @@
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE.
%% -------------------------------------------------------------------
%%
%% %CopyrightEnd%

-module(rebar_app_utils).

-export([find/2,
Expand All @@ -49,15 +56,15 @@

%% @doc finds the proper app info record for a given app name in a list of
%% such records.
-spec find(binary(), [rebar_app_info:t()]) -> {ok, rebar_app_info:t()} | error.
-spec find(binary(), [rebar_app_info:t()]) -> {value, rebar_app_info:t()} | false.
find(Name, Apps) ->
ec_lists:find(fun(App) -> rebar_app_info:name(App) =:= Name end, Apps).
lists:search(fun(App) -> rebar_app_info:name(App) =:= Name end, Apps).

%% @doc finds the proper app info record for a given app name at a given version
%% in a list of such records.
-spec find(binary(), binary(), [rebar_app_info:t()]) -> {ok, rebar_app_info:t()} | error.
-spec find(binary(), binary(), [rebar_app_info:t()]) -> {value, rebar_app_info:t()} | false.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This signature change may create more work for plugins that could rely on it down the road. It's up to you regarding future rebar to decide whether it's worth changing it or doing a case to wrap the lists:search call to keep the signature stable. This would make it easier to the merge this into main.

find(Name, Vsn, Apps) ->
ec_lists:find(fun(App) ->
lists:search(fun(App) ->
rebar_app_info:name(App) =:= Name
andalso rebar_app_info:original_vsn(App) =:= Vsn
end, Apps).
Expand Down
24 changes: 23 additions & 1 deletion apps/rebar/src/rebar_compiler_erl.erl
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%

-module(rebar_compiler_erl).

-behaviour(rebar_compiler).
Expand All @@ -19,7 +41,7 @@ context(AppInfo) ->
OutDir = rebar_app_info:dir(AppInfo),
SrcDirs = rebar_dir:src_dirs(rebar_app_info:opts(AppInfo)),
ExistingSrcDirs = lists:filter(fun(D) ->
ec_file:is_dir(filename:join(OutDir, D))
filelib:is_dir(filename:join(OutDir, D))
end, SrcDirs),

RebarOpts = rebar_app_info:opts(AppInfo),
Expand Down
33 changes: 24 additions & 9 deletions apps/rebar/src/rebar_digraph.erl
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%

%%% @doc build a digraph of applications in order to figure out dependency
%%% and compile order.
-module(rebar_digraph).
Expand Down Expand Up @@ -93,16 +115,9 @@ subgraph(Graph, Vertices) ->

%% @private from a list of app names, fetch the proper app info records
%% for them.
-spec names_to_apps([atom()], [rebar_app_info:t()]) -> [rebar_app_info:t()].
-spec names_to_apps([binary()], [rebar_app_info:t()]) -> [rebar_app_info:t()].

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure where this type signature change is coming from. Was it always wrong?

names_to_apps(Names, Apps) ->
[element(2, App) || App <- [find_app_by_name(Name, Apps) || Name <- Names], App =/= error].

%% @private fetch the proper app info record for a given app name.
-spec find_app_by_name(atom(), [rebar_app_info:t()]) -> {ok, rebar_app_info:t()} | error.
find_app_by_name(Name, Apps) ->
ec_lists:find(fun(App) ->
rebar_app_info:name(App) =:= Name
end, Apps).
[element(2, App) || App <- [rebar_app_utils:find(Name, Apps) || Name <- Names], App =/= false].

%% @private The union of all entries in the applications list for an app and
%% the deps listed in its rebar.config is all deps that may be needed
Expand Down
17 changes: 11 additions & 6 deletions apps/rebar/src/rebar_erlc_compiler.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
%% -------------------------------------------------------------------
%% %CopyrightBegin%
%%
%% rebar: Erlang Build Tools
%% SPDX-Licence-Identifier: MIT
%%
%% Copyright (c) 2009, 2010 Dave Smith (dizzyd@dizzyd.com)
%% SPDX-FileCopyrightText: Copyright 2009-2010 Dave Smith (dizzyd@dizzyd.com)
%%
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,7 +27,8 @@
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%% THE SOFTWARE.
%% -------------------------------------------------------------------
%% %CopyrightEnd%

-module(rebar_erlc_compiler).

-export([compile/1, compile/2, compile/3,
Expand Down Expand Up @@ -124,7 +129,7 @@ compile(AppInfo, CompileOpts) when element(1, AppInfo) == app_info_t ->

ExtraDirs = rebar_dir:extra_src_dirs(RebarOpts),
F = fun(D) ->
case ec_file:is_dir(filename:join([Dir, D])) of
case filelib:is_dir(filename:join([Dir, D])) of
true -> compile_dirs(RebarOpts, Dir, [D], D, CompileOpts);
false -> ok
end
Expand Down Expand Up @@ -156,7 +161,7 @@ compile(RebarOpts, BaseDir, OutDir, CompileOpts) ->

ExtraDirs = rebar_dir:extra_src_dirs(RebarOpts),
F = fun(D) ->
case ec_file:is_dir(filename:join([BaseDir, D])) of
case filelib:is_dir(filename:join([BaseDir, D])) of
true -> compile_dirs(RebarOpts, BaseDir, [D], D, CompileOpts);
false -> ok
end
Expand Down
28 changes: 26 additions & 2 deletions apps/rebar/src/rebar_fetch.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et

%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% SPDX-FileCopyrightText: Copyright 2015-2026 Rebar3 and its contributors
%%
%% SPDX-FileCopyrightText: Copyright 2026 Dipl. Phys. Peer Stritzinger GmbH
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%

%% -------------------------------------------------------------------
%%
%% rebar: Erlang Build Tools
%%
%% -------------------------------------------------------------------

-module(rebar_fetch).

-export([lock_source/2,
Expand Down Expand Up @@ -59,11 +83,11 @@ download_source_(AppInfo, State) ->

download_source_online(AppInfo, State) ->
AppDir = rebar_app_info:dir(AppInfo),
TmpDir = ec_file:insecure_mkdtemp(),
TmpDir = rebar_file_utils:insecure_mkdtemp(),
AppDir1 = rebar_utils:to_list(AppDir),
case rebar_resource_v2:download(TmpDir, AppInfo, State) of
ok ->
ec_file:mkdir_p(AppDir1),
filelib:ensure_path(AppDir1),
code:del_path(filename:absname(filename:join(AppDir1, "ebin"))),
FetchDir = rebar_app_info:fetch_dir(AppInfo),
ok = rebar_file_utils:rm_rf(filename:absname(FetchDir)),
Expand Down
Loading