summary refs log tree commit diff
path: root/pkgs/development/compilers/flutter/patches/stable/move-cache.patch
blob: e5719a2867f908a53856fd856bd6c9c8d4cc277e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff --git a/dev/devicelab/lib/framework/runner.dart b/dev/devicelab/lib/framework/runner.dart
index 9fae74726..d88d6ecbb 100644
--- a/dev/devicelab/lib/framework/runner.dart
+++ b/dev/devicelab/lib/framework/runner.dart
@@ -126,7 +126,7 @@ Future<void> cleanupSystem() async {
     print('\nTelling Gradle to shut down (JAVA_HOME=$javaHome)');
     final String gradlewBinaryName = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
     final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_shutdown_gradle.');
-    recursiveCopy(Directory(path.join(flutterDirectory.path, 'bin', 'cache', 'artifacts', 'gradle_wrapper')), tempDir);
+    recursiveCopy(Directory(path.join(homeDirPath, '.cache', 'flutter', 'artifacts', 'gradle_wrapper')), tempDir);
     copy(File(path.join(path.join(flutterDirectory.path, 'packages', 'flutter_tools'), 'templates', 'app', 'android.tmpl', 'gradle', 'wrapper', 'gradle-wrapper.properties')), Directory(path.join(tempDir.path, 'gradle', 'wrapper')));
     if (!Platform.isWindows) {
       await exec(
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index e6216c737..5ab497092 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -6,6 +6,7 @@ import 'dart:async';
 
 import 'package:yaml/yaml.dart';
 
+import 'base/common.dart';
 import 'base/context.dart';
 import 'base/file_system.dart';
 import 'base/platform.dart';
@@ -326,7 +327,7 @@ List<_Asset> _getMaterialAssets(String fontSet) {
     for (Map<dynamic, dynamic> font in family['fonts']) {
       final Uri entryUri = fs.path.toUri(font['asset'] as String);
       result.add(_Asset(
-        baseDir: fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
+        baseDir: fs.path.join(homeDirPath, '.cache', 'flutter', 'artifacts', 'material_fonts'),
         relativeUri: Uri(path: entryUri.pathSegments.last),
         entryUri: entryUri,
       ));
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 5e1950b56..45585f9c0 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -164,8 +164,14 @@ class Cache {
       return;
     }
     assert(_lock == null);
+
+    final Directory dir = fs.directory(fs.path.join(homeDirPath, '.cache', 'flutter'));
+    if (!dir.existsSync()) {
+      dir.createSync(recursive: true);
+      os.chmod(dir, '755');
+    }
     final File lockFile =
-        fs.file(fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile'));
+        fs.file(fs.path.join(homeDirPath, '.cache', 'flutter', 'lockfile'));
     try {
       _lock = lockFile.openSync(mode: FileMode.write);
     } on FileSystemException catch (e) {
@@ -239,7 +245,7 @@ class Cache {
     if (_rootOverride != null) {
       return fs.directory(fs.path.join(_rootOverride.path, 'bin', 'cache'));
     } else {
-      return fs.directory(fs.path.join(flutterRoot, 'bin', 'cache'));
+      return fs.directory(fs.path.join(homeDirPath, '.cache', 'flutter'));
     }
   }