-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove duplicated message when trying to upgrade a checkout dep #2634
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,6 @@ do(State) -> | |
OldLockNames = [element(1,L) || L <- OldLocks] -- Checkouts, | ||
NewLockNames = [element(1,L) || L <- Locks], | ||
|
||
%% TODO: don't output this message if the dep is now a checkout | ||
rebar_utils:info_useless(OldLockNames, NewLockNames), | ||
info_checkout_deps(Checkouts), | ||
|
||
|
@@ -67,6 +66,7 @@ build_locks(State) -> | |
rebar_app_info:dep_level(Dep)} | ||
end || Dep <- AllDeps, not(rebar_app_info:is_checkout(Dep))]. | ||
|
||
info_checkout_deps(Checkouts) -> | ||
info_checkout_deps(Checkouts0) -> | ||
Checkouts = lists:usort(Checkouts0), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes the checkouts list will have duplicated dep names, this should also help remove duplicated messages. |
||
[?INFO("App ~ts is a checkout dependency and cannot be locked.", [CheckoutDep]) | ||
|| CheckoutDep <- Checkouts]. | ||
|| CheckoutDep <- Checkouts]. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -111,12 +111,32 @@ do_(State) -> | |||||||||||||||||||||||||||||||||||||||||||||||
[element(1,Lock) || Lock <- Locks], | ||||||||||||||||||||||||||||||||||||||||||||||||
[rebar_app_info:name(App) || App <- rebar_state:lock(State5)] | ||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||
rebar_prv_lock:do(State5); | ||||||||||||||||||||||||||||||||||||||||||||||||
State6 = maybe_ignore_checkouts(State5, Checkouts), | ||||||||||||||||||||||||||||||||||||||||||||||||
rebar_prv_lock:do(State6); | ||||||||||||||||||||||||||||||||||||||||||||||||
_ -> | ||||||||||||||||||||||||||||||||||||||||||||||||
Res | ||||||||||||||||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||||||||||||||||
end. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
-spec maybe_ignore_checkouts(rebar_state:t(), [binary()]) -> rebar_state:t(). | ||||||||||||||||||||||||||||||||||||||||||||||||
maybe_ignore_checkouts(State, Checkouts) -> | ||||||||||||||||||||||||||||||||||||||||||||||||
OldLocks = rebar_state:get(State, {locks, default}, []), | ||||||||||||||||||||||||||||||||||||||||||||||||
OldLockNames = [element(1,L) || L <- OldLocks], | ||||||||||||||||||||||||||||||||||||||||||||||||
case OldLockNames -- Checkouts of | ||||||||||||||||||||||||||||||||||||||||||||||||
%% If there aren't any checkout dependencies in the old lock info, | ||||||||||||||||||||||||||||||||||||||||||||||||
%% we can safely "ignore" them to avoid a duplicated message from | ||||||||||||||||||||||||||||||||||||||||||||||||
%% `rebar_prv_lock:info_checkout_deps/1`. | ||||||||||||||||||||||||||||||||||||||||||||||||
OldLockNames -> | ||||||||||||||||||||||||||||||||||||||||||||||||
DepsIgnoringCheckout = | ||||||||||||||||||||||||||||||||||||||||||||||||
[case rebar_app_info:is_checkout(Dep) of | ||||||||||||||||||||||||||||||||||||||||||||||||
true -> rebar_app_info:is_checkout(Dep, false); | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this will now hide status of whether a dep is a checkout dep to any provider that relies on locking (i.e. compiling). This may break a lot of stuff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I thought so too. If the state that Thanks for bringing it up, because for a second I forgot that although the code executed by Would it make sense then to, in line 115, match on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That might work. It could possibly be simpler to just keep a quick cache entry about it. The rebar agent does it internally by carrying explicit state: Lines 166 to 172 in c102379
The config handler uses the app env values to do it: Lines 97 to 112 in ba50a08
I like that one because it also allows people to tweak or change the cache behaviour in weird cases like tests. The pdict could work in more restrained cases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah using app environment is a nice thing that rebar3 uses in some features. I do not think, however, it would translate well into removing a duplicated message :/ As for the cache, the idea is good, but given that the |
||||||||||||||||||||||||||||||||||||||||||||||||
false -> Dep | ||||||||||||||||||||||||||||||||||||||||||||||||
end || Dep <- rebar_state:all_deps(State)], | ||||||||||||||||||||||||||||||||||||||||||||||||
rebar_state:all_deps(State, DepsIgnoringCheckout); | ||||||||||||||||||||||||||||||||||||||||||||||||
_ -> | ||||||||||||||||||||||||||||||||||||||||||||||||
State | ||||||||||||||||||||||||||||||||||||||||||||||||
end. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
-spec format_error(any()) -> iolist(). | ||||||||||||||||||||||||||||||||||||||||||||||||
format_error({unknown_dependency, Name}) -> | ||||||||||||||||||||||||||||||||||||||||||||||||
io_lib:format("Dependency ~ts not found", [Name]); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already addresses by #2335, I think, but I forgot to remove it then.