Skip to content

Commit

Permalink
Fix clean hooks when override are presents
Browse files Browse the repository at this point in the history
The issue appears to be that because the 'clean' operation might be run
while dependencies have not yet been compiled, we applied a partial app
detection mechanism with `rebar_app_disover:find_apps(..., ..., all,
...)`, which worked to parse "invalid" (unbuilt) apps, but also did not
apply overrides.

Instead, we trust the `install_deps` provider dependency by reusing the
apps as they were fully parsed _if_ they were valid, and falling back to
the `rebar_app_discover:find_apps/4` call only to cover the unreadable
ones.

This, it turns out, has the side effect of properly applying hooks when
apps are fully parsed, and fixes #2862
  • Loading branch information
ferd committed Feb 19, 2024
1 parent 8207d82 commit 374a4bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/rebar/src/rebar_prv_clean.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ do(State) ->
if All; Specific =/= [] ->
DepsDir = rebar_dir:deps_dir(State1),
DepsDirs = filelib:wildcard(filename:join(DepsDir, "*")),
AllApps = rebar_app_discover:find_apps(DepsDirs, all, State),
ProjectApps = rebar_state:project_apps(State),
Deps = rebar_state:all_deps(State),
KnownAppNames = [rebar_app_info:name(App) || App <- ProjectApps++Deps],
ParsedApps = rebar_app_discover:find_apps(DepsDirs, all, State),
AllApps = ProjectApps ++ Deps ++
[App || App <- ParsedApps,
not lists:member(rebar_app_info:name(App),
KnownAppNames)],
Filter = case All of
true -> fun(_) -> true end;
false -> fun(AppInfo) -> filter_name(AppInfo, Specific) end
Expand Down

0 comments on commit 374a4bb

Please sign in to comment.