naersk icon indicating copy to clipboard operation
naersk copied to clipboard

How to achieve `cargo build --bins --lib --tests`?

Open doivosevic opened this issue 4 years ago • 1 comments

Hey, I've been rereading these docs for a while now and I cannot figure out which "targets" the parameters is referring to when saying "targets | The targets to build if the Cargo.toml is a virtual manifest".

I wish to achieve the same as in the issue title, that is: cargo build --bins --lib --tests. How would I write the config to achieve this in the spirit of this API?

doivosevic avatar May 14 '21 16:05 doivosevic

I think this is what you want:

# ...
in naersk.buildPackage {
  inherit src;
  # concat existing options with custom options
  # takes lambda input
  cargoBuildOptions = inputList: inputList ++ ["--bins" "--tests"];
  # ...
}

This will change the "cargo build"-arguments.

phip1611 avatar May 18 '21 11:05 phip1611