rusterlium / rustler

Safe Rust bridge for creating Erlang NIF functions
https://docs.rs/crate/rustler
Apache License 2.0
4.32k stars 225 forks source link

Document to use runtime: false for rustler dependency #559

Closed evnu closed 1 year ago

evnu commented 1 year ago

As noted by @hauleth in #516, the rustler dependency is only required at compile time. This PR makes that possible by expanding Rustler.construct_load_data/2 into the target module. The PR changes the documentation (and a test of the toolchain) to instruct that runtime: false can be used with rustler as a dependency.

Fix #516

evnu commented 1 year ago

I added a changelog entry and checked via rg that we refer to runtime: false everywhere:

~/tools/rustler (516-set-runtime_false ✔) rg ':rustler,'
rustler_tests/mix.exs
20:    [{:rustler, path: "../rustler_mix", runtime: false}]

prepare_release.sh
44:sed -i "s/{:rustler, \".*\"}/{:rustler, \"~> $VERSION\"}/" rustler_mix/README.md

rustler_mix/README.md
18:    {:rustler, "~> 0.29.1", runtime: false}

rustler_benchmarks/mix.exs
25:      {:rustler, path: "../rustler_mix", runtime: false}

rustler_mix/test.sh
50:  defp deps, do: [ {:rustler, path: "$rustler_mix", runtime: false} ]

rustler_mix/mix.exs
9:      app: :rustler,
filmor commented 1 year ago

The prepare release script is not correct anymore, you'll need to drop the closing } for the regex to still match.