mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 19:30:11 +00:00
dart.list-dart-deps: Add list-dart-deps function
This uses `dart pub deps` (https://dart.dev/tools/pub/cmd/pub-deps) to retrieve information about project dependencies. It requires a fetch-dart-deps derivation as input.
This commit is contained in:
28
pkgs/build-support/dart/list-dart-deps/default.nix
Normal file
28
pkgs/build-support/dart/list-dart-deps/default.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ stdenv
|
||||
, dart
|
||||
, jq
|
||||
}:
|
||||
deps:
|
||||
|
||||
builtins.fromJSON (builtins.readFile (stdenv.mkDerivation {
|
||||
name = "${deps.name}-list.json";
|
||||
nativeBuildInputs = [ deps dart jq ];
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
ln -s "${deps.files}"/pubspec/* .
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
dart pub get --offline
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
dart pub deps --json | jq .packages > $out
|
||||
runHook postBuild
|
||||
'';
|
||||
}))
|
||||
Reference in New Issue
Block a user