mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
dart: Spoof Git dependency version checks
This commit is contained in:
parent
4f4359d6ca
commit
49ce83d5b4
@ -4,7 +4,7 @@ dartConfigHook() {
|
||||
echo "Executing dartConfigHook"
|
||||
|
||||
echo "Installing dependencies"
|
||||
eval "$pubGetScript" --offline
|
||||
eval doPubGet "$pubGetScript" --offline
|
||||
|
||||
echo "Finished dartConfigHook"
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
{ stdenvNoCC
|
||||
, lib
|
||||
, makeSetupHook
|
||||
, writeShellScriptBin
|
||||
, dart
|
||||
, git
|
||||
, cacert
|
||||
@ -170,12 +171,26 @@ let
|
||||
'';
|
||||
} // buildDrvInheritArgs);
|
||||
|
||||
# As of Dart 3.0.0, Pub checks the revision of cached Git-sourced packages.
|
||||
# Git must be wrapped to return a positive result, as the real .git directory is wiped
|
||||
# to produce a deteministic dependency derivation output.
|
||||
# https://github.com/dart-lang/pub/pull/3791/files#diff-1639c4669c428c26e68cfebd5039a33f87ba568795f2c058c303ca8528f62b77R631
|
||||
gitSourceWrapper = writeShellScriptBin "git" ''
|
||||
args=("$@")
|
||||
if [[ "''${args[0]}" == "rev-list" && "''${args[1]}" == "--max-count=1" ]]; then
|
||||
revision="''${args[''${#args[@]}-1]}"
|
||||
echo "$revision"
|
||||
else
|
||||
${git}/bin/git "''${args[@]}"
|
||||
fi
|
||||
'';
|
||||
|
||||
hook = (makeSetupHook {
|
||||
# The setup hook should not be part of the fixed-output derivation.
|
||||
# Updates to the hook script should not change vendor hashes, and it won't
|
||||
# work at all anyway due to https://github.com/NixOS/nix/issues/6660.
|
||||
name = "${name}-dart-deps-setup-hook";
|
||||
substitutions = { inherit deps; };
|
||||
substitutions = { inherit gitSourceWrapper deps; };
|
||||
propagatedBuildInputs = [ dart git ];
|
||||
passthru = {
|
||||
files = deps.outPath;
|
||||
|
@ -39,3 +39,8 @@ _setupPubCache() {
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Performs the given pub get command with an appropriate environment.
|
||||
doPubGet() {
|
||||
PATH="@gitSourceWrapper@/bin:$PATH" "$@"
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ let
|
||||
|
||||
mkdir -p build/flutter_assets/fonts
|
||||
|
||||
flutter packages get --offline -v
|
||||
doPubGet flutter pub get --offline -v
|
||||
flutter build linux -v --release --split-debug-info="$debug" ${builtins.concatStringsSep " " (map (flag: "\"${flag}\"") finalAttrs.flutterBuildFlags)}
|
||||
|
||||
runHook postBuild
|
||||
|
@ -41,7 +41,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
dart pub get --offline
|
||||
doPubGet dart pub get --offline
|
||||
mkdir build
|
||||
ln -s ${embedded-protocol} build/embedded-protocol
|
||||
runHook postConfigure
|
||||
|
Loading…
Reference in New Issue
Block a user