-
Notifications
You must be signed in to change notification settings - Fork 45
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
Deprecate availability key in nif_versions #80
Comments
I'm wondering that if we should redesign this to something like versions: fn mode, target ->
["2.14"]
end where For NIF libraries that have different NIF versions available for different targets and rules for newer/older NIF versions, they can do something like versions: fn mode, target ->
case mode do
:list ->
if String.contains?(target, "foo") do
["2.14", "2.17"]
else
["2.14"]
end
:reuse ->
current_nif_version = "#{:erlang.system_info(:nif_version)}"
if current_nif_version >= "2.18" do
:compile
else
if String.contains?(target, "bar") do
"2.17"
else
"2.14"
end
end
end
end |
@cocoa-xu now that we merged, we could discuss this. In my opinion, I would go with |
I agree with you. And perhaps we don't need to pass current_nif_version = "#{:erlang.system_info(:nif_version)}" but this is just a minor detail, I'm okay with either one. Another thing is that, I think we still need to know the full list for a specific target when generating the checksum file from somewhere. This could come from the same For example, let's say that the NIF library has two versions of binaries, one is available for all platforms and using NIF version In the situation above, this function has to know if we're asking for a full list of a target for generating the checksum file, or if we're trying to reuse a precompiled binary. It cannot return the full list in the latter case and let us pick one because the default rule to pick the latest (or the oldest) possible version may not be the behaviour they want. WDYT? |
👍
How do we deal with this scenario today? |
Currently (as of the code in the master branch) we don't really handle this scenario because the function passed in the |
Perfect, I understand it now. Do you have any use case for this feature? Because one option is to not worry about this feature for now and we support only |
Not really. So perhaps we can wait if anyone requests this feature. ;)
Maybe we can pass a keyword argument to versions: fn opts ->
target = opts[:target]
end And if we need to send more parameters to versions: fn opts ->
target = opts[:target]
option2 = opts[:option2]
end WDYT? |
I think a map will be better but we should change |
yea, let's also change that to a map/ |
Beautiful. Would you like to send a PR with the changes? It would be very appreciated, thank you :) |
Sure! The PR is sent now ;) |
Instead, we should allow something such as:
This will lead to a smaller surface API. :)
But let's do this after merging #79. /cc @cocoa-xu
The text was updated successfully, but these errors were encountered: