1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-25 20:25:28 +03:00
aports/testing/flutter/system-dart.patch
2024-10-24 21:38:58 +00:00

194 lines
7.2 KiB
Diff

Thanks a lot, Braid
--- ./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:-"/usr/lib/dart"}/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'] ?? '/usr/lib/dart';
}
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'] ?? '/usr/lib/dart';
}
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'] ?? '/usr/lib/dart';
+ 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'] ?? '/usr/lib/dart',
'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'] ?? '/usr/lib/dart',
'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'] ?? '/usr/lib/dart');
if (!versionFile.existsSync() && _inUnitTest()) {
return LanguageVersion(2, 12);
}