build-rust-crate: disable incremental builds

This commit is contained in:
zseri 2021-03-25 16:52:17 +01:00 committed by Milan
parent 18165d6411
commit ff5ff66ef3
2 changed files with 9 additions and 7 deletions

View File

@ -9,12 +9,14 @@
let
baseRustcOpts =
[(if release then "-C opt-level=3" else "-C debuginfo=2")]
++ ["-C codegen-units=$NIX_BUILD_CORES"]
++ ["--remap-path-prefix=$NIX_BUILD_TOP=/" ]
++ [(mkRustcDepArgs dependencies crateRenames)]
++ [(mkRustcFeatureArgs crateFeatures)]
++ extraRustcOpts
[
(if release then "-C opt-level=3" else "-C debuginfo=2")
"-C codegen-units=$NIX_BUILD_CORES"
"-C incremental=no"
"--remap-path-prefix=$NIX_BUILD_TOP=/"
(mkRustcDepArgs dependencies crateRenames)
(mkRustcFeatureArgs crateFeatures)
] ++ extraRustcOpts
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--target ${rust.toRustTargetSpec stdenv.hostPlatform} -C linker=${stdenv.hostPlatform.config}-gcc"
# since rustc 1.42 the "proc_macro" crate is part of the default crate prelude
# https://github.com/rust-lang/cargo/commit/4d64eb99a4#diff-7f98585dbf9d30aa100c8318e2c77e79R1021-R1022

View File

@ -24,7 +24,7 @@ let version_ = lib.splitString "-" crateVersion;
version = lib.splitVersion (lib.head version_);
rustcOpts = lib.foldl' (opts: opt: opts + " " + opt)
(if release then "-C opt-level=3" else "-C debuginfo=2")
(["-C codegen-units=$NIX_BUILD_CORES"] ++ extraRustcOpts);
(["-C codegen-units=$NIX_BUILD_CORES -C incremental=no"] ++ extraRustcOpts);
buildDeps = mkRustcDepArgs buildDependencies crateRenames;
authors = lib.concatStringsSep ":" crateAuthors;
optLevel = if release then 3 else 0;