Use feature flags for desktop cache (#53608)
This commit is contained in:
parent
aee9e94c21
commit
a2d62df3ee
@ -47,13 +47,13 @@ class DevelopmentArtifact {
|
|||||||
static const DevelopmentArtifact web = DevelopmentArtifact._('web', feature: flutterWebFeature);
|
static const DevelopmentArtifact web = DevelopmentArtifact._('web', feature: flutterWebFeature);
|
||||||
|
|
||||||
/// Artifacts required for desktop macOS.
|
/// Artifacts required for desktop macOS.
|
||||||
static const DevelopmentArtifact macOS = DevelopmentArtifact._('macos', unstable: true);
|
static const DevelopmentArtifact macOS = DevelopmentArtifact._('macos', feature: flutterMacOSDesktopFeature);
|
||||||
|
|
||||||
/// Artifacts required for desktop Windows.
|
/// Artifacts required for desktop Windows.
|
||||||
static const DevelopmentArtifact windows = DevelopmentArtifact._('windows', unstable: true);
|
static const DevelopmentArtifact windows = DevelopmentArtifact._('windows', feature: flutterWindowsDesktopFeature);
|
||||||
|
|
||||||
/// Artifacts required for desktop Linux.
|
/// Artifacts required for desktop Linux.
|
||||||
static const DevelopmentArtifact linux = DevelopmentArtifact._('linux', unstable: true);
|
static const DevelopmentArtifact linux = DevelopmentArtifact._('linux', feature: flutterLinuxDesktopFeature);
|
||||||
|
|
||||||
/// Artifacts required for Fuchsia.
|
/// Artifacts required for Fuchsia.
|
||||||
static const DevelopmentArtifact fuchsia = DevelopmentArtifact._('fuchsia', unstable: true);
|
static const DevelopmentArtifact fuchsia = DevelopmentArtifact._('fuchsia', unstable: true);
|
||||||
|
@ -63,6 +63,87 @@ void main() {
|
|||||||
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
|
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('precache downloads macOS artifacts on dev branch when macOS is enabled.', () async {
|
||||||
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
await createTestCommandRunner(command).run(const <String>['precache', '--macos', '--no-android', '--no-ios']);
|
||||||
|
|
||||||
|
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
|
||||||
|
DevelopmentArtifact.universal,
|
||||||
|
DevelopmentArtifact.macOS,
|
||||||
|
}));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Cache: () => cache,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('precache does not download macOS artifacts on dev branch when feature is enabled.', () async {
|
||||||
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
await createTestCommandRunner(command).run(const <String>['precache', '--macos', '--no-android', '--no-ios']);
|
||||||
|
|
||||||
|
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
|
||||||
|
DevelopmentArtifact.universal,
|
||||||
|
}));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Cache: () => cache,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('precache downloads Windows artifacts on dev branch when feature is enabled.', () async {
|
||||||
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
await createTestCommandRunner(command).run(const <String>['precache', '--windows', '--no-android', '--no-ios']);
|
||||||
|
|
||||||
|
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
|
||||||
|
DevelopmentArtifact.universal,
|
||||||
|
DevelopmentArtifact.windows,
|
||||||
|
}));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Cache: () => cache,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('precache does not download Windows artifacts on dev branch when feature is enabled.', () async {
|
||||||
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
await createTestCommandRunner(command).run(const <String>['precache', '--windows', '--no-android', '--no-ios']);
|
||||||
|
|
||||||
|
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
|
||||||
|
DevelopmentArtifact.universal,
|
||||||
|
}));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Cache: () => cache,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('precache downloads Linux artifacts on dev branch when feature is enabled.', () async {
|
||||||
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
await createTestCommandRunner(command).run(const <String>['precache', '--linux', '--no-android', '--no-ios']);
|
||||||
|
|
||||||
|
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
|
||||||
|
DevelopmentArtifact.universal,
|
||||||
|
DevelopmentArtifact.linux,
|
||||||
|
}));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Cache: () => cache,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('precache does not download Linux artifacts on dev branch when feature is enabled.', () async {
|
||||||
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
|
applyMocksToCommand(command);
|
||||||
|
await createTestCommandRunner(command).run(const <String>['precache', '--linux', '--no-android', '--no-ios']);
|
||||||
|
|
||||||
|
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
|
||||||
|
DevelopmentArtifact.universal,
|
||||||
|
}));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Cache: () => cache,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('precache exits if requesting mismatched artifacts.', () async {
|
testUsingContext('precache exits if requesting mismatched artifacts.', () async {
|
||||||
final PrecacheCommand command = PrecacheCommand();
|
final PrecacheCommand command = PrecacheCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
@ -107,7 +188,12 @@ void main() {
|
|||||||
}));
|
}));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Cache: () => cache,
|
Cache: () => cache,
|
||||||
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(
|
||||||
|
isWebEnabled: true,
|
||||||
|
isLinuxEnabled: true,
|
||||||
|
isMacOSEnabled: true,
|
||||||
|
isWindowsEnabled: true,
|
||||||
|
),
|
||||||
FlutterVersion: () => masterFlutterVersion,
|
FlutterVersion: () => masterFlutterVersion,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -264,9 +264,9 @@ void main() {
|
|||||||
|
|
||||||
test('Unstable artifacts', () {
|
test('Unstable artifacts', () {
|
||||||
expect(DevelopmentArtifact.web.unstable, false);
|
expect(DevelopmentArtifact.web.unstable, false);
|
||||||
expect(DevelopmentArtifact.linux.unstable, true);
|
expect(DevelopmentArtifact.linux.unstable, false);
|
||||||
expect(DevelopmentArtifact.macOS.unstable, true);
|
expect(DevelopmentArtifact.macOS.unstable, false);
|
||||||
expect(DevelopmentArtifact.windows.unstable, true);
|
expect(DevelopmentArtifact.windows.unstable, false);
|
||||||
expect(DevelopmentArtifact.fuchsia.unstable, true);
|
expect(DevelopmentArtifact.fuchsia.unstable, true);
|
||||||
expect(DevelopmentArtifact.flutterRunner.unstable, true);
|
expect(DevelopmentArtifact.flutterRunner.unstable, true);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user