Null safety migration of packages/flutter_tools/test/commands.shard/hermetic, part 1/3 (#110707)
* Migrate packages/flutter_tools/test/commands.shard/hermetic, part 1/3 * Fix tests * Fix analysis * Fix analyze_test * Make AnalysisServer a local variable * Chris's comments
This commit is contained in:
parent
c0354999a7
commit
8da0432094
@ -87,7 +87,7 @@ abstract class AnalyzeBase {
|
|||||||
return artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path;
|
return artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path;
|
||||||
}
|
}
|
||||||
bool get isBenchmarking => argResults['benchmark'] as bool;
|
bool get isBenchmarking => argResults['benchmark'] as bool;
|
||||||
String get protocolTrafficLog => argResults['protocol-traffic-log'] as String;
|
String? get protocolTrafficLog => argResults['protocol-traffic-log'] as String?;
|
||||||
|
|
||||||
/// Generate an analysis summary for both [AnalyzeOnce], [AnalyzeContinuously].
|
/// Generate an analysis summary for both [AnalyzeOnce], [AnalyzeContinuously].
|
||||||
static String generateErrorsMessage({
|
static String generateErrorsMessage({
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:fake_async/fake_async.dart';
|
import 'package:fake_async/fake_async.dart';
|
||||||
@ -32,13 +30,12 @@ void main() {
|
|||||||
Cache.flutterRoot = getFlutterRoot();
|
Cache.flutterRoot = getFlutterRoot();
|
||||||
});
|
});
|
||||||
|
|
||||||
AnalysisServer server;
|
late Directory tempDir;
|
||||||
Directory tempDir;
|
late FileSystem fileSystem;
|
||||||
FileSystem fileSystem;
|
late Platform platform;
|
||||||
Platform platform;
|
late ProcessManager processManager;
|
||||||
ProcessManager processManager;
|
late AnsiTerminal terminal;
|
||||||
AnsiTerminal terminal;
|
late Logger logger;
|
||||||
Logger logger;
|
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fileSystem = globals.localFileSystem;
|
fileSystem = globals.localFileSystem;
|
||||||
@ -51,7 +48,6 @@ void main() {
|
|||||||
|
|
||||||
tearDown(() {
|
tearDown(() {
|
||||||
tryToDelete(tempDir);
|
tryToDelete(tempDir);
|
||||||
return server?.dispose();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -88,11 +84,10 @@ void main() {
|
|||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.flutterTests,
|
context: PubContext.flutterTests,
|
||||||
directory: tempDir.path,
|
directory: tempDir.path,
|
||||||
generateSyntheticPackage: false,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
server = AnalysisServer(
|
final AnalysisServer server = AnalysisServer(
|
||||||
globals.artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||||
<String>[tempDir.path],
|
<String>[tempDir.path],
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
@ -109,6 +104,8 @@ void main() {
|
|||||||
await onDone;
|
await onDone;
|
||||||
|
|
||||||
expect(errorCount, 0);
|
expect(errorCount, 0);
|
||||||
|
|
||||||
|
await server.dispose();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -126,18 +123,17 @@ void main() {
|
|||||||
await pub.get(
|
await pub.get(
|
||||||
context: PubContext.flutterTests,
|
context: PubContext.flutterTests,
|
||||||
directory: tempDir.path,
|
directory: tempDir.path,
|
||||||
generateSyntheticPackage: false,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
server = AnalysisServer(
|
final AnalysisServer server = AnalysisServer(
|
||||||
globals.artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||||
<String>[tempDir.path],
|
<String>[tempDir.path],
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
processManager: processManager,
|
processManager: processManager,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
terminal: terminal,
|
terminal: terminal,
|
||||||
);
|
);
|
||||||
|
|
||||||
int errorCount = 0;
|
int errorCount = 0;
|
||||||
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
|
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
|
||||||
@ -149,13 +145,15 @@ void main() {
|
|||||||
await onDone;
|
await onDone;
|
||||||
|
|
||||||
expect(errorCount, greaterThan(0));
|
expect(errorCount, greaterThan(0));
|
||||||
|
|
||||||
|
await server.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Returns no errors when source is error-free', () async {
|
testUsingContext('Returns no errors when source is error-free', () async {
|
||||||
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||||
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
||||||
server = AnalysisServer(
|
final AnalysisServer server = AnalysisServer(
|
||||||
globals.artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||||
<String>[tempDir.path],
|
<String>[tempDir.path],
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
@ -172,6 +170,7 @@ void main() {
|
|||||||
await server.start();
|
await server.start();
|
||||||
await onDone;
|
await onDone;
|
||||||
expect(errorCount, 0);
|
expect(errorCount, 0);
|
||||||
|
await server.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Can run AnalysisService with customized cache location', () async {
|
testUsingContext('Can run AnalysisService with customized cache location', () async {
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/artifacts.dart';
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
@ -22,7 +20,7 @@ import '../../src/test_flutter_command_runner.dart';
|
|||||||
|
|
||||||
class ProjectValidatorDummy extends ProjectValidator {
|
class ProjectValidatorDummy extends ProjectValidator {
|
||||||
@override
|
@override
|
||||||
Future<List<ProjectValidatorResult>> start(FlutterProject project, {Logger logger, FileSystem fileSystem}) async{
|
Future<List<ProjectValidatorResult>> start(FlutterProject project, {Logger? logger, FileSystem? fileSystem}) async{
|
||||||
return <ProjectValidatorResult>[
|
return <ProjectValidatorResult>[
|
||||||
const ProjectValidatorResult(name: 'pass', value: 'value', status: StatusProjectValidator.success),
|
const ProjectValidatorResult(name: 'pass', value: 'value', status: StatusProjectValidator.success),
|
||||||
const ProjectValidatorResult(name: 'fail', value: 'my error', status: StatusProjectValidator.error),
|
const ProjectValidatorResult(name: 'fail', value: 'my error', status: StatusProjectValidator.error),
|
||||||
@ -41,7 +39,7 @@ class ProjectValidatorDummy extends ProjectValidator {
|
|||||||
|
|
||||||
class ProjectValidatorSecondDummy extends ProjectValidator {
|
class ProjectValidatorSecondDummy extends ProjectValidator {
|
||||||
@override
|
@override
|
||||||
Future<List<ProjectValidatorResult>> start(FlutterProject project, {Logger logger, FileSystem fileSystem}) async{
|
Future<List<ProjectValidatorResult>> start(FlutterProject project, {Logger? logger, FileSystem? fileSystem}) async{
|
||||||
return <ProjectValidatorResult>[
|
return <ProjectValidatorResult>[
|
||||||
const ProjectValidatorResult(name: 'second', value: 'pass', status: StatusProjectValidator.success),
|
const ProjectValidatorResult(name: 'second', value: 'pass', status: StatusProjectValidator.success),
|
||||||
const ProjectValidatorResult(name: 'other fail', value: 'second fail', status: StatusProjectValidator.error),
|
const ProjectValidatorResult(name: 'other fail', value: 'second fail', status: StatusProjectValidator.error),
|
||||||
@ -59,7 +57,7 @@ class ProjectValidatorSecondDummy extends ProjectValidator {
|
|||||||
|
|
||||||
class ProjectValidatorCrash extends ProjectValidator {
|
class ProjectValidatorCrash extends ProjectValidator {
|
||||||
@override
|
@override
|
||||||
Future<List<ProjectValidatorResult>> start(FlutterProject project, {Logger logger, FileSystem fileSystem}) async{
|
Future<List<ProjectValidatorResult>> start(FlutterProject project, {Logger? logger, FileSystem? fileSystem}) async{
|
||||||
throw Exception('my exception');
|
throw Exception('my exception');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +71,10 @@ class ProjectValidatorCrash extends ProjectValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
Terminal terminal;
|
late Terminal terminal;
|
||||||
ProcessManager processManager;
|
late ProcessManager processManager;
|
||||||
Platform platform;
|
late Platform platform;
|
||||||
|
|
||||||
group('analyze --suggestions command', () {
|
group('analyze --suggestions command', () {
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
@ -46,13 +44,13 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('analyze command', () {
|
group('analyze command', () {
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
Platform platform;
|
late Platform platform;
|
||||||
BufferLogger logger;
|
late BufferLogger logger;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
Terminal terminal;
|
late Terminal terminal;
|
||||||
AnalyzeCommand command;
|
late AnalyzeCommand command;
|
||||||
CommandRunner<void> runner;
|
late CommandRunner<void> runner;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -130,8 +128,8 @@ void main() {
|
|||||||
// Absolute paths
|
// Absolute paths
|
||||||
expect(inRepo(<String>[tempDir.path], fileSystem), isFalse);
|
expect(inRepo(<String>[tempDir.path], fileSystem), isFalse);
|
||||||
expect(inRepo(<String>[fileSystem.path.join(tempDir.path, 'foo')], fileSystem), isFalse);
|
expect(inRepo(<String>[fileSystem.path.join(tempDir.path, 'foo')], fileSystem), isFalse);
|
||||||
expect(inRepo(<String>[Cache.flutterRoot], fileSystem), isTrue);
|
expect(inRepo(<String>[Cache.flutterRoot!], fileSystem), isTrue);
|
||||||
expect(inRepo(<String>[fileSystem.path.join(Cache.flutterRoot, 'foo')], fileSystem), isTrue);
|
expect(inRepo(<String>[fileSystem.path.join(Cache.flutterRoot!, 'foo')], fileSystem), isTrue);
|
||||||
|
|
||||||
// Relative paths
|
// Relative paths
|
||||||
fileSystem.currentDirectory = Cache.flutterRoot;
|
fileSystem.currentDirectory = Cache.flutterRoot;
|
||||||
@ -158,6 +156,7 @@ void main() {
|
|||||||
'startColumn': 4,
|
'startColumn': 4,
|
||||||
},
|
},
|
||||||
'message': 'Prefer final for variable declarations if they are not reassigned.',
|
'message': 'Prefer final for variable declarations if they are not reassigned.',
|
||||||
|
'code': 'var foo = 123;',
|
||||||
'hasFix': false,
|
'hasFix': false,
|
||||||
};
|
};
|
||||||
expect(WrittenError.fromJson(json).toString(),
|
expect(WrittenError.fromJson(json).toString(),
|
||||||
@ -165,11 +164,11 @@ void main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inRepo(List<String> fileList, FileSystem fileSystem) {
|
bool inRepo(List<String>? fileList, FileSystem fileSystem) {
|
||||||
if (fileList == null || fileList.isEmpty) {
|
if (fileList == null || fileList.isEmpty) {
|
||||||
fileList = <String>[fileSystem.path.current];
|
fileList = <String>[fileSystem.path.current];
|
||||||
}
|
}
|
||||||
final String root = fileSystem.path.normalize(fileSystem.path.absolute(Cache.flutterRoot));
|
final String root = fileSystem.path.normalize(fileSystem.path.absolute(Cache.flutterRoot!));
|
||||||
final String prefix = root + fileSystem.path.separator;
|
final String prefix = root + fileSystem.path.separator;
|
||||||
for (String file in fileList) {
|
for (String file in fileList) {
|
||||||
file = fileSystem.path.normalize(fileSystem.path.absolute(file));
|
file = fileSystem.path.normalize(fileSystem.path.absolute(file));
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.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/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
@ -21,9 +19,9 @@ import '../../src/fakes.dart';
|
|||||||
import '../../src/test_build_system.dart';
|
import '../../src/test_build_system.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
MemoryFileSystem memoryFileSystem;
|
late MemoryFileSystem memoryFileSystem;
|
||||||
Directory outputDirectory;
|
late Directory outputDirectory;
|
||||||
FakePlatform fakePlatform;
|
late FakePlatform fakePlatform;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -48,7 +46,7 @@ void main() {
|
|||||||
group('build ios-framework', () {
|
group('build ios-framework', () {
|
||||||
group('podspec', () {
|
group('podspec', () {
|
||||||
const String engineRevision = '0123456789abcdef';
|
const String engineRevision = '0123456789abcdef';
|
||||||
Cache cache;
|
late Cache cache;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
final Directory rootOverride = memoryFileSystem.directory('cache');
|
final Directory rootOverride = memoryFileSystem.directory('cache');
|
||||||
@ -181,7 +179,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('not on master channel', () {
|
group('not on master channel', () {
|
||||||
FakeFlutterVersion fakeFlutterVersion;
|
late FakeFlutterVersion fakeFlutterVersion;
|
||||||
setUp(() {
|
setUp(() {
|
||||||
const GitTagVersion gitTagVersion = GitTagVersion(
|
const GitTagVersion gitTagVersion = GitTagVersion(
|
||||||
x: 1,
|
x: 1,
|
||||||
@ -277,7 +275,7 @@ void main() {
|
|||||||
group('build macos-framework', () {
|
group('build macos-framework', () {
|
||||||
group('podspec', () {
|
group('podspec', () {
|
||||||
const String engineRevision = '0123456789abcdef';
|
const String engineRevision = '0123456789abcdef';
|
||||||
Cache cache;
|
late Cache cache;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
final Directory rootOverride = memoryFileSystem.directory('cache');
|
final Directory rootOverride = memoryFileSystem.directory('cache');
|
||||||
@ -410,7 +408,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('not on master channel', () {
|
group('not on master channel', () {
|
||||||
FakeFlutterVersion fakeFlutterVersion;
|
late FakeFlutterVersion fakeFlutterVersion;
|
||||||
setUp(() {
|
setUp(() {
|
||||||
const GitTagVersion gitTagVersion = GitTagVersion(
|
const GitTagVersion gitTagVersion = GitTagVersion(
|
||||||
x: 1,
|
x: 1,
|
||||||
@ -504,8 +502,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('XCFrameworks', () {
|
group('XCFrameworks', () {
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
FakeProcessManager fakeProcessManager;
|
late FakeProcessManager fakeProcessManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -28,21 +26,21 @@ class FakeXcodeProjectInterpreterWithBuildSettings extends FakeXcodeProjectInter
|
|||||||
@override
|
@override
|
||||||
Future<Map<String, String>> getBuildSettings(
|
Future<Map<String, String>> getBuildSettings(
|
||||||
String projectPath, {
|
String projectPath, {
|
||||||
XcodeProjectBuildContext buildContext,
|
XcodeProjectBuildContext? buildContext,
|
||||||
Duration timeout = const Duration(minutes: 1),
|
Duration timeout = const Duration(minutes: 1),
|
||||||
}) async {
|
}) async {
|
||||||
return <String, String>{
|
return <String, String>{
|
||||||
'PRODUCT_BUNDLE_IDENTIFIER': productBundleIdentifier ?? 'io.flutter.someProject',
|
'PRODUCT_BUNDLE_IDENTIFIER': productBundleIdentifier ?? 'io.flutter.someProject',
|
||||||
'TARGET_BUILD_DIR': 'build/ios/Release-iphoneos',
|
'TARGET_BUILD_DIR': 'build/ios/Release-iphoneos',
|
||||||
'WRAPPER_NAME': 'Runner.app',
|
'WRAPPER_NAME': 'Runner.app',
|
||||||
if (developmentTeam != null) 'DEVELOPMENT_TEAM': developmentTeam,
|
if (developmentTeam != null) 'DEVELOPMENT_TEAM': developmentTeam!,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The value of 'PRODUCT_BUNDLE_IDENTIFIER'.
|
/// The value of 'PRODUCT_BUNDLE_IDENTIFIER'.
|
||||||
final String productBundleIdentifier;
|
final String? productBundleIdentifier;
|
||||||
|
|
||||||
final String developmentTeam;
|
final String? developmentTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Platform macosPlatform = FakePlatform(
|
final Platform macosPlatform = FakePlatform(
|
||||||
@ -59,8 +57,8 @@ final Platform notMacosPlatform = FakePlatform(
|
|||||||
);
|
);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
TestUsage usage;
|
late TestUsage usage;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -90,7 +88,7 @@ void main() {
|
|||||||
'xattr', '-r', '-d', 'com.apple.FinderInfo', '/',
|
'xattr', '-r', '-d', 'com.apple.FinderInfo', '/',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
FakeCommand setUpRsyncCommand({void Function() onRun}) {
|
FakeCommand setUpRsyncCommand({void Function()? onRun}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: const <String>[
|
command: const <String>[
|
||||||
'rsync',
|
'rsync',
|
||||||
@ -104,7 +102,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
FakeCommand setUpXCResultCommand({String stdout = '', void Function() onRun}) {
|
FakeCommand setUpXCResultCommand({String stdout = '', void Function()? onRun}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: const <String>[
|
command: const <String>[
|
||||||
'xcrun',
|
'xcrun',
|
||||||
@ -125,10 +123,10 @@ void main() {
|
|||||||
FakeCommand setUpFakeXcodeBuildHandler({
|
FakeCommand setUpFakeXcodeBuildHandler({
|
||||||
bool verbose = false,
|
bool verbose = false,
|
||||||
bool simulator = false,
|
bool simulator = false,
|
||||||
String deviceId,
|
String? deviceId,
|
||||||
int exitCode = 0,
|
int exitCode = 0,
|
||||||
String stdout,
|
String? stdout,
|
||||||
void Function() onRun,
|
void Function()? onRun,
|
||||||
}) {
|
}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -28,7 +26,7 @@ class FakeXcodeProjectInterpreterWithBuildSettings extends FakeXcodeProjectInter
|
|||||||
@override
|
@override
|
||||||
Future<Map<String, String>> getBuildSettings(
|
Future<Map<String, String>> getBuildSettings(
|
||||||
String projectPath, {
|
String projectPath, {
|
||||||
XcodeProjectBuildContext buildContext,
|
XcodeProjectBuildContext? buildContext,
|
||||||
Duration timeout = const Duration(minutes: 1),
|
Duration timeout = const Duration(minutes: 1),
|
||||||
}) async {
|
}) async {
|
||||||
return <String, String>{
|
return <String, String>{
|
||||||
@ -53,9 +51,9 @@ final Platform notMacosPlatform = FakePlatform(
|
|||||||
);
|
);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
TestUsage usage;
|
late TestUsage usage;
|
||||||
FakeProcessManager fakeProcessManager;
|
late FakeProcessManager fakeProcessManager;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -86,7 +84,7 @@ void main() {
|
|||||||
'xattr', '-r', '-d', 'com.apple.FinderInfo', '/',
|
'xattr', '-r', '-d', 'com.apple.FinderInfo', '/',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
FakeCommand setUpXCResultCommand({String stdout = '', void Function() onRun}) {
|
FakeCommand setUpXCResultCommand({String stdout = '', void Function()? onRun}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: const <String>[
|
command: const <String>[
|
||||||
'xcrun',
|
'xcrun',
|
||||||
@ -104,7 +102,7 @@ void main() {
|
|||||||
|
|
||||||
// Creates a FakeCommand for the xcodebuild call to build the app
|
// Creates a FakeCommand for the xcodebuild call to build the app
|
||||||
// in the given configuration.
|
// in the given configuration.
|
||||||
FakeCommand setUpFakeXcodeBuildHandler({ bool verbose = false, int exitCode = 0, void Function() onRun }) {
|
FakeCommand setUpFakeXcodeBuildHandler({ bool verbose = false, int exitCode = 0, void Function()? onRun }) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
'xcrun',
|
'xcrun',
|
||||||
@ -134,7 +132,7 @@ void main() {
|
|||||||
|
|
||||||
FakeCommand exportArchiveCommand({
|
FakeCommand exportArchiveCommand({
|
||||||
String exportOptionsPlist = '/ExportOptions.plist',
|
String exportOptionsPlist = '/ExportOptions.plist',
|
||||||
File cachePlist,
|
File? cachePlist,
|
||||||
}) {
|
}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
@ -45,9 +43,9 @@ void main() {
|
|||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
});
|
});
|
||||||
|
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
ProcessManager processManager;
|
late ProcessManager processManager;
|
||||||
TestUsage usage;
|
late TestUsage usage;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
@ -71,7 +69,7 @@ void main() {
|
|||||||
// Returns the command matching the build_linux call to cmake.
|
// Returns the command matching the build_linux call to cmake.
|
||||||
FakeCommand cmakeCommand(String buildMode, {
|
FakeCommand cmakeCommand(String buildMode, {
|
||||||
String target = 'x64',
|
String target = 'x64',
|
||||||
void Function() onRun,
|
void Function()? onRun,
|
||||||
}) {
|
}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
@ -89,9 +87,9 @@ void main() {
|
|||||||
|
|
||||||
// Returns the command matching the build_linux call to ninja.
|
// Returns the command matching the build_linux call to ninja.
|
||||||
FakeCommand ninjaCommand(String buildMode, {
|
FakeCommand ninjaCommand(String buildMode, {
|
||||||
Map<String, String> environment,
|
Map<String, String>? environment,
|
||||||
String target = 'x64',
|
String target = 'x64',
|
||||||
void Function() onRun,
|
void Function()? onRun,
|
||||||
String stdout = '',
|
String stdout = '',
|
||||||
}) {
|
}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
@ -29,7 +27,7 @@ import '../../src/test_flutter_command_runner.dart';
|
|||||||
|
|
||||||
class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter {
|
class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter {
|
||||||
@override
|
@override
|
||||||
Future<XcodeProjectInfo> getInfo(String projectPath, { String projectFilename }) async {
|
Future<XcodeProjectInfo> getInfo(String projectPath, { String? projectFilename }) async {
|
||||||
return XcodeProjectInfo(
|
return XcodeProjectInfo(
|
||||||
<String>['Runner'],
|
<String>['Runner'],
|
||||||
<String>['Debug', 'Profile', 'Release'],
|
<String>['Debug', 'Profile', 'Release'],
|
||||||
@ -62,10 +60,10 @@ final Platform notMacosPlatform = FakePlatform(
|
|||||||
);
|
);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
TestUsage usage;
|
late TestUsage usage;
|
||||||
FakeProcessManager fakeProcessManager;
|
late FakeProcessManager fakeProcessManager;
|
||||||
XcodeProjectInterpreter xcodeProjectInterpreter;
|
late XcodeProjectInterpreter xcodeProjectInterpreter;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -93,7 +91,7 @@ void main() {
|
|||||||
|
|
||||||
// Creates a FakeCommand for the xcodebuild call to build the app
|
// Creates a FakeCommand for the xcodebuild call to build the app
|
||||||
// in the given configuration.
|
// in the given configuration.
|
||||||
FakeCommand setUpFakeXcodeBuildHandler(String configuration, { bool verbose = false, void Function() onRun }) {
|
FakeCommand setUpFakeXcodeBuildHandler(String configuration, { bool verbose = false, void Function()? onRun }) {
|
||||||
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||||
final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory());
|
final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory());
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
|
@ -2,14 +2,12 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build.dart';
|
import 'package:flutter_tools/src/commands/build.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
@ -27,8 +25,8 @@ void main() {
|
|||||||
'combination with "--${FlutterOptions.kSplitDebugInfoOption}"'));
|
'combination with "--${FlutterOptions.kSplitDebugInfoOption}"'));
|
||||||
});
|
});
|
||||||
group('Fatal Logs', () {
|
group('Fatal Logs', () {
|
||||||
FakeBuildCommand command;
|
late FakeBuildCommand command;
|
||||||
MemoryFileSystem fs;
|
late MemoryFileSystem fs;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fs = MemoryFileSystem.test();
|
fs = MemoryFileSystem.test();
|
||||||
@ -134,7 +132,7 @@ class FakeBuildCommand extends BuildCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeBuildSubcommand extends BuildSubCommand {
|
class FakeBuildSubcommand extends BuildSubCommand {
|
||||||
FakeBuildSubcommand({@required bool verboseHelp}) : super(verboseHelp: verboseHelp);
|
FakeBuildSubcommand({required super.verboseHelp});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => '';
|
String get description => '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user