Place flutter_gpu in the package cache. (#149299)

Resolves https://github.com/flutter/flutter/issues/131711.

Fetch https://storage.googleapis.com/flutter_infra_release/flutter/${engine_version}/flutter_gpu.zip and extract it into the package cache.

Cannot function until https://github.com/flutter/engine/pull/53107 has been merged/rolled into the framework.
This commit is contained in:
Brandon DeRosier 2024-06-03 15:46:02 -07:00 committed by GitHub
parent 8c4295b116
commit 02bc11c9be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 1 deletions

View File

@ -231,7 +231,7 @@ class FlutterSdk extends EngineCachedArtifact {
final Platform _platform;
@override
List<String> getPackageDirs() => const <String>['sky_engine'];
List<String> getPackageDirs() => const <String>['sky_engine', 'flutter_gpu'];
@override
List<List<String>> getBinaryDirs() {

View File

@ -393,6 +393,44 @@ void main() {
expect(operatingSystemUtils.chmods, <List<String>>[<String>['/.tmp_rand0/flutter_cache_test_artifact.rand0/bin_dir', 'a+r,a+x']]);
});
testWithoutContext('EngineCachedArtifact downloads package zip from expected URL', () async {
final FakeOperatingSystemUtils operatingSystemUtils = FakeOperatingSystemUtils();
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory artifactDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_artifact.');
final Directory downloadDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_download.');
final FakeSecondaryCache cache = FakeSecondaryCache()
..artifactDirectory = artifactDir
..downloadDir = downloadDir;
artifactDir.childDirectory('pkg').createSync();
final FakeCachedArtifact artifact = FakeCachedArtifact(
cache: cache,
binaryDirs: <List<String>>[],
packageDirs: <String>[
'package_dir',
],
requiredArtifacts: DevelopmentArtifact.universal,
);
Uri? packageUrl;
final ArtifactUpdater artifactUpdater = FakeArtifactUpdater()
..onDownloadZipArchive = (String message, Uri url, Directory location) {
location.childDirectory('package_dir').createSync();
packageUrl = url;
};
await artifact.updateInner(artifactUpdater, fileSystem, operatingSystemUtils);
expect(packageUrl, isNotNull);
expect(packageUrl.toString(), 'https://storage.googleapis.com/flutter_infra_release/flutter/null/package_dir.zip');
final Directory dir = fileSystem.systemTempDirectory
.listSync(recursive: true)
.whereType<Directory>()
.singleWhereOrNull((Directory directory) => directory.basename == 'pkg')!;
expect(dir.path, artifactDir.childDirectory('pkg').path);
expect(dir.childDirectory('package_dir').existsSync(), isTrue);
});
testWithoutContext('Try to remove without a parent', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory parent = fileSystem.directory('dir');