summarylogtreecommitdiffstats
path: root/gradle-user-home.patch
blob: 2e98fbc6e448c8449402c3b8c86acc1d17466f9a (plain)
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
--- ./packages/flutter_tools/gradle/build.gradle.kts.orig
+++ ./packages/flutter_tools/gradle/build.gradle.kts
@@ -7,6 +7,8 @@
     `groovy`
 }

+project.buildDir = file(project.gradle.gradleUserHomeDir.path + "/flutter/build")
+
 group = "dev.flutter.plugin"
 version = "1.0.0"

--- ./packages/flutter_tools/lib/src/android/gradle.dart.orig
+++ ./packages/flutter_tools/lib/src/android/gradle.dart
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

+import 'dart:io' as io show Platform;
 import 'dart:math';

 import 'package:crypto/crypto.dart';
@@ -361,6 +362,10 @@
       "Running Gradle task '$assembleTask'...",
     );

+
+    final gradleUserHome = io.Platform.environment['GRADLE_USER_HOME'] ??
+        io.Platform.environment['HOME']! + '/.gradle';
+    command.add('--project-cache-dir=$gradleUserHome/flutter/.gradle');
     if (_logger.isVerbose) {
       command.add('--full-stacktrace');
       command.add('--info');