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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
--- ./packages/flutter_tools/bin/tool_backend.dart.orig
+++ ./packages/flutter_tools/bin/tool_backend.dart
@@ -69,12 +69,9 @@
exit(1);
}
final String flutterExecutable = pathJoin(<String>[
- flutterRoot,
+ '/usr',
'bin',
- if (Platform.isWindows)
- 'flutter.bat'
- else
- 'flutter',
+ 'flutter',
]);
final String bundlePlatform = targetPlatform.startsWith('windows') ? 'windows' : targetPlatform;
final String target = '${buildMode}_bundle_${bundlePlatform}_assets';
--- ./packages/flutter_tools/bin/tool_backend.sh.orig
+++ ./packages/flutter_tools/bin/tool_backend.sh
@@ -3,7 +3,4 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-readonly flutter_bin_dir="${FLUTTER_ROOT}/bin"
-readonly dart_bin_dir="${flutter_bin_dir}/cache/dart-sdk/bin"
-
-exec "${dart_bin_dir}/dart" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.dart" "${@:1}"
+exec "${DART_ROOT:-"/opt/dart-sdk"}/bin/dart" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.dart" "${@:1}"
--- ./packages/flutter_tools/gradle/src/main/groovy/flutter.groovy.orig
+++ ./packages/flutter_tools/gradle/src/main/groovy/flutter.groovy
@@ -324,7 +324,7 @@
}
String flutterExecutableName = Os.isFamily(Os.FAMILY_WINDOWS) ? "flutter.bat" : "flutter"
- flutterExecutable = Paths.get(flutterRoot.absolutePath, "bin", flutterExecutableName).toFile()
+ flutterExecutable = Paths.get("/usr", "bin", flutterExecutableName).toFile()
// Validate that the provided Gradle, Java, AGP, and KGP versions are all within our
// supported range.
--- ./packages/flutter_tools/lib/src/artifacts.dart.orig
+++ ./packages/flutter_tools/lib/src/artifacts.dart
@@ -2,6 +2,8 @@
// 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 'package:file/memory.dart';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
@@ -1176,50 +1176,7 @@
}
String _getDartSdkPath() {
- final String builtPath = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk');
- if (_fileSystem.isDirectorySync(_fileSystem.path.join(builtPath, 'bin'))) {
- return builtPath;
- }
-
- // If we couldn't find a built dart sdk, let's look for a prebuilt one.
- final String prebuiltPath = _fileSystem.path.join(_getFlutterPrebuiltsPath(), _getPrebuiltTarget(), 'dart-sdk');
- if (_fileSystem.isDirectorySync(prebuiltPath)) {
- return prebuiltPath;
- }
-
- throw ToolExit('Unable to find a built dart sdk at: "$builtPath" or a prebuilt dart sdk at: "$prebuiltPath"');
- }
-
- String _getFlutterPrebuiltsPath() {
- final String engineSrcPath = _fileSystem.path.dirname(_fileSystem.path.dirname(_hostEngineOutPath));
- return _fileSystem.path.join(engineSrcPath, 'flutter', 'prebuilts');
- }
-
- String _getPrebuiltTarget() {
- final TargetPlatform hostPlatform = _currentHostPlatform(_platform, _operatingSystemUtils);
- switch (hostPlatform) {
- case TargetPlatform.darwin:
- return 'macos-x64';
- case TargetPlatform.linux_arm64:
- return 'linux-arm64';
- case TargetPlatform.linux_x64:
- return 'linux-x64';
- case TargetPlatform.windows_x64:
- return 'windows-x64';
- case TargetPlatform.windows_arm64:
- return 'windows-arm64';
- case TargetPlatform.ios:
- case TargetPlatform.android:
- case TargetPlatform.android_arm:
- case TargetPlatform.android_arm64:
- case TargetPlatform.android_x64:
- case TargetPlatform.android_x86:
- case TargetPlatform.fuchsia_arm64:
- case TargetPlatform.fuchsia_x64:
- case TargetPlatform.web_javascript:
- case TargetPlatform.tester:
- throwToolExit('Unsupported host platform: $hostPlatform');
- }
+ return io.Platform.environment['DART_ROOT'] ?? '/opt/dart-sdk';
}
String _getFlutterWebSdkPath() {
@@ -1382,7 +1343,7 @@
/// Locate the Dart SDK.
String _dartSdkPath(Cache cache) {
- return cache.getRoot().childDirectory('dart-sdk').path;
+ return io.Platform.environment['DART_ROOT'] ?? '/opt/dart-sdk';
}
class _TestArtifacts implements Artifacts {
--- ./packages/flutter_tools/lib/src/cache.dart.orig
+++ ./packages/flutter_tools/lib/src/cache.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
+import 'dart:io' as io show Platform;
import 'package:crypto/crypto.dart';
import 'package:file/memory.dart';
@@ -380,8 +381,8 @@
String get devToolsVersion {
if (_devToolsVersion == null) {
- const String devToolsDirPath = 'dart-sdk/bin/resources/devtools';
- final Directory devToolsDir = getCacheDir(devToolsDirPath, shouldCreate: false);
+ final String dartSdkRoot = io.Platform.environment['DART_ROOT'] ?? '/opt/dart-sdk';
+ final Directory devToolsDir = _fileSystem.directory(dartSdkRoot + '/bin/resources/devtools');
if (!devToolsDir.existsSync()) {
throw Exception('Could not find directory at ${devToolsDir.path}');
}
--- ./packages/flutter_tools/lib/src/commands/create_base.dart.orig
+++ ./packages/flutter_tools/lib/src/commands/create_base.dart
@@ -2,6 +2,8 @@
// 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 'package:meta/meta.dart';
import 'package:uuid/uuid.dart';
@@ -391,7 +393,7 @@
'linuxIdentifier': linuxIdentifier,
'windowsIdentifier': windowsIdentifier,
'description': projectDescription,
- 'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
+ 'dartSdk': io.Platform.environment['DART_ROOT'] ?? '/opt/dart-sdk',
'androidMinApiLevel': android_common.minApiLevel,
'androidSdkVersion': kAndroidSdkMinVersion,
'pluginClass': pluginClass,
--- ./packages/flutter_tools/lib/src/dart/pub.dart.orig
+++ ./packages/flutter_tools/lib/src/dart/pub.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
+import 'dart:io' as io show Platform;
import 'package:meta/meta.dart';
import 'package:package_config/package_config.dart';
@@ -545,10 +546,7 @@
List<String> _computePubCommand() {
// TODO(zanderso): refactor to use artifacts.
final String sdkPath = _fileSystem.path.joinAll(<String>[
- Cache.flutterRoot!,
- 'bin',
- 'cache',
- 'dart-sdk',
+ io.Platform.environment['DART_ROOT'] ?? '/opt/dart-sdk',
'bin',
'dart',
]);
--- ./packages/flutter_tools/lib/src/dart/language_version.dart.orig
+++ ./packages/flutter_tools/lib/src/dart/language_version.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
+import 'dart:io' as io show Platform;
import 'package:file/file.dart';
import 'package:package_config/package_config.dart';
@@ -26,7 +27,7 @@
}
// Either reading the file or parsing the version could fail on a corrupt Dart SDK.
// let it crash so it shows up in crash logging.
- final File versionFile = fileSystem.file(fileSystem.path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'version'));
+ final File versionFile = fileSystem.file(io.Platform.environment['DART_ROOT'] ?? '/opt/dart-sdk');
if (!versionFile.existsSync() && _inUnitTest()) {
return LanguageVersion(2, 12);
}
|