Skip to content

Commit 02bc11c

Browse files
authored
Place flutter_gpu in the package cache. (#149299)
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.
1 parent 8c4295b commit 02bc11c

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

packages/flutter_tools/lib/src/flutter_cache.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class FlutterSdk extends EngineCachedArtifact {
231231
final Platform _platform;
232232

233233
@override
234-
List<String> getPackageDirs() => const <String>['sky_engine'];
234+
List<String> getPackageDirs() => const <String>['sky_engine', 'flutter_gpu'];
235235

236236
@override
237237
List<List<String>> getBinaryDirs() {

packages/flutter_tools/test/general.shard/cache_test.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,44 @@ void main() {
393393
expect(operatingSystemUtils.chmods, <List<String>>[<String>['/.tmp_rand0/flutter_cache_test_artifact.rand0/bin_dir', 'a+r,a+x']]);
394394
});
395395

396+
testWithoutContext('EngineCachedArtifact downloads package zip from expected URL', () async {
397+
final FakeOperatingSystemUtils operatingSystemUtils = FakeOperatingSystemUtils();
398+
final FileSystem fileSystem = MemoryFileSystem.test();
399+
final Directory artifactDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_artifact.');
400+
final Directory downloadDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_download.');
401+
final FakeSecondaryCache cache = FakeSecondaryCache()
402+
..artifactDirectory = artifactDir
403+
..downloadDir = downloadDir;
404+
artifactDir.childDirectory('pkg').createSync();
405+
406+
final FakeCachedArtifact artifact = FakeCachedArtifact(
407+
cache: cache,
408+
binaryDirs: <List<String>>[],
409+
packageDirs: <String>[
410+
'package_dir',
411+
],
412+
requiredArtifacts: DevelopmentArtifact.universal,
413+
);
414+
415+
Uri? packageUrl;
416+
final ArtifactUpdater artifactUpdater = FakeArtifactUpdater()
417+
..onDownloadZipArchive = (String message, Uri url, Directory location) {
418+
location.childDirectory('package_dir').createSync();
419+
packageUrl = url;
420+
};
421+
422+
await artifact.updateInner(artifactUpdater, fileSystem, operatingSystemUtils);
423+
expect(packageUrl, isNotNull);
424+
expect(packageUrl.toString(), 'https://storage.googleapis.com/flutter_infra_release/flutter/null/package_dir.zip');
425+
426+
final Directory dir = fileSystem.systemTempDirectory
427+
.listSync(recursive: true)
428+
.whereType<Directory>()
429+
.singleWhereOrNull((Directory directory) => directory.basename == 'pkg')!;
430+
expect(dir.path, artifactDir.childDirectory('pkg').path);
431+
expect(dir.childDirectory('package_dir').existsSync(), isTrue);
432+
});
433+
396434
testWithoutContext('Try to remove without a parent', () async {
397435
final FileSystem fileSystem = MemoryFileSystem.test();
398436
final Directory parent = fileSystem.directory('dir');

0 commit comments

Comments
 (0)