flutter: Rename platform to flutterPlatform
This helps avoid the ambiguity between Flutter platforms like Linux, IOS, and Android and platforms like linux-x64
This commit is contained in:
parent
dc1bb8caba
commit
579e01329e
@ -4,13 +4,13 @@
|
||||
, cacert
|
||||
, unzip
|
||||
|
||||
, platform
|
||||
, flutterPlatform
|
||||
, flutter
|
||||
, hash
|
||||
}:
|
||||
|
||||
let
|
||||
platforms = [
|
||||
flutterPlatforms = [
|
||||
"android"
|
||||
"ios"
|
||||
"web"
|
||||
@ -24,10 +24,10 @@ let
|
||||
flutter' = flutter.override {
|
||||
# Use a version of Flutter with just enough capabilities to download
|
||||
# artifacts.
|
||||
supportedTargetPlatforms = [ ];
|
||||
supportedTargetFlutterPlatforms = [ ];
|
||||
};
|
||||
in
|
||||
runCommand "flutter-artifacts-${platform}"
|
||||
runCommand "flutter-artifacts-${flutterPlatform}"
|
||||
{
|
||||
nativeBuildInputs = [ xorg.lndir flutter' unzip ];
|
||||
|
||||
@ -38,7 +38,7 @@ runCommand "flutter-artifacts-${platform}"
|
||||
outputHashAlgo = "sha256";
|
||||
|
||||
passthru = {
|
||||
inherit platform;
|
||||
inherit flutterPlatform;
|
||||
};
|
||||
} ''
|
||||
export FLUTTER_ROOT="$NIX_BUILD_TOP"
|
||||
@ -46,7 +46,7 @@ runCommand "flutter-artifacts-${platform}"
|
||||
rm -rf "$FLUTTER_ROOT/bin/cache"
|
||||
mkdir "$FLUTTER_ROOT/bin/cache"
|
||||
|
||||
HOME="$(mktemp -d)" flutter precache -v '--${platform}' ${builtins.concatStringsSep " " (map (p: "'--no-${p}'") (lib.remove platform platforms))}
|
||||
HOME="$(mktemp -d)" flutter precache -v '--${flutterPlatform}' ${builtins.concatStringsSep " " (map (p: "'--no-${p}'") (lib.remove flutterPlatform flutterPlatforms))}
|
||||
rm -rf "$FLUTTER_ROOT/bin/cache/lockfile"
|
||||
find "$FLUTTER_ROOT" -type l -lname '${flutter'}/*' -delete
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
runHook postInstall
|
||||
'';
|
||||
}).overrideAttrs (
|
||||
if builtins.pathExists ./overrides/${src.platform}.nix
|
||||
then callPackage ./overrides/${src.platform}.nix { }
|
||||
if builtins.pathExists ./overrides/${src.flutterPlatform}.nix
|
||||
then callPackage ./overrides/${src.flutterPlatform}.nix { }
|
||||
else ({ ... }: { })
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ let
|
||||
buildFlutterApplication = callPackage ../../../build-support/flutter {
|
||||
# Package a minimal version of Flutter that only uses Linux desktop release artifacts.
|
||||
flutter = (wrapFlutter (mkCustomFlutter args)).override {
|
||||
supportedTargetPlatforms = [ "universal" "linux" ];
|
||||
supportedTargetFlutterPlatforms = [ "universal" "linux" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
, darwin
|
||||
, callPackage
|
||||
, flutter
|
||||
, supportedTargetPlatforms ? [
|
||||
, supportedTargetFlutterPlatforms ? [
|
||||
"universal"
|
||||
"web"
|
||||
]
|
||||
@ -44,25 +44,25 @@
|
||||
}:
|
||||
|
||||
let
|
||||
supportsLinuxDesktopTarget = builtins.elem "linux" supportedTargetPlatforms;
|
||||
supportsLinuxDesktopTarget = builtins.elem "linux" supportedTargetFlutterPlatforms;
|
||||
|
||||
platformArtifacts = lib.genAttrs supportedTargetPlatforms (platform:
|
||||
flutterPlatformArtifacts = lib.genAttrs supportedTargetFlutterPlatforms (flutterPlatform:
|
||||
(callPackage ./artifacts/prepare-artifacts.nix {
|
||||
src = callPackage ./artifacts/fetch-artifacts.nix {
|
||||
inherit platform;
|
||||
inherit flutterPlatform;
|
||||
flutter = callPackage ./wrapper.nix { inherit flutter; };
|
||||
hash = artifactHashes.${platform}.${stdenv.hostPlatform.system} or "";
|
||||
hash = artifactHashes.${flutterPlatform}.${stdenv.hostPlatform.system} or "";
|
||||
};
|
||||
}));
|
||||
|
||||
cacheDir = symlinkJoin rec {
|
||||
name = "flutter-cache-dir";
|
||||
paths = builtins.attrValues platformArtifacts;
|
||||
paths = builtins.attrValues flutterPlatformArtifacts;
|
||||
postBuild = ''
|
||||
mkdir -p "$out/bin/cache"
|
||||
ln -s '${flutter}/bin/cache/dart-sdk' "$out/bin/cache"
|
||||
'';
|
||||
passthru.platform = platformArtifacts;
|
||||
passthru.flutterPlatform = flutterPlatformArtifacts;
|
||||
};
|
||||
|
||||
# By default, Flutter stores downloaded files (such as the Pub cache) in the SDK directory.
|
||||
|
Loading…
Reference in New Issue
Block a user