-
Notifications
You must be signed in to change notification settings - Fork 231
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 support for optional deps in otp24 #885
Conversation
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.
I think this makes sense, but we probably want to maintain backwards compat on the calls to relx_app_info:new()
There's also a relx export to annotate properly for CI to go through.
@@ -71,17 +72,18 @@ | |||
-export_type([t/0, | |||
app_type/0]). | |||
|
|||
-spec new(atom(), string(), file:name(), [atom()], [atom()]) -> t(). | |||
new(Name, Vsn, Dir, Applications, IncludedApplications) -> | |||
new(Name, Vsn, Dir, Applications, IncludedApplications, dep). |
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.
I guess this is technically a backwards-incompatible change since this is the one bit of the public API users of relx must call. I don't know if we want to provide the sort of "match on the app_type() and know which signature this is" backwards-compatible behavior instead.
Like:
new(Name, Vsn, Dir, Applications, IncludedApplications) ->
new(Name, Vsn, Dir, Applications, IncludedApplications, [], dep).
new(Name, Vsn, Dir, Applications, IncludedApplications, OptionalApplications) when is_list(OptionalApplications) ->
new(Name, Vsn, Dir, Applications, IncludedApplications, OptionalApplications, dep);
new(Name, Vsn, Dir, Applications, IncludedApplications, AppType) when is_atom(AppType) ->
new(Name, Vsn, Dir, Applications, IncludedApplications, OptionalApplications, [], AppType).
...
These tend to make the type specs real messy though it'd be fine keeping the new ones only.
subset(Rest ++ Applications ++ IncludedApplications, | ||
{Rest1, Acc1} = | ||
case find_app(Name, Vsn, World, LibDirs, CheckCodeLibDirs) of | ||
not_found when Optional == true -> |
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.
not_found when Optional == true -> | |
not_found when Optional -> |
Note that this omits the little weird case where an included_application
can't logically be an optional_application
but this validation allows an included app to miss if optional. I don't think we should really bother fixing that aspect yet.
Is there a need for backwards compat? Only rebar3 uses this library and it is built with a specific locked version. |
The need isn't super hard, but I guess it technically requires a bump to 5.0.0 then. |
I don't think relx has been following semver. Except for that 4.0 bump I guess. But yea, if keeping backwards compat isn't much trouble we may as well. |
Replaced by #898 |
rebar3 currently throws an error when building releases with optional applications, which were added in OTP 24. see:
erlang/rebar3#2473 for more context. it turns out that relx assumes that all deps it knows about are required, so this PR threads the optional application information through rebar3 and into relx, then does the right thing with it.