Skip to content

Commit

Permalink
Place flutter_gpu in the package cache. (#149299)
Browse files Browse the repository at this point in the history
Resolves flutter/flutter#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 flutter/engine#53107 has been merged/rolled into the framework.
  • Loading branch information
bdero authored Jun 3, 2024
1 parent 8c4295b commit 02bc11c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter_tools/lib/src/flutter_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
38 changes: 38 additions & 0 deletions packages/flutter_tools/test/general.shard/cache_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 02bc11c

Please sign in to comment.