Simplify build commands

This commit is contained in:
Nicolas Mattia 2019-06-26 10:59:29 +02:00
parent 8a9363205b
commit 59642e1e3b
2 changed files with 13 additions and 25 deletions

View file

@ -1,6 +1,6 @@
src:
{ cargoBuildCommands ? [ "cargo build --frozen --release" ]
, cargoTestCommands ? [ "cargo test --release" ]
{ cargoBuild ? "cargo build --frozen --release -j $NIX_BUILD_CORES"
, cargoTest ? "cargo test --release"
, doCheck ? true
, patchCrate ? (_: _: x: x)
, name ? null
@ -61,8 +61,6 @@ with rec
CXX="clang++";
RUSTC="${rustc}/bin/rustc";
cargoBuildCommands = lib.concatStringsSep "\n" cargoBuildCommands;
cargoTestCommands = lib.concatStringsSep "\n" cargoTestCommands;
crateNames = lib.concatStringsSep "\n" crateNames;
configurePhase =
@ -89,14 +87,9 @@ with rec
''
runHook preBuild
## Build commands
## TODO: -j $NIX_BUILD_CORES
echo "$cargoBuildCommands" | \
while IFS= read -r c
do
echo "Running cargo command: $c"
$c
done
echo "Running build command:"
echo ' ${cargoBuild}'
${cargoBuild}
runHook postBuild
'';
@ -105,13 +98,9 @@ with rec
''
runHook preCheck
## test commands
echo "$cargoTestCommands" | \
while IFS= read -r c
do
echo "Running cargo (test) command: $c"
$c
done
echo "Running test command:"
echo ' ${cargoTest}'
${cargoTest}
runHook postCheck
'';

View file

@ -71,7 +71,7 @@ with
test_talent-plan-2 = buildPackage "${sources.talent-plan}/rust/projects/project-2" {};
test_talent-plan-3 = buildPackage
"${sources.talent-plan}/rust/projects/project-3"
{ cargoTestCommands = [] ; };
{ doCheck = false; };
# TODO: support for git deps
#test_talent-plan-4 = buildPackage "${sources.talent-plan}/rust/projects/project-4" {};
@ -112,16 +112,15 @@ with
};
buildPackage lucetGit
{ nativeBuildInputs = [ _pkgs.cmake _pkgs.python3 ] ;
cargoBuildCommands =
[ (lib.concatStringsSep " "
doCheck = false;
cargoBuild =
lib.concatStringsSep " "
[ "cargo build"
"-p lucetc"
"-p lucet-runtime"
"-p lucet-runtime-internals"
"-p lucet-module-data"
])
];
cargoTestCommands = [];
];
};
test_rustlings = buildPackage sources.rustlings {};