Unverified Commit d230234d authored by Emmanuel Garcia's avatar Emmanuel Garcia Committed by GitHub

Revert Maven dependencies (#39747) (39157) (#39784)

parent 6f4359d1
...@@ -52,6 +52,7 @@ Future<void> main() async { ...@@ -52,6 +52,7 @@ Future<void> main() async {
'assets/flutter_assets/isolate_snapshot_data', 'assets/flutter_assets/isolate_snapshot_data',
'assets/flutter_assets/kernel_blob.bin', 'assets/flutter_assets/kernel_blob.bin',
'assets/flutter_assets/vm_snapshot_data', 'assets/flutter_assets/vm_snapshot_data',
'lib/armeabi-v7a/libflutter.so',
// Debug mode intentionally includes `x86` and `x86_64`. // Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so', 'lib/x86/libflutter.so',
'lib/x86_64/libflutter.so', 'lib/x86_64/libflutter.so',
...@@ -78,6 +79,7 @@ Future<void> main() async { ...@@ -78,6 +79,7 @@ Future<void> main() async {
'assets/flutter_assets/isolate_snapshot_data', 'assets/flutter_assets/isolate_snapshot_data',
'assets/flutter_assets/kernel_blob.bin', 'assets/flutter_assets/kernel_blob.bin',
'assets/flutter_assets/vm_snapshot_data', 'assets/flutter_assets/vm_snapshot_data',
'lib/armeabi-v7a/libflutter.so',
// Debug mode intentionally includes `x86` and `x86_64`. // Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so', 'lib/x86/libflutter.so',
'lib/x86_64/libflutter.so', 'lib/x86_64/libflutter.so',
......
...@@ -57,6 +57,6 @@ dependencies { ...@@ -57,6 +57,6 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:design:26.1.0'
} }
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
//
// This script is used to warm the Gradle cache by downloading the Flutter dependencies
// used during the build. This script is invoked when `flutter precache` is run.
//
// Command:
// gradle -b <flutter-sdk>packages/flutter_tools/gradle/resolve_dependencies.gradle
// resolveDependencies
//
// This way, Gradle can run with the `--offline` flag later on to eliminate any
// network request during the build process.
//
// This includes:
// 1. The embedding
// 2. libflutter.so
import java.nio.file.Paths
repositories {
google()
jcenter()
maven {
url "http://download.flutter.io"
}
}
File flutterRoot = projectDir.parentFile.parentFile.parentFile
assert flutterRoot.isDirectory()
String engineVersion = Paths.get(flutterRoot.absolutePath, "bin", "internal", "engine.version")
.toFile().text.trim()
configurations {
flutterRelease.extendsFrom releaseImplementation
flutterDebug.extendsFrom debugImplementation
flutterProfile.extendsFrom debugImplementation
}
dependencies {
flutterRelease "io.flutter:flutter_embedding_release:1.0.0-$engineVersion"
flutterRelease "io.flutter:armeabi_v7a_release:1.0.0-$engineVersion"
flutterRelease "io.flutter:arm64_v8a_release:1.0.0-$engineVersion"
flutterProfile "io.flutter:flutter_embedding_profile:1.0.0-$engineVersion"
flutterProfile "io.flutter:armeabi_v7a_profile:1.0.0-$engineVersion"
flutterProfile "io.flutter:arm64_v8a_profile:1.0.0-$engineVersion"
flutterDebug "io.flutter:flutter_embedding_debug:1.0.0-$engineVersion"
flutterDebug "io.flutter:armeabi_v7a_debug:1.0.0-$engineVersion"
flutterDebug "io.flutter:arm64_v8a_debug:1.0.0-$engineVersion"
flutterDebug "io.flutter:x86_debug:1.0.0-$engineVersion"
flutterDebug "io.flutter:x86_64_debug:1.0.0-$engineVersion"
}
task resolveDependencies {
configurations.each { configuration ->
if (configuration.name.startsWith("flutter")) {
configuration.resolve()
}
}
}
...@@ -84,7 +84,7 @@ Future<void> main(List<String> args) async { ...@@ -84,7 +84,7 @@ Future<void> main(List<String> args) async {
LogsCommand(), LogsCommand(),
MakeHostAppEditableCommand(), MakeHostAppEditableCommand(),
PackagesCommand(), PackagesCommand(),
PrecacheCommand(verboseHelp: verboseHelp), PrecacheCommand(),
RunCommand(verboseHelp: verboseHelp), RunCommand(verboseHelp: verboseHelp),
ScreenshotCommand(), ScreenshotCommand(),
ShellCompletionCommand(), ShellCompletionCommand(),
......
This diff is collapsed.
...@@ -9,7 +9,7 @@ import '../base/os.dart'; ...@@ -9,7 +9,7 @@ import '../base/os.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../project.dart'; import '../project.dart';
import '../reporting/reporting.dart'; import '../reporting/reporting.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult; import '../runner/flutter_command.dart' show DevelopmentArtifact, FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildAarCommand extends BuildSubCommand { class BuildAarCommand extends BuildSubCommand {
...@@ -52,6 +52,12 @@ class BuildAarCommand extends BuildSubCommand { ...@@ -52,6 +52,12 @@ class BuildAarCommand extends BuildSubCommand {
return usage; return usage;
} }
@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => const <DevelopmentArtifact>{
DevelopmentArtifact.universal,
DevelopmentArtifact.android,
};
@override @override
final String description = 'Build a repository containing an AAR and a POM file.\n\n' final String description = 'Build a repository containing an AAR and a POM file.\n\n'
'The POM file is used to include the dependencies that the AAR was compiled against.\n\n' 'The POM file is used to include the dependencies that the AAR was compiled against.\n\n'
......
...@@ -10,7 +10,7 @@ import '../build_info.dart'; ...@@ -10,7 +10,7 @@ import '../build_info.dart';
import '../globals.dart'; import '../globals.dart';
import '../project.dart'; import '../project.dart';
import '../reporting/reporting.dart'; import '../reporting/reporting.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult; import '../runner/flutter_command.dart' show DevelopmentArtifact, FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildApkCommand extends BuildSubCommand { class BuildApkCommand extends BuildSubCommand {
...@@ -68,6 +68,12 @@ class BuildApkCommand extends BuildSubCommand { ...@@ -68,6 +68,12 @@ class BuildApkCommand extends BuildSubCommand {
return usage; return usage;
} }
@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => const <DevelopmentArtifact>{
DevelopmentArtifact.universal,
DevelopmentArtifact.android,
};
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final BuildInfo buildInfo = getBuildInfo(); final BuildInfo buildInfo = getBuildInfo();
......
...@@ -37,7 +37,7 @@ class DoctorCommand extends FlutterCommand { ...@@ -37,7 +37,7 @@ class DoctorCommand extends FlutterCommand {
// This is required because we use gen_snapshot to check if the host // This is required because we use gen_snapshot to check if the host
// machine can execute the provided artifacts. See `_genSnapshotRuns` // machine can execute the provided artifacts. See `_genSnapshotRuns`
// in `doctor.dart`. // in `doctor.dart`.
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.android,
}; };
} }
......
...@@ -10,23 +10,13 @@ import '../runner/flutter_command.dart'; ...@@ -10,23 +10,13 @@ import '../runner/flutter_command.dart';
import '../version.dart'; import '../version.dart';
class PrecacheCommand extends FlutterCommand { class PrecacheCommand extends FlutterCommand {
PrecacheCommand({bool verboseHelp = false}) { PrecacheCommand() {
argParser.addFlag('all-platforms', abbr: 'a', negatable: false, argParser.addFlag('all-platforms', abbr: 'a', negatable: false,
help: 'Precache artifacts for all host platforms.'); help: 'Precache artifacts for all host platforms.');
argParser.addFlag('force', abbr: 'f', negatable: false, argParser.addFlag('force', abbr: 'f', negatable: false,
help: 'Force downloading of artifacts.'); help: 'Force downloading of artifacts.');
argParser.addFlag('android', negatable: true, defaultsTo: true, argParser.addFlag('android', negatable: true, defaultsTo: true,
help: 'Precache artifacts for Android development.', help: 'Precache artifacts for Android development.');
hide: verboseHelp);
argParser.addFlag('android_gen_snapshot', negatable: true, defaultsTo: true,
help: 'Precache gen_snapshot for Android development.',
hide: !verboseHelp);
argParser.addFlag('android_maven', negatable: true, defaultsTo: true,
help: 'Precache Gradle dependencies for Android development.',
hide: !verboseHelp);
argParser.addFlag('android_internal_build', negatable: true, defaultsTo: false,
help: 'Precache dependencies for internal Android development.',
hide: !verboseHelp);
argParser.addFlag('ios', negatable: true, defaultsTo: true, argParser.addFlag('ios', negatable: true, defaultsTo: true,
help: 'Precache artifacts for iOS development.'); help: 'Precache artifacts for iOS development.');
argParser.addFlag('web', negatable: true, defaultsTo: false, argParser.addFlag('web', negatable: true, defaultsTo: false,
...@@ -68,10 +58,6 @@ class PrecacheCommand extends FlutterCommand { ...@@ -68,10 +58,6 @@ class PrecacheCommand extends FlutterCommand {
if (argResults[artifact.name]) { if (argResults[artifact.name]) {
requiredArtifacts.add(artifact); requiredArtifacts.add(artifact);
} }
// The `android` flag expands to android_gen_snapshot, android_maven, android_internal_build.
if (artifact.name.startsWith('android_') && argResults['android']) {
requiredArtifacts.add(artifact);
}
} }
final bool forceUpdate = argResults['force']; final bool forceUpdate = argResults['force'];
if (forceUpdate || !cache.isUpToDate()) { if (forceUpdate || !cache.isUpToDate()) {
......
...@@ -644,7 +644,7 @@ DevelopmentArtifact _artifactFromTargetPlatform(TargetPlatform targetPlatform) { ...@@ -644,7 +644,7 @@ DevelopmentArtifact _artifactFromTargetPlatform(TargetPlatform targetPlatform) {
case TargetPlatform.android_arm64: case TargetPlatform.android_arm64:
case TargetPlatform.android_x64: case TargetPlatform.android_x64:
case TargetPlatform.android_x86: case TargetPlatform.android_x86:
return DevelopmentArtifact.androidGenSnapshot; return DevelopmentArtifact.android;
case TargetPlatform.web_javascript: case TargetPlatform.web_javascript:
return DevelopmentArtifact.web; return DevelopmentArtifact.web;
case TargetPlatform.ios: case TargetPlatform.ios:
......
...@@ -47,9 +47,9 @@ dependencies { ...@@ -47,9 +47,9 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
{{/androidX}} {{/androidX}}
{{^androidX}} {{^androidX}}
implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:design:27.1.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
{{/androidX}} {{/androidX}}
......
...@@ -8,10 +8,8 @@ import 'package:file_testing/file_testing.dart'; ...@@ -8,10 +8,8 @@ import 'package:file_testing/file_testing.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:platform/platform.dart'; import 'package:platform/platform.dart';
import 'package:process/process.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart' show InternetAddress, SocketException; import 'package:flutter_tools/src/base/io.dart' show InternetAddress, SocketException;
...@@ -138,30 +136,18 @@ void main() { ...@@ -138,30 +136,18 @@ void main() {
when(artifact1.isUpToDate()).thenReturn(true); when(artifact1.isUpToDate()).thenReturn(true);
when(artifact2.isUpToDate()).thenReturn(false); when(artifact2.isUpToDate()).thenReturn(false);
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
await cache.updateAll(<DevelopmentArtifact>{ await cache.updateAll(<DevelopmentArtifact>{});
null, verifyNever(artifact1.update(<DevelopmentArtifact>{}));
}); verify(artifact2.update(<DevelopmentArtifact>{}));
verifyNever(artifact1.update());
verify(artifact2.update());
}); });
testUsingContext('getter dyLdLibEntry concatenates the output of each artifact\'s dyLdLibEntry getter', () async { testUsingContext('getter dyLdLibEntry concatenates the output of each artifact\'s dyLdLibEntry getter', () async {
final IosUsbArtifacts artifact1 = MockIosUsbArtifacts(); final CachedArtifact artifact1 = MockCachedArtifact();
final IosUsbArtifacts artifact2 = MockIosUsbArtifacts(); final CachedArtifact artifact2 = MockCachedArtifact();
final IosUsbArtifacts artifact3 = MockIosUsbArtifacts(); final CachedArtifact artifact3 = MockCachedArtifact();
when(artifact1.environment) when(artifact1.dyLdLibPath).thenReturn('/path/to/alpha:/path/to/beta');
.thenReturn(<String, String>{ when(artifact2.dyLdLibPath).thenReturn('/path/to/gamma:/path/to/delta:/path/to/epsilon');
'DYLD_LIBRARY_PATH': '/path/to/alpha:/path/to/beta', when(artifact3.dyLdLibPath).thenReturn(''); // Empty output
});
when(artifact2.environment)
.thenReturn(<String, String>{
'DYLD_LIBRARY_PATH': '/path/to/gamma:/path/to/delta:/path/to/epsilon',
});
when(artifact3.environment)
.thenReturn(<String, String>{
'DYLD_LIBRARY_PATH': '',
});
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2, artifact3]); final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2, artifact3]);
expect(cache.dyLdLibEntry.key, 'DYLD_LIBRARY_PATH'); expect(cache.dyLdLibEntry.key, 'DYLD_LIBRARY_PATH');
expect( expect(
cache.dyLdLibEntry.value, cache.dyLdLibEntry.value,
...@@ -177,20 +163,18 @@ void main() { ...@@ -177,20 +163,18 @@ void main() {
when(artifact2.isUpToDate()).thenReturn(false); when(artifact2.isUpToDate()).thenReturn(false);
final MockInternetAddress address = MockInternetAddress(); final MockInternetAddress address = MockInternetAddress();
when(address.host).thenReturn('storage.googleapis.com'); when(address.host).thenReturn('storage.googleapis.com');
when(artifact1.update()).thenThrow(SocketException( when(artifact1.update(<DevelopmentArtifact>{})).thenThrow(SocketException(
'Connection reset by peer', 'Connection reset by peer',
address: address, address: address,
)); ));
final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]);
try { try {
await cache.updateAll(<DevelopmentArtifact>{ await cache.updateAll(<DevelopmentArtifact>{});
null,
});
fail('Mock thrown exception expected'); fail('Mock thrown exception expected');
} catch (e) { } catch (e) {
verify(artifact1.update()); verify(artifact1.update(<DevelopmentArtifact>{}));
// Don't continue when retrieval fails. // Don't continue when retrieval fails.
verifyNever(artifact2.update()); verifyNever(artifact2.update(<DevelopmentArtifact>{}));
expect( expect(
testLogger.errorText, testLogger.errorText,
contains('https://flutter.dev/community/china'), contains('https://flutter.dev/community/china'),
...@@ -242,7 +226,6 @@ void main() { ...@@ -242,7 +226,6 @@ void main() {
binaryDirs: <List<String>>[ binaryDirs: <List<String>>[
<String>['bin_dir', 'unused_url_path'], <String>['bin_dir', 'unused_url_path'],
], ],
requiredArtifacts: DevelopmentArtifact.universal,
); );
await artifact.updateInner(); await artifact.updateInner();
final Directory dir = memoryFileSystem.systemTempDirectory final Directory dir = memoryFileSystem.systemTempDirectory
...@@ -261,56 +244,25 @@ void main() { ...@@ -261,56 +244,25 @@ void main() {
}); });
}); });
group('AndroidMavenArtifacts', () { testUsingContext('throws tool exit on fs exception', () async {
MemoryFileSystem memoryFileSystem; final FakeCachedArtifact fakeCachedArtifact = FakeCachedArtifact(
MockProcessManager processManager; cache: MockCache(),
MockCache mockCache; requiredArtifacts: <DevelopmentArtifact>{
MockProcess mockProcess; DevelopmentArtifact.android,
}
setUp(() { );
memoryFileSystem = MemoryFileSystem(); final Directory mockDirectory = MockDirectory();
processManager = MockProcessManager(); when(fakeCachedArtifact.cache.getArtifactDirectory(any))
mockCache = MockCache(); .thenReturn(mockDirectory);
mockProcess = MockProcess(); when(mockDirectory.existsSync()).thenReturn(false);
}); when(mockDirectory.createSync(recursive: true))
.thenThrow(const FileSystemException());
test('development artifact', () async {
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(); expect(() => fakeCachedArtifact.update(<DevelopmentArtifact>{
expect(mavenArtifacts.developmentArtifact, DevelopmentArtifact.androidMaven); DevelopmentArtifact.android,
}); }), throwsA(isInstanceOf<ToolExit>()));
}, overrides: <Type, Generator>{
testUsingContext('update', () async { FileSystem: () => MemoryFileSystem(),
final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts();
expect(mavenArtifacts.isUpToDate(), isFalse);
final Directory gradleWrapperDir = fs.systemTempDirectory.createTempSync('gradle_wrapper.');
when(mockCache.getArtifactDirectory('gradle_wrapper')).thenReturn(gradleWrapperDir);
fs.directory(gradleWrapperDir.childDirectory('gradle').childDirectory('wrapper'))
.createSync(recursive: true);
fs.file(fs.path.join(gradleWrapperDir.path, 'gradlew')).writeAsStringSync('irrelevant');
fs.file(fs.path.join(gradleWrapperDir.path, 'gradlew.bat')).writeAsStringSync('irrelevant');
when(processManager.start(any))
.thenAnswer((Invocation invocation){
final List<String> args = invocation.positionalArguments[0];
expect(args.length, 6);
expect(args[1], '-b');
expect(args[2].endsWith('resolve_dependencies.gradle'), isTrue);
expect(args[5], 'resolveDependencies');
return Future<Process>.value(mockProcess);
});
when(mockProcess.exitCode).thenAnswer((_) async => 0);
await mavenArtifacts.update();
expect(mavenArtifacts.isUpToDate(), isFalse);
}, overrides: <Type, Generator>{
Cache: ()=> mockCache,
FileSystem: () => memoryFileSystem,
ProcessManager: () => processManager,
});
}); });
} }
...@@ -318,7 +270,7 @@ class FakeCachedArtifact extends EngineCachedArtifact { ...@@ -318,7 +270,7 @@ class FakeCachedArtifact extends EngineCachedArtifact {
FakeCachedArtifact({ FakeCachedArtifact({
String stampName = 'STAMP', String stampName = 'STAMP',
@required Cache cache, @required Cache cache,
DevelopmentArtifact requiredArtifacts, Set<DevelopmentArtifact> requiredArtifacts = const <DevelopmentArtifact>{},
this.binaryDirs = const <List<String>>[], this.binaryDirs = const <List<String>>[],
this.licenseDirs = const <String>[], this.licenseDirs = const <String>[],
this.packageDirs = const <String>[], this.packageDirs = const <String>[],
...@@ -338,15 +290,12 @@ class FakeCachedArtifact extends EngineCachedArtifact { ...@@ -338,15 +290,12 @@ class FakeCachedArtifact extends EngineCachedArtifact {
List<String> getPackageDirs() => packageDirs; List<String> getPackageDirs() => packageDirs;
} }
class MockProcessManager extends Mock implements ProcessManager {}
class MockProcess extends Mock implements Process {}
class MockFileSystem extends Mock implements FileSystem {} class MockFileSystem extends Mock implements FileSystem {}
class MockFile extends Mock implements File {} class MockFile extends Mock implements File {}
class MockDirectory extends Mock implements Directory {} class MockDirectory extends Mock implements Directory {}
class MockRandomAccessFile extends Mock implements RandomAccessFile {} class MockRandomAccessFile extends Mock implements RandomAccessFile {}
class MockCachedArtifact extends Mock implements CachedArtifact {} class MockCachedArtifact extends Mock implements CachedArtifact {}
class MockIosUsbArtifacts extends Mock implements IosUsbArtifacts {}
class MockInternetAddress extends Mock implements InternetAddress {} class MockInternetAddress extends Mock implements InternetAddress {}
class MockCache extends Mock implements Cache {} class MockCache extends Mock implements Cache {}
class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {} class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {}
...@@ -27,24 +27,12 @@ void main() { ...@@ -27,24 +27,12 @@ void main() {
final PrecacheCommand command = PrecacheCommand(); final PrecacheCommand command = PrecacheCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
await createTestCommandRunner(command).run( await createTestCommandRunner(command).run(
const <String>[ const <String>['precache', '--ios', '--android', '--web', '--macos', '--linux', '--windows', '--fuchsia', '--flutter_runner']
'precache',
'--ios',
'--android',
'--web',
'--macos',
'--linux',
'--windows',
'--fuchsia',
'--flutter_runner',
]
); );
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{ expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
DevelopmentArtifact.iOS, DevelopmentArtifact.iOS,
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.android,
DevelopmentArtifact.androidMaven,
DevelopmentArtifact.androidInternalBuild,
DevelopmentArtifact.web, DevelopmentArtifact.web,
DevelopmentArtifact.macOS, DevelopmentArtifact.macOS,
DevelopmentArtifact.linux, DevelopmentArtifact.linux,
...@@ -56,54 +44,6 @@ void main() { ...@@ -56,54 +44,6 @@ void main() {
Cache: () => cache, Cache: () => cache,
}); });
testUsingContext('Expands android artifacts when the android flag is used', () async {
// Release lock between test cases.
Cache.releaseLockEarly();
final PrecacheCommand command = PrecacheCommand();
applyMocksToCommand(command);
await createTestCommandRunner(command).run(
const <String>[
'precache',
'--no-ios',
'--android',
]
);
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal,
DevelopmentArtifact.androidGenSnapshot,
DevelopmentArtifact.androidMaven,
DevelopmentArtifact.androidInternalBuild,
}));
}, overrides: <Type, Generator>{
Cache: () => cache,
});
testUsingContext('Adds artifact flags to requested android artifacts', () async {
// Release lock between test cases.
Cache.releaseLockEarly();
final PrecacheCommand command = PrecacheCommand();
applyMocksToCommand(command);
await createTestCommandRunner(command).run(
const <String>[
'precache',
'--no-ios',
'--android_gen_snapshot',
'--android_maven',
'--android_internal_build',
]
);
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal,
DevelopmentArtifact.androidGenSnapshot,
DevelopmentArtifact.androidMaven,
DevelopmentArtifact.androidInternalBuild,
}));
}, overrides: <Type, Generator>{
Cache: () => cache,
});
final MockFlutterVersion flutterVersion = MockFlutterVersion(); final MockFlutterVersion flutterVersion = MockFlutterVersion();
when(flutterVersion.isMaster).thenReturn(false); when(flutterVersion.isMaster).thenReturn(false);
...@@ -113,31 +53,18 @@ void main() { ...@@ -113,31 +53,18 @@ void main() {
final PrecacheCommand command = PrecacheCommand(); final PrecacheCommand command = PrecacheCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
await createTestCommandRunner(command).run( await createTestCommandRunner(command).run(
const <String>[ const <String>['precache', '--ios', '--android', '--web', '--macos', '--linux', '--windows', '--fuchsia', '--flutter_runner']
'precache',
'--ios',
'--android_gen_snapshot',
'--android_maven',
'--android_internal_build',
'--web',
'--macos',
'--linux',
'--windows',
'--fuchsia',
'--flutter_runner',
]
); );
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{ expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
DevelopmentArtifact.iOS, DevelopmentArtifact.iOS,
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.android,
DevelopmentArtifact.androidMaven, }));
DevelopmentArtifact.androidInternalBuild,
}));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => cache, Cache: () => cache,
FlutterVersion: () => flutterVersion, FlutterVersion: () => flutterVersion,
}); });
testUsingContext('Downloads artifacts when --force is provided', () async { testUsingContext('Downloads artifacts when --force is provided', () async {
when(cache.isUpToDate()).thenReturn(true); when(cache.isUpToDate()).thenReturn(true);
// Release lock between test cases. // Release lock between test cases.
...@@ -146,12 +73,10 @@ void main() { ...@@ -146,12 +73,10 @@ void main() {
applyMocksToCommand(command); applyMocksToCommand(command);
await createTestCommandRunner(command).run(const <String>['precache', '--force']); await createTestCommandRunner(command).run(const <String>['precache', '--force']);
expect(artifacts, unorderedEquals(<DevelopmentArtifact>{ expect(artifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
DevelopmentArtifact.iOS, DevelopmentArtifact.iOS,
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.android,
DevelopmentArtifact.androidMaven, }));
DevelopmentArtifact.androidInternalBuild,
}));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => cache, Cache: () => cache,
FlutterVersion: () => flutterVersion, FlutterVersion: () => flutterVersion,
......
...@@ -138,7 +138,7 @@ void main() { ...@@ -138,7 +138,7 @@ void main() {
expect(await RunCommand().requiredArtifacts, unorderedEquals(<DevelopmentArtifact>{ expect(await RunCommand().requiredArtifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.android,
})); }));
when(mockDeviceManager.getDevices()).thenAnswer((Invocation invocation) { when(mockDeviceManager.getDevices()).thenAnswer((Invocation invocation) {
...@@ -162,7 +162,7 @@ void main() { ...@@ -162,7 +162,7 @@ void main() {
expect(await RunCommand().requiredArtifacts, unorderedEquals(<DevelopmentArtifact>{ expect(await RunCommand().requiredArtifacts, unorderedEquals(<DevelopmentArtifact>{
DevelopmentArtifact.universal, DevelopmentArtifact.universal,
DevelopmentArtifact.iOS, DevelopmentArtifact.iOS,
DevelopmentArtifact.androidGenSnapshot, DevelopmentArtifact.android,
})); }));
when(mockDeviceManager.getDevices()).thenAnswer((Invocation invocation) { when(mockDeviceManager.getDevices()).thenAnswer((Invocation invocation) {
......
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