Merge pull request #77822 from andir/buildRustCrate-remove-custom-lib-path
buildRustCrate: remove custom lib path heuristic
This commit is contained in:
commit
60fea726de
@ -55,9 +55,6 @@
|
|||||||
elif [[ -e src/lib.rs ]]; then
|
elif [[ -e src/lib.rs ]]; then
|
||||||
build_lib src/lib.rs
|
build_lib src/lib.rs
|
||||||
${lib.optionalString buildTests "build_lib_test src/lib.rs"}
|
${lib.optionalString buildTests "build_lib_test src/lib.rs"}
|
||||||
elif [[ -e "src/$LIB_NAME.rs" ]]; then
|
|
||||||
build_lib src/$LIB_NAME.rs
|
|
||||||
${lib.optionalString buildTests ''build_lib_test "src/$LIB_NAME.rs"''}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, buildRustCrate, runCommand, writeTextFile, symlinkJoin, callPackage }:
|
{ lib, buildRustCrate, runCommand, writeTextFile, symlinkJoin, callPackage, releaseTools }:
|
||||||
let
|
let
|
||||||
mkCrate = args: let
|
mkCrate = args: let
|
||||||
p = {
|
p = {
|
||||||
@ -92,7 +92,17 @@ let
|
|||||||
cases = {
|
cases = {
|
||||||
libPath = { libPath = "src/my_lib.rs"; src = mkLib "src/my_lib.rs"; };
|
libPath = { libPath = "src/my_lib.rs"; src = mkLib "src/my_lib.rs"; };
|
||||||
srcLib = { src = mkLib "src/lib.rs"; };
|
srcLib = { src = mkLib "src/lib.rs"; };
|
||||||
customLibName = { libName = "test_lib"; src = mkLib "src/test_lib.rs"; };
|
|
||||||
|
# This used to be supported by cargo but as of 1.40.0 I can't make it work like that with just cargo anymore.
|
||||||
|
# This might be a regression or deprecated thing they finally removed…
|
||||||
|
# customLibName = { libName = "test_lib"; src = mkLib "src/test_lib.rs"; };
|
||||||
|
# rustLibTestsCustomLibName = {
|
||||||
|
# libName = "test_lib";
|
||||||
|
# src = mkTestFile "src/test_lib.rs" "foo";
|
||||||
|
# buildTests = true;
|
||||||
|
# expectedTestOutputs = [ "test foo ... ok" ];
|
||||||
|
# };
|
||||||
|
|
||||||
customLibNameAndLibPath = { libName = "test_lib"; libPath = "src/best-lib.rs"; src = mkLib "src/best-lib.rs"; };
|
customLibNameAndLibPath = { libName = "test_lib"; libPath = "src/best-lib.rs"; src = mkLib "src/best-lib.rs"; };
|
||||||
crateBinWithPath = { crateBin = [{ name = "test_binary1"; path = "src/foobar.rs"; }]; src = mkBin "src/foobar.rs"; };
|
crateBinWithPath = { crateBin = [{ name = "test_binary1"; path = "src/foobar.rs"; }]; src = mkBin "src/foobar.rs"; };
|
||||||
crateBinNoPath1 = { crateBin = [{ name = "my-binary2"; }]; src = mkBin "src/my_binary2.rs"; };
|
crateBinNoPath1 = { crateBin = [{ name = "my-binary2"; }]; src = mkBin "src/my_binary2.rs"; };
|
||||||
@ -122,12 +132,6 @@ let
|
|||||||
buildTests = true;
|
buildTests = true;
|
||||||
expectedTestOutputs = [ "test baz ... ok" ];
|
expectedTestOutputs = [ "test baz ... ok" ];
|
||||||
};
|
};
|
||||||
rustLibTestsCustomLibName = {
|
|
||||||
libName = "test_lib";
|
|
||||||
src = mkTestFile "src/test_lib.rs" "foo";
|
|
||||||
buildTests = true;
|
|
||||||
expectedTestOutputs = [ "test foo ... ok" ];
|
|
||||||
};
|
|
||||||
rustLibTestsCustomLibPath = {
|
rustLibTestsCustomLibPath = {
|
||||||
libPath = "src/test_path.rs";
|
libPath = "src/test_path.rs";
|
||||||
src = mkTestFile "src/test_path.rs" "bar";
|
src = mkTestFile "src/test_path.rs" "bar";
|
||||||
@ -207,9 +211,12 @@ let
|
|||||||
test -e ${pkg}/bin/brotli-decompressor && touch $out
|
test -e ${pkg}/bin/brotli-decompressor && touch $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
test = runCommand "run-buildRustCrate-tests" {
|
test = releaseTools.aggregate {
|
||||||
nativeBuildInputs = builtins.attrValues tests;
|
name = "buildRustCrate-tests";
|
||||||
} "
|
meta = {
|
||||||
touch $out
|
description = "Test cases for buildRustCrate";
|
||||||
";
|
maintainers = [ lib.maintainers.andir ];
|
||||||
|
};
|
||||||
|
constituents = builtins.attrValues tests;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -8766,7 +8766,7 @@ in
|
|||||||
|
|
||||||
buildRustCrate = callPackage ../build-support/rust/build-rust-crate { };
|
buildRustCrate = callPackage ../build-support/rust/build-rust-crate { };
|
||||||
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };
|
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };
|
||||||
buildRustCrateTests = recurseIntoAttrs (callPackage ../build-support/rust/build-rust-crate/test { }).tests;
|
buildRustCrateTests = recurseIntoAttrs (callPackage ../build-support/rust/build-rust-crate/test { });
|
||||||
cratesIO = callPackage ../build-support/rust/crates-io.nix { };
|
cratesIO = callPackage ../build-support/rust/crates-io.nix { };
|
||||||
|
|
||||||
cargo-web = callPackage ../development/tools/cargo-web {
|
cargo-web = callPackage ../development/tools/cargo-web {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user