buildRustCrate: added some edge cases with binaries
This commit adds test based on real-world crates (brotli). There were a few more edge cases that were missing beforehand. Also it turned out that we can get rid of the `finalBins` list since that will now be handled during runtime.
This commit is contained in:
@@ -115,8 +115,7 @@ stdenv.mkDerivation (rec {
|
||||
|
||||
crateBin = if crate ? crateBin then
|
||||
builtins.foldl' (bins: bin: let
|
||||
_name = (if bin ? name then bin.name else crateName);
|
||||
name = lib.strings.replaceStrings ["-"] ["_"] _name;
|
||||
name = (if bin ? name then bin.name else crateName);
|
||||
path = if bin ? path then bin.path else "";
|
||||
in
|
||||
bins + (if bin == "" then "" else ",") + "${name} ${path}"
|
||||
@@ -124,18 +123,6 @@ stdenv.mkDerivation (rec {
|
||||
) "" crate.crateBin
|
||||
else "";
|
||||
|
||||
finalBins = if crate ? crateBin then
|
||||
builtins.foldl' (bins: bin:
|
||||
let name = lib.strings.replaceStrings ["-"] ["_"]
|
||||
(if bin ? name then bin.name else crateName);
|
||||
new_name = if bin ? name then bin.name else crateName;
|
||||
in
|
||||
if name == new_name then bins else
|
||||
(bins + "mv target/bin/${name} target/bin/${new_name};")
|
||||
|
||||
) "" crate.crateBin
|
||||
else "";
|
||||
|
||||
build = crate.build or "";
|
||||
workspace_member = crate.workspace_member or ".";
|
||||
crateVersion = crate.version;
|
||||
@@ -156,7 +143,7 @@ stdenv.mkDerivation (rec {
|
||||
buildPhase = buildCrate {
|
||||
inherit crateName dependencies
|
||||
crateFeatures libName release libPath crateType
|
||||
metadata crateBin finalBins verbose colors
|
||||
metadata crateBin verbose colors
|
||||
extraRustcOpts;
|
||||
};
|
||||
installPhase = installCrate crateName metadata;
|
||||
|
||||
Reference in New Issue
Block a user