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

Document to use runtime: false for rustler dependency #559

Merged
merged 7 commits into from
Aug 29, 2023

Conversation

evnu
Copy link
Member

@evnu evnu commented Aug 17, 2023

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 evnu requested a review from a team August 17, 2023 21:31
Copy link
Member

@filmor filmor left a comment

Choose a reason for hiding this comment

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

Could you update the Changelog and docs accordingly? I'm very much in favour of this, it looks like an oversight.

@evnu
Copy link
Member Author

evnu commented Aug 28, 2023

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,

evnu added 5 commits August 28, 2023 10:17
When using `runtime: false`, we do not have access to the `Rustler`
module. Thus, we also cannot call `Rustler.construct_load_data/2` when
loading the NIF module. In order to allow `runtime: false` and also
construct `load_data` at load time, we need to add
`construct_load_data/2` to the target module.
@evnu evnu force-pushed the 516-set-runtime_false branch from fe48559 to ad7320d Compare August 28, 2023 08:17
@filmor
Copy link
Member

filmor commented Aug 28, 2023

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

@filmor filmor merged commit af496ee into rusterlium:master Aug 29, 2023
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.

Store rustler template outside of priv/?
2 participants