mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 10:23:29 +00:00
flutter: Don't use an external artifact cache
The internal artifacts should be used, as they have been patched to use Nix libraries. Co-authored-by: FlafyDev <flafyarazi@gmail.com> Co-authored-by: gilice <gilice@proton.me> Co-authored-by: hacker1024 <hacker1024@users.sourceforge.net>
This commit is contained in:
parent
e552959395
commit
d6ce0dafcf
@ -1,31 +1,5 @@
|
||||
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
|
||||
index ed42baea29..12941f733a 100644
|
||||
--- a/packages/flutter_tools/lib/src/asset.dart
|
||||
+++ b/packages/flutter_tools/lib/src/asset.dart
|
||||
@@ -11,11 +11,11 @@ import 'base/file_system.dart';
|
||||
import 'base/logger.dart';
|
||||
import 'base/platform.dart';
|
||||
import 'build_info.dart';
|
||||
-import 'cache.dart';
|
||||
import 'convert.dart';
|
||||
import 'dart/package_map.dart';
|
||||
import 'devfs.dart';
|
||||
import 'flutter_manifest.dart';
|
||||
+import 'globals.dart' as globals;
|
||||
import 'license_collector.dart';
|
||||
import 'project.dart';
|
||||
|
||||
@@ -504,7 +504,7 @@ class ManifestAssetBundle implements AssetBundle {
|
||||
}
|
||||
final Uri entryUri = _fileSystem.path.toUri(asset);
|
||||
result.add(_Asset(
|
||||
- baseDir: _fileSystem.path.join(Cache.flutterRoot!, 'bin', 'cache', 'artifacts', 'material_fonts'),
|
||||
+ baseDir: _fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter', 'artifacts', 'material_fonts'),
|
||||
relativeUri: Uri(path: entryUri.pathSegments.last),
|
||||
entryUri: entryUri,
|
||||
package: null,
|
||||
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
|
||||
index defc86cc20..7fdf14d112 100644
|
||||
index dd80b1e46e..8e54517765 100644
|
||||
--- a/packages/flutter_tools/lib/src/cache.dart
|
||||
+++ b/packages/flutter_tools/lib/src/cache.dart
|
||||
@@ -22,6 +22,7 @@ import 'base/user_messages.dart';
|
||||
@ -36,7 +10,7 @@ index defc86cc20..7fdf14d112 100644
|
||||
|
||||
const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo)
|
||||
const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo)
|
||||
@@ -322,8 +323,13 @@ class Cache {
|
||||
@@ -318,8 +319,13 @@ class Cache {
|
||||
return;
|
||||
}
|
||||
assert(_lock == null);
|
||||
@ -51,7 +25,7 @@ index defc86cc20..7fdf14d112 100644
|
||||
try {
|
||||
_lock = lockFile.openSync(mode: FileMode.write);
|
||||
} on FileSystemException catch (e) {
|
||||
@@ -382,8 +388,7 @@ class Cache {
|
||||
@@ -378,8 +384,7 @@ class Cache {
|
||||
|
||||
String get devToolsVersion {
|
||||
if (_devToolsVersion == null) {
|
||||
@ -61,12 +35,3 @@ index defc86cc20..7fdf14d112 100644
|
||||
if (!devToolsDir.existsSync()) {
|
||||
throw Exception('Could not find directory at ${devToolsDir.path}');
|
||||
}
|
||||
@@ -536,7 +541,7 @@ class Cache {
|
||||
if (_rootOverride != null) {
|
||||
return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache'));
|
||||
} else {
|
||||
- return _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin', 'cache'));
|
||||
+ return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,3 @@
|
||||
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
|
||||
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
|
||||
index 9dd7272fbe..642c8e48e4 100644
|
||||
--- a/packages/flutter_tools/lib/src/asset.dart
|
||||
+++ b/packages/flutter_tools/lib/src/asset.dart
|
||||
@@ -16,6 +16,7 @@ import 'convert.dart';
|
||||
import 'dart/package_map.dart';
|
||||
import 'devfs.dart';
|
||||
import 'flutter_manifest.dart';
|
||||
+import 'globals.dart' as globals;
|
||||
import 'license_collector.dart';
|
||||
import 'project.dart';
|
||||
|
||||
@@ -530,8 +531,7 @@ class ManifestAssetBundle implements AssetBundle {
|
||||
final Uri entryUri = _fileSystem.path.toUri(asset);
|
||||
result.add(_Asset(
|
||||
baseDir: _fileSystem.path.join(
|
||||
- Cache.flutterRoot!,
|
||||
- 'bin', 'cache', 'artifacts', 'material_fonts',
|
||||
+ globals.fsUtils.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 dd80b1e46e..8e54517765 100644
|
||||
--- a/packages/flutter_tools/lib/src/cache.dart
|
||||
@ -58,141 +35,3 @@ index dd80b1e46e..8e54517765 100644
|
||||
if (!devToolsDir.existsSync()) {
|
||||
throw Exception('Could not find directory at ${devToolsDir.path}');
|
||||
}
|
||||
@@ -532,7 +537,7 @@ class Cache {
|
||||
if (_rootOverride != null) {
|
||||
return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache'));
|
||||
} else {
|
||||
- return _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin', 'cache'));
|
||||
+ return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
|
||||
}
|
||||
}
|
||||
|
||||
index c539d67156..4e0a64f7a9 100644
|
||||
--- a/packages/flutter_tools/lib/src/artifacts.dart
|
||||
+++ b/packages/flutter_tools/lib/src/artifacts.dart
|
||||
@@ -346,10 +346,10 @@ class CachedArtifacts implements Artifacts {
|
||||
) {
|
||||
switch (artifact) {
|
||||
case HostArtifact.engineDartSdkPath:
|
||||
- final String path = _dartSdkPath(_cache);
|
||||
+ final String path = _dartSdkPath(_fileSystem);
|
||||
return _fileSystem.directory(path);
|
||||
case HostArtifact.engineDartBinary:
|
||||
- final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _hostArtifactToFileName(artifact, _platform));
|
||||
+ final String path = _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', _hostArtifactToFileName(artifact, _platform));
|
||||
return _fileSystem.file(path);
|
||||
case HostArtifact.flutterWebSdk:
|
||||
final String path = _getFlutterWebSdkPath();
|
||||
@@ -398,7 +398,7 @@ class CachedArtifacts implements Artifacts {
|
||||
case HostArtifact.dart2jsSnapshot:
|
||||
case HostArtifact.dartdevcSnapshot:
|
||||
case HostArtifact.kernelWorkerSnapshot:
|
||||
- final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
||||
+ final String path = _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
||||
return _fileSystem.file(path);
|
||||
case HostArtifact.iosDeploy:
|
||||
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
||||
@@ -465,11 +465,13 @@ class CachedArtifacts implements Artifacts {
|
||||
String _getAndroidArtifactPath(Artifact artifact, TargetPlatform platform, BuildMode mode) {
|
||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||
switch (artifact) {
|
||||
+ case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
+ assert(mode != BuildMode.debug, 'Artifact $artifact only available in non-debug mode.');
|
||||
+ return _fileSystem.path.join(engineDir, _artifactToFileName(artifact));
|
||||
case Artifact.genSnapshot:
|
||||
assert(mode != BuildMode.debug, 'Artifact $artifact only available in non-debug mode.');
|
||||
final String hostPlatform = getNameForHostPlatform(getCurrentHostPlatform());
|
||||
return _fileSystem.path.join(engineDir, hostPlatform, _artifactToFileName(artifact));
|
||||
- case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
case Artifact.constFinder:
|
||||
case Artifact.flutterFramework:
|
||||
case Artifact.flutterMacOSFramework:
|
||||
@@ -497,13 +499,13 @@ class CachedArtifacts implements Artifacts {
|
||||
switch (artifact) {
|
||||
case Artifact.genSnapshot:
|
||||
case Artifact.flutterXcframework:
|
||||
+ case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
final String artifactFileName = _artifactToFileName(artifact)!;
|
||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||
return _fileSystem.path.join(engineDir, artifactFileName);
|
||||
case Artifact.flutterFramework:
|
||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||
return _getIosEngineArtifactPath(engineDir, environmentType, _fileSystem);
|
||||
- case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
case Artifact.constFinder:
|
||||
case Artifact.flutterMacOSFramework:
|
||||
case Artifact.flutterPatchedSdkPath:
|
||||
@@ -586,14 +588,10 @@ class CachedArtifacts implements Artifacts {
|
||||
// For script snapshots any gen_snapshot binary will do. Returning gen_snapshot for
|
||||
// android_arm in profile mode because it is available on all supported host platforms.
|
||||
return _getAndroidArtifactPath(artifact, TargetPlatform.android_arm, BuildMode.profile);
|
||||
- case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
- return _fileSystem.path.join(
|
||||
- _dartSdkPath(_cache), 'bin', 'snapshots',
|
||||
- _artifactToFileName(artifact),
|
||||
- );
|
||||
case Artifact.flutterTester:
|
||||
case Artifact.vmSnapshotData:
|
||||
case Artifact.isolateSnapshotData:
|
||||
+ case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
case Artifact.icuData:
|
||||
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
||||
final String platformDirName = _enginePlatformDirectoryName(platform);
|
||||
@@ -776,7 +774,7 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
||||
return _fileSystem.file(path);
|
||||
case HostArtifact.dartdevcSnapshot:
|
||||
- final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
||||
+ final String path = _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
||||
return _fileSystem.file(path);
|
||||
case HostArtifact.kernelWorkerSnapshot:
|
||||
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
||||
@@ -901,9 +899,7 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||
case Artifact.windowsCppClientWrapper:
|
||||
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||
- return _fileSystem.path.join(
|
||||
- _hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', artifactFileName,
|
||||
- );
|
||||
+ return _fileSystem.path.join(_hostEngineOutPath, 'gen', artifactFileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,8 +1007,8 @@ class OverrideArtifacts implements Artifacts {
|
||||
}
|
||||
|
||||
/// Locate the Dart SDK.
|
||||
-String _dartSdkPath(Cache cache) {
|
||||
- return cache.getRoot().childDirectory('dart-sdk').path;
|
||||
+String _dartSdkPath(FileSystem fileSystem) {
|
||||
+ return fileSystem.path.join(Cache.flutterRoot!, 'bin', 'cache', 'dart-sdk');
|
||||
}
|
||||
|
||||
class _TestArtifacts implements Artifacts {
|
||||
diff --git a/packages/flutter_tools/test/general.shard/artifacts_test.dart b/packages/flutter_tools/test/general.shard/artifacts_test.dart
|
||||
index aed3eb9285..81b8362648 100644
|
||||
--- a/packages/flutter_tools/test/general.shard/artifacts_test.dart
|
||||
+++ b/packages/flutter_tools/test/general.shard/artifacts_test.dart
|
||||
@@ -141,10 +141,6 @@ void main() {
|
||||
artifacts.getArtifactPath(Artifact.flutterTester, platform: TargetPlatform.linux_arm64),
|
||||
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'linux-arm64', 'flutter_tester'),
|
||||
);
|
||||
- expect(
|
||||
- artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
- fileSystem.path.join('root', 'bin', 'cache', 'dart-sdk', 'bin', 'snapshots', 'frontend_server.dart.snapshot')
|
||||
- );
|
||||
});
|
||||
|
||||
testWithoutContext('precompiled web artifact paths are correct', () {
|
||||
@@ -310,11 +306,6 @@ void main() {
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk'),
|
||||
);
|
||||
- expect(
|
||||
- artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
- fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin',
|
||||
- 'snapshots', 'frontend_server.dart.snapshot')
|
||||
- );
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.impellerc).path,
|
||||
fileSystem.path.join('/out', 'host_debug_unopt', 'impellerc'),
|
||||
|
Loading…
Reference in New Issue
Block a user