Skip to content
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

Add app name to "OTP release ~ts or later is required" msg #2810

Merged

Conversation

paulo-ferraz-oliveira
Copy link
Contributor

No description provided.

@paulo-ferraz-oliveira
Copy link
Contributor Author

Tests are passing in Ubuntu and Windows, but failing on macOS (brew doctor). Want me to look at it? Or shall you?

Copy link
Collaborator

@ferd ferd left a comment

Choose a reason for hiding this comment

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

This is a good change, so thanks for the contribution but it has edge cases. As pointed out in specific comments:

  • the old check needs to remain also available
  • the check done in the rebar3.erl file needs to remain on the old version that is non-specific because at that point we don't know which app (or if an app at all) has configured this value.

Ideally there would be tests for both call formats as well, since the current proposal migrated all of the old interface to the new proposed one.

@@ -69,7 +69,7 @@
escape_chars/1,
escape_double_quotes/1,
escape_double_quotes_weak/1,
check_min_otp_version/1,
check_min_otp_version/2,
Copy link
Collaborator

Choose a reason for hiding this comment

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

we likely want to keep a copy of check_min_otp_version/1 because it's possible plugins started relying on it over the years, and removing the function may break builds in the ecosystem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right 😄 I'll add it back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -134,7 +134,9 @@ run_aux(State, RawArgs) ->
rebar_state:apply_profiles(State, [list_to_atom(Profile)])
end,

rebar_utils:check_min_otp_version(rebar_state:get(State1, minimum_otp_vsn, undefined)),
MinimumOTPVsn = rebar_state:get(State1, minimum_otp_vsn, undefined),
App = rebar_state:current_app(State1),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here the app is going to be undefined because we're scanning the config before we have even scanned the applications. Do note that the version check in this file may also come from the global configuration file (in ~/.config/rebar3/rebar.config), in which case any message regarding the application or even the current project might be wrong at this level.

Chances are that since we need to keep the older check's version (see my other comment), we would want to keep using it here when we don't actually know which app configures it or if it's even an app at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my reading of the code (and I now see I missed a call to rebar_app_info:name/1):

  • rebar_state:current_app/1 returns undefined | rebar_app_info:t()
  • rebar_app_info:t()'s name is undefined | binary()
  • I can probably just "try and fetch" name from the potentially defined App and let the newly updated code take care of the rest if it's undefined. Is this a complete solution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ferd
Copy link
Collaborator

ferd commented Jul 28, 2023

Oh as for the brew thing, yeah it started being really shaky and annoying, so I gradually put the 'brew doctor' recommendation into steps of the MacOS workflow and it seems to fix things :/

I can take a look at it elsewhere if you want to rebase your branch on it when I have it ready.

@paulo-ferraz-oliveira
Copy link
Contributor Author

paulo-ferraz-oliveira commented Aug 2, 2023

Ideally there would be tests for both call formats as well, since the current proposal migrated all of the old interface to the new proposed one.

I'm gonna add some tests, un-migrating the ones I had migrated, but since the newly introduced function is mostly just a specific case of the existing one, I'm not sure if these add much 🤔 (except, maybe (?) making sure the calls "in the wild" you mention won't break, so that's already something).

Edit: 5300c45

Copy link
Collaborator

@ferd ferd left a comment

Choose a reason for hiding this comment

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

Yep that looks fully compatible and won't look funky for unknown apps!

@ferd ferd merged commit 9ae99e9 into erlang:main Aug 2, 2023
6 checks passed
@paulo-ferraz-oliveira paulo-ferraz-oliveira deleted the feature/app-on-minimum-otp-vsn branch August 3, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants