Skip to content

Building workspace library crates as an intermediate step #881

Answered by BenChand
BenChand asked this question in Q&A
Discussion options

You must be logged in to vote

This seems to work:

cargoArtifacts =
  let
    deps = craneLib.buildDepsOnly commonArgs;
  in
  craneLib.buildPackage (
    commonArgs
    // {
      inherit (craneLib.crateNameFromCargoToml { inherit src; }) version;
      pname = "workspace-libs";
      cargoExtraArgs = "--workspace --lib";
      src = fileSetForCrate ./crates/libs;
      cargoArtifacts = deps;
      # We want to install the artifacts so that we can use them in the bins
      doInstallCargoArtifacts = true;
      # We want to run the tests for the libs
      doCheck = true;
    }
  );

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ipetkov
Comment options

Answer selected by ipetkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants