diff options
author | FlafyDev <flafyarazi@gmail.com> | 2023-06-30 15:00:56 +0300 |
---|---|---|
committer | FlafyDev <flafyarazi@gmail.com> | 2023-06-30 15:23:34 +0300 |
commit | 570f3efd1d447597fd1d468188d785dfe1207b44 (patch) | |
tree | 0b84675a4fdaef6e98ea37609b7408b9d50eda4d /pkgs/development/compilers/flutter/patches | |
parent | 4ac061369b96d09030aa16725260671ac76f5ff7 (diff) |
flutter: Separate cache and unwrapped derivations
flutter-unwrapped will now not come with engine artifacts in its cache directory(`$out/bin/cache`). To specify a different cache directory, set FLUTTER_CACHE_DIR. Flutter's wrapper now sets FLUTTER_CACHE_DIR to set engine artifacts. The sh file `$out/bin/internal/shared.sh` runs when launching Flutter and calls `"$FLUTTER_ROOT/bin/cache/` instead of our environment variable `FLUTTER_CACHE_DIR`. I decided not to patch it since the script doesn't require engine artifacts(which are the only thing not added by the unwrapped derivation), so it shouldn't fail, and patching it will just be harder to maintain.
Diffstat (limited to 'pkgs/development/compilers/flutter/patches')
-rw-r--r-- | pkgs/development/compilers/flutter/patches/flutter3/move-cache.patch | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/development/compilers/flutter/patches/flutter3/move-cache.patch b/pkgs/development/compilers/flutter/patches/flutter3/move-cache.patch index efab81d2fc0ed..cc6e5e8f49e01 100644 --- a/pkgs/development/compilers/flutter/patches/flutter3/move-cache.patch +++ b/pkgs/development/compilers/flutter/patches/flutter3/move-cache.patch @@ -35,3 +35,19 @@ index dd80b1e46e..8e54517765 100644 if (!devToolsDir.existsSync()) { throw Exception('Could not find directory at ${devToolsDir.path}'); } +diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart +index 1c31c1b5db..76c7210d3b 100644 +--- a/packages/flutter_tools/lib/src/cache.dart ++++ b/packages/flutter_tools/lib/src/cache.dart +@@ -529,6 +529,11 @@ class Cache { + + /// Return the top-level directory in the cache; this is `bin/cache`. + Directory getRoot() { ++ const Platform platform = LocalPlatform(); ++ if (platform.environment.containsKey('FLUTTER_CACHE_DIR')) { ++ return _fileSystem.directory(platform.environment['FLUTTER_CACHE_DIR']); ++ } ++ + if (_rootOverride != null) { + return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache')); + } else { |