-
Notifications
You must be signed in to change notification settings - Fork 30
Description
TL;DR: This is a request for a change to how the force_build option is set. It's not a bug report. I want to be able speed up build times that involve pre-releases by using pre-compiled NIFs.
According to the docs for 0.5.5, about the force_build option:
This is false by default, but if your :version is a pre-release (like "2.1.0-dev"), this option will always be set true
It goes on to show how it can otherwise be configured like this:
config :rustler_precompiled, :force_build, your_otp_app: true
I can confirm that rustler_precompiled works just as written there: no matter how I try to configure force_build as false, as long as I'm working with a pre-release version, force_build always ends up being true.
I can see the implementation here in config.ex:
force_build?: pre_release?(version) or Keyword.fetch!(opts, :force_build)So there's no bug here.
But I would prefer to be able to set this option according to my needs, rather than having to release the package with a production version just to speed up my builds with pre-compiled NIFs.
It seems to be mixing concerns to insist on force_build: true for pre-releases, no matter what, regardless of all other configuration. It means I have to cut a production release of the package before it's ready, just to leverage the build time improvements that would otherwise be available through rustler_precompiled. Releasing a new production version might result in other packages picking up the package as "latest", even though I still consider it "under development" and not ready to be included in production application builds.
It may be significant to my use case that I'm trying to use rustler_precompiled for a private package. In my case, I own both the library code (the Elixir/rustler module), and the Elixir application code that depends upon that library. I want to speed up the build time of the application code when it depends on a pre-release version of the library.
It seems that rustler_precompiled is intended primarily for publicly released open source packages, as evidenced by the fact that the base_url is assumed to be publicly reachable when fetching pre-compiled NIFs (there's no way to configure authentication for the request in download_nif_artifact/1). I can imagine that for such public packages it might be a best practice, perhaps as a matter of security, to insist on force_build: true for any pre-released dependency.
Even if so, I wouldn't want such a best practice to make it impossible for me to use pre-compiled pre-release NIFs to speed up my private application builds that depend on my private NIF library.
It's normal for me, when iterating on a full stack feature that spans multiple code bases, to have one code base depend upon an Elixir/rustler package where both are under development. I need to be able to integrate all of the system components throughout a development cycle. I don't want to tag a NIF library with a production version until it's actually ready for production. That would probably result in its being taken up as the new "latest" version in the package management system and incorporated into production-ready application builds prematurely.
But I do want to get my builds running faster, because the development workflow involves building again, and again, and again, and again. It would boost productivity to speed up these build times, by allowing the application to build against a pre-built pre-release NIF library when I choose to do so.