Skip to content

Commit 0a8441f

Browse files
authored
feat: support passing extra cargo args (#21)
1 parent f8cbc5f commit 0a8441f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ build = {
4747
-- Optional: if set to `false` pass `--no-default-features` to cargo
4848
default_features = false,
4949

50+
-- Optional: additional flags to be passed in the cargo invocation
51+
cargo_extra_args = {"--package, foo", "--locked"},
52+
5053
-- Optional: copy additional files to lua dir, can specify source path
5154
include = {
5255
"file.lua",

src/luarocks/build/rust-mlua.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ function mlua.run(rockspec, no_install)
4040

4141
local cmd = {"cargo build --release"}
4242

43+
for _, extra_arg in ipairs(rockspec.build.cargo_extra_args or {}) do
44+
table.insert(cmd, extra_arg)
45+
end
46+
4347
local target_path = rockspec.build and rockspec.build.target_path or "target"
4448
table.insert(cmd, "--target-dir=" .. fs.Q(target_path))
4549

0 commit comments

Comments
 (0)