projects/aports·blob master · refs

173 lines · 5.9 KiB

1Thanks a lot, Braid
2--- ./packages/flutter_tools/bin/tool_backend.dart.orig
3+++ ./packages/flutter_tools/bin/tool_backend.dart
4@@ -73,7 +73,7 @@
5 exit(1);
6 }
7 final String flutterExecutable = pathJoin(<String>[
8- flutterRoot,
9+ '/usr',
10 'bin',
11 if (Platform.isWindows) 'flutter.bat' else 'flutter',
12 ]);
13--- ./packages/flutter_tools/bin/tool_backend.sh.orig
14+++ ./packages/flutter_tools/bin/tool_backend.sh
15@@ -3,7 +3,4 @@
16 # Use of this source code is governed by a BSD-style license that can be
17 # found in the LICENSE file.
18
19-readonly flutter_bin_dir="${FLUTTER_ROOT}/bin"
20-readonly dart_bin_dir="${flutter_bin_dir}/cache/dart-sdk/bin"
21-
22-exec "${dart_bin_dir}/dart" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.dart" "${@:1}"
23+exec "${DART_ROOT:-"/usr/lib/dart"}/bin/dart" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.dart" "${@:1}"
24--- ./packages/flutter_tools/lib/src/artifacts.dart.orig
25+++ ./packages/flutter_tools/lib/src/artifacts.dart
26@@ -2,6 +2,8 @@
27 // Use of this source code is governed by a BSD-style license that can be
28 // found in the LICENSE file.
29
30+import 'dart:io' as io show Platform;
31+
32 import 'package:file/memory.dart';
33 import 'package:meta/meta.dart';
34 import 'package:process/process.dart';
35@@ -1306,61 +1308,9 @@
36 }
37
38 String _getDartSdkPath() {
39- final String builtPath = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk');
40- if (_fileSystem.isDirectorySync(_fileSystem.path.join(builtPath, 'bin'))) {
41- return builtPath;
42- }
43-
44- // If we couldn't find a built dart sdk, let's look for a prebuilt one.
45- final String prebuiltPath = _fileSystem.path.join(
46- _getFlutterPrebuiltsPath(),
47- _getPrebuiltTarget(),
48- 'dart-sdk',
49- );
50- if (_fileSystem.isDirectorySync(prebuiltPath)) {
51- return prebuiltPath;
52- }
53-
54- throwToolExit(
55- 'Unable to find a built dart sdk at: "$builtPath" or a prebuilt dart sdk at: "$prebuiltPath"',
56- );
57+ return io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart';
58 }
59
60- String _getFlutterPrebuiltsPath() {
61- final String engineSrcPath = _fileSystem.path.dirname(
62- _fileSystem.path.dirname(_hostEngineOutPath),
63- );
64- return _fileSystem.path.join(engineSrcPath, 'flutter', 'prebuilts');
65- }
66-
67- String _getPrebuiltTarget() {
68- final TargetPlatform hostPlatform = _currentHostPlatform(_platform, _operatingSystemUtils);
69- switch (hostPlatform) {
70- case TargetPlatform.darwin:
71- return 'macos-x64';
72- case TargetPlatform.linux_arm64:
73- return 'linux-arm64';
74- case TargetPlatform.linux_x64:
75- return 'linux-x64';
76- case TargetPlatform.windows_x64:
77- return 'windows-x64';
78- case TargetPlatform.windows_arm64:
79- return 'windows-arm64';
80- case TargetPlatform.ios:
81- case TargetPlatform.android:
82- case TargetPlatform.android_arm:
83- case TargetPlatform.android_arm64:
84- case TargetPlatform.android_x64:
85- case TargetPlatform.fuchsia_arm64:
86- case TargetPlatform.fuchsia_x64:
87- case TargetPlatform.web_javascript:
88- case TargetPlatform.tester:
89- throwToolExit('Unsupported host platform: $hostPlatform');
90- case TargetPlatform.unsupported:
91- TargetPlatform.throwUnsupportedTarget();
92- }
93- }
94-
95 String _getFlutterWebSdkPath() {
96 return _fileSystem.path.join(localEngineInfo.targetOutPath, 'flutter_web_sdk');
97 }
98@@ -1668,7 +1618,7 @@
99
100 /// Locate the Dart SDK.
101 String _dartSdkPath(Cache cache) {
102- return cache.getRoot().childDirectory('dart-sdk').path;
103+ return io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart';
104 }
105
106 class _TestArtifacts implements Artifacts {
107--- ./packages/flutter_tools/lib/src/commands/create_base.dart.orig
108+++ ./packages/flutter_tools/lib/src/commands/create_base.dart
109@@ -2,6 +2,8 @@
110 // Use of this source code is governed by a BSD-style license that can be
111 // found in the LICENSE file.
112
113+import 'dart:io' as io show Platform;
114+
115 import 'package:meta/meta.dart';
116 import 'package:uuid/uuid.dart';
117 import 'package:yaml/yaml.dart';
118@@ -339,7 +341,7 @@
119 'linuxIdentifier': linuxIdentifier,
120 'windowsIdentifier': windowsIdentifier,
121 'description': projectDescription,
122- 'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
123+ 'dartSdk': io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart',
124 'androidMinApiLevel': gradle.minSdkVersion,
125 'androidSdkVersion': gradle.minSdkVersion,
126 'pluginClass': pluginClass,
127--- ./packages/flutter_tools/lib/src/dart/pub.dart.orig
128+++ ./packages/flutter_tools/lib/src/dart/pub.dart
129@@ -3,6 +3,7 @@
130 // found in the LICENSE file.
131
132 import 'dart:async';
133+import 'dart:io' as io show Platform;
134
135 import 'package:meta/meta.dart';
136 import 'package:package_config/package_config.dart';
137@@ -545,10 +546,7 @@
138 List<String> _computePubCommand() {
139 // TODO(zanderso): refactor to use artifacts.
140 final String sdkPath = _fileSystem.path.joinAll(<String>[
141- Cache.flutterRoot!,
142- 'bin',
143- 'cache',
144- 'dart-sdk',
145+ io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart',
146 'bin',
147 'dart',
148 ]);
149--- ./packages/flutter_tools/lib/src/dart/language_version.dart.orig
150+++ ./packages/flutter_tools/lib/src/dart/language_version.dart
151@@ -3,6 +3,7 @@
152 // found in the LICENSE file.
153
154 import 'dart:async';
155+import 'dart:io' as io show Platform;
156
157 import 'package:file/file.dart';
158 import 'package:package_config/package_config.dart';
159@@ -27,7 +28,13 @@
160 // Either reading the file or parsing the version could fail on a corrupt Dart SDK.
161 // let it crash so it shows up in crash logging.
162 final File versionFile = fileSystem.file(
163- fileSystem.path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'version'),
164+ fileSystem.path.join(
165+ io.Platform.environment['DART_ROOT'] ?? '/usr/lib/dart',
166+ 'bin',
167+ 'cache',
168+ 'dart-sdk',
169+ 'version',
170+ ),
171 );
172 if (!versionFile.existsSync() && _inUnitTest()) {
173 return LanguageVersion(2, 12);