flutter: Use JIT snapshot for flutter_tools
This commit is contained in:
parent
2dc524e2a7
commit
5f6d29a70a
1 changed files with 19 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
|||
{ buildDartApplication
|
||||
, git
|
||||
, which
|
||||
, dart
|
||||
, version
|
||||
, flutterSrc
|
||||
|
@ -11,7 +13,12 @@
|
|||
buildDartApplication.override { inherit dart; } rec {
|
||||
pname = "flutter-tools";
|
||||
inherit version;
|
||||
dartOutputType = "kernel";
|
||||
|
||||
# The SDK normally uses a JIT snapshot, so we do as well.
|
||||
# Previously, we used a kernel snapshot - but this was found to cause
|
||||
# extremely strange behaviour at runtime (observed in `flutter precache`),
|
||||
# where certain functions would not execute properly.
|
||||
dartOutputType = "jit-snapshot";
|
||||
|
||||
src = flutterSrc;
|
||||
sourceRoot = "source/packages/flutter_tools";
|
||||
|
@ -24,6 +31,17 @@ buildDartApplication.override { inherit dart; } rec {
|
|||
|
||||
dartEntryPoints."flutter_tools.snapshot" = "bin/flutter_tools.dart";
|
||||
|
||||
# When the JIT snapshot is being built, the application needs to run.
|
||||
# It attempts to generate configuration files, and relies on a few external
|
||||
# tools.
|
||||
nativeBuildInputs = [ git which ];
|
||||
preConfigure = ''
|
||||
export HOME=.
|
||||
export FLUTTER_ROOT="$NIX_BUILD_TOP/source"
|
||||
mkdir -p "$FLUTTER_ROOT/bin/cache"
|
||||
ln -s '${dart}' "$FLUTTER_ROOT/bin/cache/dart-sdk"
|
||||
'';
|
||||
|
||||
# The Dart wrapper launchers are useless for the Flutter tool - it is designed
|
||||
# to be launched from a snapshot by the SDK.
|
||||
postInstall = ''
|
||||
|
|
Loading…
Reference in a new issue