Unverified Commit c9a5f943 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Include flutter_runner in precache artifacts. (#36318)

parent 9f083162
...@@ -50,6 +50,9 @@ class DevelopmentArtifact { ...@@ -50,6 +50,9 @@ class DevelopmentArtifact {
/// Artifacts required for Fuchsia. /// Artifacts required for Fuchsia.
static const DevelopmentArtifact fuchsia = DevelopmentArtifact._('fuchsia', unstable: true); static const DevelopmentArtifact fuchsia = DevelopmentArtifact._('fuchsia', unstable: true);
/// Artifacts required for the Flutter Runner.
static const DevelopmentArtifact flutterRunner = DevelopmentArtifact._('flutter_runner', unstable: true);
/// Artifacts required for any development platform. /// Artifacts required for any development platform.
static const DevelopmentArtifact universal = DevelopmentArtifact._('universal'); static const DevelopmentArtifact universal = DevelopmentArtifact._('universal');
...@@ -63,6 +66,7 @@ class DevelopmentArtifact { ...@@ -63,6 +66,7 @@ class DevelopmentArtifact {
linux, linux,
fuchsia, fuchsia,
universal, universal,
flutterRunner,
]; ];
} }
...@@ -83,6 +87,7 @@ class Cache { ...@@ -83,6 +87,7 @@ class Cache {
_artifacts.add(LinuxEngineArtifacts(this)); _artifacts.add(LinuxEngineArtifacts(this));
_artifacts.add(LinuxFuchsiaSDKArtifacts(this)); _artifacts.add(LinuxFuchsiaSDKArtifacts(this));
_artifacts.add(MacOSFuchsiaSDKArtifacts(this)); _artifacts.add(MacOSFuchsiaSDKArtifacts(this));
_artifacts.add(FlutterRunnerSDKArtifacts(this));
for (String artifactName in IosUsbArtifacts.artifactNames) { for (String artifactName in IosUsbArtifacts.artifactNames) {
_artifacts.add(IosUsbArtifacts(artifactName, this)); _artifacts.add(IosUsbArtifacts(artifactName, this));
} }
...@@ -870,6 +875,9 @@ class GradleWrapper extends CachedArtifact { ...@@ -870,6 +875,9 @@ class GradleWrapper extends CachedArtifact {
} }
} }
const String _cipdBaseUrl =
'https://chrome-infra-packages.appspot.com/dl';
/// Common functionality for pulling Fuchsia SDKs. /// Common functionality for pulling Fuchsia SDKs.
abstract class _FuchsiaSDKArtifacts extends CachedArtifact { abstract class _FuchsiaSDKArtifacts extends CachedArtifact {
_FuchsiaSDKArtifacts(Cache cache, String platform) _FuchsiaSDKArtifacts(Cache cache, String platform)
...@@ -878,9 +886,6 @@ abstract class _FuchsiaSDKArtifacts extends CachedArtifact { ...@@ -878,9 +886,6 @@ abstract class _FuchsiaSDKArtifacts extends CachedArtifact {
DevelopmentArtifact.fuchsia, DevelopmentArtifact.fuchsia,
}); });
static const String _cipdBaseUrl =
'https://chrome-infra-packages.appspot.com/dl';
final String _path; final String _path;
@override @override
...@@ -893,6 +898,30 @@ abstract class _FuchsiaSDKArtifacts extends CachedArtifact { ...@@ -893,6 +898,30 @@ abstract class _FuchsiaSDKArtifacts extends CachedArtifact {
} }
} }
/// The pre-built flutter runner for Fuchsia development.
class FlutterRunnerSDKArtifacts extends CachedArtifact {
FlutterRunnerSDKArtifacts(Cache cache)
: super('flutter_runner', cache, const <DevelopmentArtifact>{
DevelopmentArtifact.flutterRunner,
});
@override
Directory get location => cache.getArtifactDirectory('flutter_runner');
@override
String get version => cache.getVersionFor('engine');
@override
Future<void> updateInner() async {
if (!platform.isLinux && !platform.isMacOS) {
return Future<void>.value();
}
final String url = '$_cipdBaseUrl/flutter/fuchsia/+/git_revision:$version';
await _downloadZipArchive('Downloading package flutter runner...',
Uri.parse(url), location);
}
}
/// The Fuchsia core SDK for Linux. /// The Fuchsia core SDK for Linux.
class LinuxFuchsiaSDKArtifacts extends _FuchsiaSDKArtifacts { class LinuxFuchsiaSDKArtifacts extends _FuchsiaSDKArtifacts {
LinuxFuchsiaSDKArtifacts(Cache cache) : super(cache, 'linux'); LinuxFuchsiaSDKArtifacts(Cache cache) : super(cache, 'linux');
......
...@@ -31,6 +31,8 @@ class PrecacheCommand extends FlutterCommand { ...@@ -31,6 +31,8 @@ class PrecacheCommand extends FlutterCommand {
help: 'Precache artifacts for Fuchsia development.'); help: 'Precache artifacts for Fuchsia development.');
argParser.addFlag('universal', negatable: true, defaultsTo: true, argParser.addFlag('universal', negatable: true, defaultsTo: true,
help: 'Precache artifacts required for any development platform.'); help: 'Precache artifacts required for any development platform.');
argParser.addFlag('flutter_runner', negatable: true, defaultsTo: false,
help: 'Precache the flutter runner artifacts.', hide: true);
} }
@override @override
......
...@@ -169,6 +169,15 @@ void main() { ...@@ -169,6 +169,15 @@ void main() {
FileSystem: () => MockFileSystem(), FileSystem: () => MockFileSystem(),
}); });
test('Unstable artifacts', () {
expect(DevelopmentArtifact.web.unstable, true);
expect(DevelopmentArtifact.linux.unstable, true);
expect(DevelopmentArtifact.macOS.unstable, true);
expect(DevelopmentArtifact.windows.unstable, true);
expect(DevelopmentArtifact.fuchsia.unstable, true);
expect(DevelopmentArtifact.flutterRunner.unstable, true);
});
group('EngineCachedArtifact', () { group('EngineCachedArtifact', () {
FakeHttpClient fakeHttpClient; FakeHttpClient fakeHttpClient;
FakePlatform fakePlatform; FakePlatform fakePlatform;
......
...@@ -27,7 +27,7 @@ void main() { ...@@ -27,7 +27,7 @@ void main() {
final PrecacheCommand command = PrecacheCommand(); final PrecacheCommand command = PrecacheCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
await createTestCommandRunner(command).run( await createTestCommandRunner(command).run(
const <String>['precache', '--ios', '--android', '--web', '--macos', '--linux', '--windows', '--fuchsia'] const <String>['precache', '--ios', '--android', '--web', '--macos', '--linux', '--windows', '--fuchsia', '--flutter_runner']
); );
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{ expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
...@@ -38,6 +38,7 @@ void main() { ...@@ -38,6 +38,7 @@ void main() {
DevelopmentArtifact.linux, DevelopmentArtifact.linux,
DevelopmentArtifact.windows, DevelopmentArtifact.windows,
DevelopmentArtifact.fuchsia, DevelopmentArtifact.fuchsia,
DevelopmentArtifact.flutterRunner,
})); }));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => cache, Cache: () => cache,
...@@ -52,7 +53,7 @@ void main() { ...@@ -52,7 +53,7 @@ void main() {
final PrecacheCommand command = PrecacheCommand(); final PrecacheCommand command = PrecacheCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
await createTestCommandRunner(command).run( await createTestCommandRunner(command).run(
const <String>['precache', '--ios', '--android', '--web', '--macos', '--linux', '--windows', '--fuchsia'] const <String>['precache', '--ios', '--android', '--web', '--macos', '--linux', '--windows', '--fuchsia', '--flutter_runner']
); );
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{ expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment