provide command to FakeCommand::onRun
(#142206)
Part of work on [#101077](https://github.com/flutter/flutter/pull/141194). This is done as a separate PR to avoid a massive diff. ## Context 1. The `FakeCommand` class accepts a list of patterns that's used to match a command given to its `FakeProcessManager`. Since `FakeCommand` can match a list of patterns, not just specifically strings, it can be used to match commands where the exact value of some arguments can't (easily) known ahead of time. For example, a part of the tool may invoke a command with an argument that is the path of a temporarily file that has a randomly-generated basename. 2. The `FakeCommand` class provides on `onRun` parameter, which is a callback that is run when the `FakeProcessManager` runs a command that matches the `FakeCommand` in question. ## Issue In the event that a `FakeCommand` is constructed using patterns, the test code can't know the exact values used for arguments in the command. This PR proposes changing the type of `onRun` from `VoidCallback?` to `void Function(List<String>)?`. When run, the value `List<String>` parameter will be the full command that the `FakeCommand` matched. Example: ```dart FakeCommand( command: <Pattern>[ artifacts.getArtifactPath(Artifact.engineDartBinary), 'run', 'vector_graphics_compiler', RegExp(r'--input=/.*\.temp'), RegExp(r'--output=/.*\.temp'), ], onRun: (List<String> command) { final outputPath = (() { // code to parse `--output` from `command` })(); testFileSystem.file(outputPath).createSync(recursive: true); }, ) ```
This commit is contained in:
parent
535ce79a99
commit
295a9a2031
@ -151,7 +151,7 @@ void main() {
|
||||
),
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', workingBranch],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
final File file = fileSystem.file('$checkoutsParentDirectory/engine/.ci.yaml')
|
||||
..createSync(recursive: true);
|
||||
_initializeCiYamlFile(file);
|
||||
@ -402,7 +402,7 @@ void main() {
|
||||
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', workingBranch],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml')
|
||||
..createSync();
|
||||
_initializeCiYamlFile(file);
|
||||
@ -504,7 +504,7 @@ void main() {
|
||||
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', workingBranch],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml')
|
||||
..createSync();
|
||||
_initializeCiYamlFile(file);
|
||||
@ -600,7 +600,7 @@ void main() {
|
||||
// we want merged upstream commit, not local working commit
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', 'upstream/$candidateBranch'],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml')
|
||||
..createSync();
|
||||
_initializeCiYamlFile(file);
|
||||
@ -686,7 +686,7 @@ void main() {
|
||||
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', workingBranch],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml')
|
||||
..createSync();
|
||||
_initializeCiYamlFile(file);
|
||||
|
@ -254,7 +254,7 @@ vars = {
|
||||
]),
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', candidateBranch, '--'],
|
||||
onRun: () => createdCandidateBranch = true,
|
||||
onRun: (_) => createdCandidateBranch = true,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'checkout', 'stable', '--'],
|
||||
@ -309,7 +309,7 @@ vars = {
|
||||
]),
|
||||
FakeCommand(
|
||||
command: const <String>['git', 'checkout', candidateBranch, '--'],
|
||||
onRun: () => createdCandidateBranch = true,
|
||||
onRun: (_) => createdCandidateBranch = true,
|
||||
),
|
||||
const FakeCommand(
|
||||
command: <String>['git', 'checkout', EngineRepository.defaultBranch],
|
||||
|
@ -159,7 +159,7 @@ void main() {
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile
|
||||
@ -368,7 +368,7 @@ void main() {
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile
|
||||
@ -554,7 +554,7 @@ void main() {
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile
|
||||
@ -763,7 +763,7 @@ void main() {
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile
|
||||
@ -972,7 +972,7 @@ void main() {
|
||||
EngineRepository.defaultUpstream,
|
||||
engine.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// Create the DEPS file which the tool will update
|
||||
engine.createSync(recursive: true);
|
||||
depsFile
|
||||
|
@ -403,7 +403,7 @@ void main() {
|
||||
'flutter,Dart,${apidocs.kPlatformIntegrationPackageName},flutter_test,flutter_driver',
|
||||
'--auto-include-dependencies',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
for (final File canary in generator.canaries) {
|
||||
canary.createSync(recursive: true);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ flutter:
|
||||
...List<RegExp>.filled(5, RegExp(r'-P[a-zA-Z-]+=.*')),
|
||||
'assembleAar$buildMode',
|
||||
],
|
||||
onRun: () => fs.directory('/build/host/outputs/repo').createSync(recursive: true),
|
||||
onRun: (_) => fs.directory('/build/host/outputs/repo').createSync(recursive: true),
|
||||
)),
|
||||
]);
|
||||
|
||||
|
@ -117,7 +117,7 @@ void main() {
|
||||
'xattr', '-r', '-d', 'com.apple.FinderInfo', '/',
|
||||
]);
|
||||
|
||||
FakeCommand setUpRsyncCommand({void Function()? onRun}) {
|
||||
FakeCommand setUpRsyncCommand({void Function(List<String> command)? onRun}) {
|
||||
return FakeCommand(
|
||||
command: const <String>[
|
||||
'rsync',
|
||||
@ -131,7 +131,7 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
FakeCommand setUpXCResultCommand({String stdout = '', void Function()? onRun}) {
|
||||
FakeCommand setUpXCResultCommand({String stdout = '', void Function(List<String> command)? onRun}) {
|
||||
return FakeCommand(
|
||||
command: const <String>[
|
||||
'xcrun',
|
||||
@ -157,7 +157,7 @@ void main() {
|
||||
String? deviceId,
|
||||
int exitCode = 0,
|
||||
String? stdout,
|
||||
void Function()? onRun,
|
||||
void Function(List<String> command)? onRun,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
command: <String>[
|
||||
@ -296,7 +296,7 @@ void main() {
|
||||
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(),
|
||||
@ -335,7 +335,7 @@ void main() {
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
disablePortPublication: true,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
@ -366,7 +366,7 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
@ -389,7 +389,7 @@ void main() {
|
||||
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(customNaming: true, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(customNaming: true, onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(),
|
||||
@ -423,7 +423,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(deviceId: '1234', onRun: () {
|
||||
setUpFakeXcodeBuildHandler(deviceId: '1234', onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(),
|
||||
@ -453,7 +453,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(simulator: true, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(simulator: true, onRun: (_) {
|
||||
fileSystem.directory('build/ios/Debug-iphonesimulator/Runner.app').createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(),
|
||||
@ -483,7 +483,7 @@ void main() {
|
||||
createMinimalMockProjectFiles();
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(verbose: true, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(verbose: true, onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(),
|
||||
@ -511,7 +511,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
fileSystem.file('build/flutter_size_01/snapshot.arm64.json')
|
||||
..createSync(recursive: true)
|
||||
@ -528,7 +528,7 @@ void main() {
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('{}');
|
||||
}),
|
||||
setUpRsyncCommand(onRun: () => fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App')
|
||||
setUpRsyncCommand(onRun: (_) => fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App')
|
||||
..createSync(recursive: true)
|
||||
..writeAsBytesSync(List<int>.generate(10000, (int index) => 0))),
|
||||
]);
|
||||
@ -609,11 +609,11 @@ void main() {
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app')
|
||||
.createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(onRun: () =>
|
||||
setUpRsyncCommand(onRun: (_) =>
|
||||
fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App')
|
||||
..createSync(recursive: true)
|
||||
..writeAsBytesSync(List<int>.generate(10000, (int index) => 0))),
|
||||
@ -672,11 +672,11 @@ void main() {
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app')
|
||||
.createSync(recursive: true);
|
||||
}),
|
||||
setUpRsyncCommand(onRun: () =>
|
||||
setUpRsyncCommand(onRun: (_) =>
|
||||
fileSystem.file('build/ios/iphoneos/Runner.app/Frameworks/App.framework/App')
|
||||
..createSync(recursive: true)
|
||||
..writeAsBytesSync(List<int>.generate(10000, (int index) => 0))),
|
||||
@ -716,7 +716,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(),
|
||||
@ -751,7 +751,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}, stdout: 'Lots of spew from Xcode',
|
||||
),
|
||||
@ -790,7 +790,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
||||
@ -860,7 +860,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
||||
@ -901,7 +901,7 @@ void main() {
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -938,7 +938,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithActionIssues),
|
||||
@ -977,13 +977,13 @@ void main() {
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
stdout: '$kConcurrentRunFailureMessage1 $kConcurrentRunFailureMessage2',
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).childFile('result.xcresult').createSync(recursive: true);
|
||||
}
|
||||
),
|
||||
// The second xcodebuild is triggered due to above concurrent run failure message.
|
||||
setUpFakeXcodeBuildHandler(
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// If the file is not cleaned, throw an error, test failure.
|
||||
if (fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).existsSync()) {
|
||||
throwToolExit('xcresult bundle file existed.', exitCode: 2);
|
||||
@ -1025,7 +1025,7 @@ void main() {
|
||||
stdout: '''
|
||||
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
||||
''',
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -1063,7 +1063,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -1115,7 +1115,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
stdout: '''
|
||||
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
||||
''',
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -1141,7 +1141,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -1178,7 +1178,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -1217,7 +1217,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
@ -1259,7 +1259,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
simulator: true,
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
},
|
||||
),
|
||||
@ -1298,7 +1298,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
simulator: true,
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
},
|
||||
),
|
||||
@ -1339,7 +1339,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
simulator: true,
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
},
|
||||
),
|
||||
|
@ -137,7 +137,7 @@ void main() {
|
||||
'xattr', '-r', '-d', 'com.apple.FinderInfo', '/',
|
||||
]);
|
||||
|
||||
FakeCommand setUpXCResultCommand({String stdout = '', void Function()? onRun}) {
|
||||
FakeCommand setUpXCResultCommand({String stdout = '', void Function(List<String> command)? onRun}) {
|
||||
return FakeCommand(
|
||||
command: const <String>[
|
||||
'xcrun',
|
||||
@ -155,7 +155,11 @@ void main() {
|
||||
|
||||
// Creates a FakeCommand for the xcodebuild call to build the app
|
||||
// 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(List<String> args)? onRun,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
command: <String>[
|
||||
'xcrun',
|
||||
@ -202,7 +206,7 @@ void main() {
|
||||
'-exportOptionsPlist',
|
||||
exportOptionsPlist,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// exportOptionsPlist will be cleaned up within the command.
|
||||
// Save it somewhere else so test expectations can be run on it.
|
||||
if (cachePlist != null) {
|
||||
@ -840,7 +844,7 @@ void main() {
|
||||
..writeAsBytesSync(List<int>.generate(10000, (int index) => 0));
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file('build/flutter_size_01/snapshot.arm64.json')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -936,7 +940,7 @@ void main() {
|
||||
);
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(),
|
||||
@ -970,7 +974,7 @@ void main() {
|
||||
);
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
||||
@ -1005,7 +1009,7 @@ void main() {
|
||||
);
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
||||
@ -1074,7 +1078,7 @@ void main() {
|
||||
);
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: (_) {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
||||
@ -1106,7 +1110,7 @@ void main() {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(plistPath).createSync(recursive: true);
|
||||
}),
|
||||
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
|
||||
@ -1159,7 +1163,7 @@ void main() {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(plistPath).createSync(recursive: true);
|
||||
}),
|
||||
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
|
||||
@ -1218,7 +1222,7 @@ void main() {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(plistPath).createSync(recursive: true);
|
||||
}),
|
||||
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
|
||||
@ -1277,7 +1281,7 @@ void main() {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(plistPath).createSync(recursive: true);
|
||||
}),
|
||||
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
|
||||
@ -1320,7 +1324,7 @@ void main() {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(plistPath).createSync(recursive: true);
|
||||
}),
|
||||
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
|
||||
@ -1366,7 +1370,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(templateIconContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -1448,7 +1452,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(templateIconContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -1528,7 +1532,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(projectIconContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -1590,7 +1594,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(projectIconContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -1653,7 +1657,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(projectIconContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -1715,7 +1719,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
// Uses unknown format version 123.
|
||||
fileSystem.file(projectIconContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
@ -1787,7 +1791,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
// The following json contains examples of:
|
||||
// - invalid size
|
||||
// - invalid scale
|
||||
@ -1892,7 +1896,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(templateLaunchImageContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -1973,7 +1977,7 @@ void main() {
|
||||
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
setUpFakeXcodeBuildHandler(onRun: (_) {
|
||||
fileSystem.file(templateLaunchImageContentsJsonPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
|
@ -90,7 +90,7 @@ void main() {
|
||||
// Returns the command matching the build_linux call to cmake.
|
||||
FakeCommand cmakeCommand(String buildMode, {
|
||||
String target = 'x64',
|
||||
void Function()? onRun,
|
||||
void Function(List<String> command)? onRun,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
command: <String>[
|
||||
@ -110,7 +110,7 @@ void main() {
|
||||
FakeCommand ninjaCommand(String buildMode, {
|
||||
Map<String, String>? environment,
|
||||
String target = 'x64',
|
||||
void Function()? onRun,
|
||||
void Function(List<String> command)? onRun,
|
||||
String stdout = '',
|
||||
}) {
|
||||
return FakeCommand(
|
||||
@ -279,7 +279,7 @@ void main() {
|
||||
setUpMockProjectFilesForBuild();
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
cmakeCommand('release'),
|
||||
ninjaCommand('release', onRun: () {
|
||||
ninjaCommand('release', onRun: (_) {
|
||||
throw ArgumentError();
|
||||
}),
|
||||
]);
|
||||
@ -694,7 +694,7 @@ set(BINARY_NAME "fizz_bar")
|
||||
setUpMockProjectFilesForBuild();
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
cmakeCommand('release'),
|
||||
ninjaCommand('release', onRun: () {
|
||||
ninjaCommand('release', onRun: (_) {
|
||||
fileSystem.file('build/flutter_size_01/snapshot.linux-x64.json')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
@ -751,7 +751,7 @@ set(BINARY_NAME "fizz_bar")
|
||||
setUpMockProjectFilesForBuild();
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
cmakeCommand('release', target: 'arm64'),
|
||||
ninjaCommand('release', target: 'arm64', onRun: () {
|
||||
ninjaCommand('release', target: 'arm64', onRun: (_) {
|
||||
fileSystem.file('build/flutter_size_01/snapshot.linux-arm64.json')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
|
@ -109,7 +109,7 @@ void main() {
|
||||
|
||||
// Creates a FakeCommand for the xcodebuild call to build the app
|
||||
// in the given configuration.
|
||||
FakeCommand setUpFakeXcodeBuildHandler(String configuration, { bool verbose = false, void Function()? onRun }) {
|
||||
FakeCommand setUpFakeXcodeBuildHandler(String configuration, { bool verbose = false, void Function(List<String> command)? onRun }) {
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||
final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory());
|
||||
return FakeCommand(
|
||||
@ -147,12 +147,12 @@ Thread: <_NSMainThread: 0x6000027c0280>{number = 1, name = main}
|
||||
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
|
||||
STDERR STUFF
|
||||
''',
|
||||
onRun: () {
|
||||
onRun: (List<String> command) {
|
||||
fileSystem.file(fileSystem.path.join('macos', 'Flutter', 'ephemeral', '.app_filename'))
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('example.app');
|
||||
if (onRun != null) {
|
||||
onRun();
|
||||
onRun(command);
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -658,7 +658,7 @@ STDERR STUFF
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
// These are generated by gen_snapshot because flutter assemble passes
|
||||
// extra flags specifying this output path
|
||||
setUpFakeXcodeBuildHandler('Release', onRun: () {
|
||||
setUpFakeXcodeBuildHandler('Release', onRun: (_) {
|
||||
fileSystem.file('build/flutter_size_01/snapshot.arm64.json')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
|
@ -79,7 +79,7 @@ void main() {
|
||||
// Returns the command matching the build_windows call to generate CMake
|
||||
// files.
|
||||
FakeCommand cmakeGenerationCommand({
|
||||
void Function()? onRun,
|
||||
void Function(List<String> command)? onRun,
|
||||
String generator = _defaultGenerator,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
@ -102,7 +102,7 @@ void main() {
|
||||
// Returns the command matching the build_windows call to build.
|
||||
FakeCommand buildCommand(String buildMode, {
|
||||
bool verbose = false,
|
||||
void Function()? onRun,
|
||||
void Function(List<String> command)? onRun,
|
||||
String stdout = '',
|
||||
}) {
|
||||
return FakeCommand(
|
||||
@ -948,7 +948,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
|
||||
processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
cmakeGenerationCommand(),
|
||||
buildCommand('Release', onRun: () {
|
||||
buildCommand('Release', onRun: (_) {
|
||||
fileSystem.file(r'build\flutter_size_01\snapshot.windows-x64.json')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
|
@ -46,7 +46,7 @@ void main() {
|
||||
const String upstreamHeadRevision = 'deadbeef';
|
||||
final Completer<void> reEntryCompleter = Completer<void>();
|
||||
|
||||
Future<void> reEnterTool() async {
|
||||
Future<void> reEnterTool(List<String> command) async {
|
||||
await runner.run(<String>['upgrade', '--continue', '--no-version-check']);
|
||||
reEntryCompleter.complete();
|
||||
}
|
||||
@ -128,7 +128,7 @@ void main() {
|
||||
testUsingContext('can push people from master to beta', () async {
|
||||
final Completer<void> reEntryCompleter = Completer<void>();
|
||||
|
||||
Future<void> reEnterTool() async {
|
||||
Future<void> reEnterTool(List<String> args) async {
|
||||
await runner.run(<String>['upgrade', '--continue', '--no-version-check']);
|
||||
reEntryCompleter.complete();
|
||||
}
|
||||
@ -207,7 +207,7 @@ void main() {
|
||||
testUsingContext('do not push people from beta to anything else', () async {
|
||||
final Completer<void> reEntryCompleter = Completer<void>();
|
||||
|
||||
Future<void> reEnterTool() async {
|
||||
Future<void> reEnterTool(List<String> command) async {
|
||||
await runner.run(<String>['upgrade', '--continue', '--no-version-check']);
|
||||
reEntryCompleter.complete();
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ void main() {
|
||||
'assembleRelease',
|
||||
],
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
throw const ProcessException('', <String>[], 'Unrecognized');
|
||||
}
|
||||
));
|
||||
|
@ -792,7 +792,7 @@ flutter:
|
||||
'--include=/$assetsPath',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file('$outputPath.spirv').createSync(recursive: true);
|
||||
},
|
||||
@ -839,7 +839,7 @@ flutter:
|
||||
'--include=/$assetsPath',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file('$outputPath.spirv').createSync(recursive: true);
|
||||
},
|
||||
@ -880,7 +880,7 @@ flutter:
|
||||
'--include=${fileSystem.path.join(materialDir.path, 'shaders')}',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file('$outputPath.spirv').createSync(recursive: true);
|
||||
},
|
||||
|
@ -670,7 +670,7 @@ void main() {
|
||||
'-d',
|
||||
tempDirectory.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempDirectory, exists);
|
||||
tempDirectory.childDirectory('dirA').childFile('fileA').createSync(recursive: true);
|
||||
tempDirectory.childDirectory('dirB').childFile('fileB').createSync(recursive: true);
|
||||
|
@ -599,7 +599,7 @@ void main() {
|
||||
'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.simulator',
|
||||
outputDir.path,
|
||||
],
|
||||
onRun: () => binary.createSync(recursive: true),
|
||||
onRun: (_) => binary.createSync(recursive: true),
|
||||
),
|
||||
lipoCommandNonFatResult,
|
||||
FakeCommand(command: <String>[
|
||||
|
@ -138,7 +138,7 @@ void main() {
|
||||
// destination
|
||||
environment.outputDir.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
entitlements.writeAsStringSync('foo');
|
||||
withoutEntitlements.writeAsStringSync('bar');
|
||||
nestedEntitlements.writeAsStringSync('somefile.bin');
|
||||
|
@ -54,7 +54,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file(outputSpirvPath).createSync(recursive: true);
|
||||
},
|
||||
@ -94,7 +94,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
@ -133,7 +133,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
@ -171,7 +171,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file(outputSpirvPath).createSync(recursive: true);
|
||||
},
|
||||
@ -253,7 +253,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync();
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp')
|
||||
..createSync()
|
||||
@ -301,7 +301,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync();
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp')
|
||||
..createSync()
|
||||
@ -349,7 +349,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync();
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp')
|
||||
..createSync()
|
||||
@ -398,7 +398,7 @@ void main() {
|
||||
'--include=$fragDir',
|
||||
'--include=$shaderLibDir',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp.spirv').createSync();
|
||||
fileSystem.file('/.tmp_rand0/0.8255140718871702.temp')
|
||||
..createSync()
|
||||
|
@ -590,7 +590,7 @@ void main() {
|
||||
'--packages=.dart_tool/package_config.json',
|
||||
'--cfe-only',
|
||||
environment.buildDir.childFile('main.dart').absolute.path,
|
||||
], onRun: () {
|
||||
], onRun: (_) {
|
||||
environment.buildDir.childFile('app.dill.deps')
|
||||
.writeAsStringSync('file:///a.dart');
|
||||
},
|
||||
@ -809,7 +809,7 @@ void main() {
|
||||
environment.buildDir.childFile('main.dart').absolute.path,
|
||||
environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path,
|
||||
],
|
||||
onRun: () => outputJsFile..createSync()..writeAsStringSync('foo'))
|
||||
onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo'))
|
||||
);
|
||||
|
||||
processManager.addCommand(FakeCommand(
|
||||
@ -848,7 +848,7 @@ void main() {
|
||||
environment.buildDir.childFile('main.dart').absolute.path,
|
||||
environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path,
|
||||
],
|
||||
onRun: () => outputJsFile..createSync()..writeAsStringSync('foo'))
|
||||
onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo'))
|
||||
);
|
||||
|
||||
processManager.addCommand(FakeCommand(
|
||||
@ -884,7 +884,7 @@ void main() {
|
||||
'--depfile=${depFile.absolute.path}',
|
||||
environment.buildDir.childFile('main.dart').absolute.path,
|
||||
environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path,
|
||||
], onRun: () => outputJsFile..createSync()..writeAsStringSync('foo')));
|
||||
], onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo')));
|
||||
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
@ -919,7 +919,7 @@ void main() {
|
||||
'--depfile=${depFile.absolute.path}',
|
||||
environment.buildDir.childFile('main.dart').absolute.path,
|
||||
environment.buildDir.childFile('main.dart.wasm').absolute.path,
|
||||
], onRun: () => outputJsFile..createSync()..writeAsStringSync('foo')));
|
||||
], onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo')));
|
||||
|
||||
await Dart2WasmTarget(WebRendererMode.canvaskit).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
@ -942,7 +942,7 @@ void main() {
|
||||
environment.buildDir.childFile('main.dart').absolute.path,
|
||||
environment.buildDir.childFile('main.dart.unopt.wasm').absolute.path,
|
||||
],
|
||||
onRun: () => outputJsFile..createSync()..writeAsStringSync('foo'))
|
||||
onRun: (_) => outputJsFile..createSync()..writeAsStringSync('foo'))
|
||||
);
|
||||
|
||||
processManager.addCommand(FakeCommand(
|
||||
|
@ -227,7 +227,7 @@ void main() {
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: testConfig.pingCommand,
|
||||
onRun: () => pingCommandWasExecuted = true,
|
||||
onRun: (_) => pingCommandWasExecuted = true,
|
||||
stdout: testConfigPingSuccessOutput
|
||||
),
|
||||
]),
|
||||
@ -318,7 +318,7 @@ void main() {
|
||||
logger: BufferLogger.test(),
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(command: testConfig.uninstallCommand),
|
||||
FakeCommand(command: testConfig.installCommand, onRun: () => bothCommandsWereExecuted = true),
|
||||
FakeCommand(command: testConfig.installCommand, onRun: (_) => bothCommandsWereExecuted = true),
|
||||
])
|
||||
);
|
||||
|
||||
@ -522,7 +522,7 @@ void main() {
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: testConfig.screenshotCommand!,
|
||||
onRun: () => screenshotCommandWasExecuted = true,
|
||||
onRun: (_) => screenshotCommandWasExecuted = true,
|
||||
),
|
||||
]);
|
||||
|
||||
@ -548,7 +548,7 @@ void main() {
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: testConfig.screenshotCommand!,
|
||||
onRun: () => screenshotCommandWasExecuted = true,
|
||||
onRun: (_) => screenshotCommandWasExecuted = true,
|
||||
),
|
||||
]);
|
||||
|
||||
|
@ -396,7 +396,7 @@ void main() {
|
||||
'get',
|
||||
'--example',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem
|
||||
.file('.dart_tool/package_config.json')
|
||||
.createSync(recursive: true);
|
||||
@ -646,7 +646,7 @@ exit code: 66
|
||||
'get',
|
||||
'--example',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
throw const ProcessException(
|
||||
'bin/cache/dart-sdk/bin/dart',
|
||||
<String>[
|
||||
@ -842,7 +842,7 @@ exit code: 66
|
||||
'FLUTTER_ROOT': '',
|
||||
'PUB_ENVIRONMENT': 'flutter_cli:flutter_tests',
|
||||
},
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.currentDirectory
|
||||
.childDirectory('.dart_tool')
|
||||
.childFile('package_config.json')
|
||||
@ -908,7 +908,7 @@ exit code: 66
|
||||
'FLUTTER_ROOT': '',
|
||||
'PUB_ENVIRONMENT': 'flutter_cli:flutter_tests',
|
||||
},
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.currentDirectory
|
||||
.childDirectory('.dart_tool')
|
||||
.childFile('package_config.json')
|
||||
@ -1155,7 +1155,7 @@ exit code: 66
|
||||
'get',
|
||||
'--example',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem
|
||||
.file('.dart_tool/package_config.json')
|
||||
.setLastModifiedSync(DateTime(2002));
|
||||
@ -1181,7 +1181,7 @@ exit code: 66
|
||||
'get',
|
||||
'--example',
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
fileSystem.file('pubspec.yaml').setLastModifiedSync(DateTime(2002));
|
||||
}),
|
||||
const FakeCommand(
|
||||
|
@ -156,7 +156,7 @@ void main() {
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -231,7 +231,7 @@ void main() {
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -277,7 +277,7 @@ ERROR: The file couldn’t be opened because it doesn’t exist. (NSCocoaErrorDo
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -314,7 +314,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -385,7 +385,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -460,7 +460,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -506,7 +506,7 @@ ERROR: The file couldn’t be opened because it doesn’t exist. (NSCocoaErrorDo
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -543,7 +543,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -633,7 +633,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -722,7 +722,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -792,7 +792,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -837,7 +837,7 @@ ERROR: The operation couldn?t be completed. (OSStatus error -10814.) (NSOSStatus
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -875,7 +875,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -976,7 +976,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1084,7 +1084,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1154,7 +1154,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1222,7 +1222,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1266,7 +1266,7 @@ ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1305,7 +1305,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1340,7 +1340,7 @@ invalid JSON
|
||||
];
|
||||
fakeProcessManager.addCommand(FakeCommand(
|
||||
command: args,
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
// Simulate that this command threw and simultaneously the OS
|
||||
// deleted the temp directory
|
||||
expect(tempFile, exists);
|
||||
@ -1395,7 +1395,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1457,7 +1457,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1520,7 +1520,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1576,7 +1576,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1640,7 +1640,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1713,7 +1713,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1797,7 +1797,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1852,7 +1852,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1902,7 +1902,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
@ -1957,7 +1957,7 @@ invalid JSON
|
||||
'--json-output',
|
||||
tempFile.path,
|
||||
],
|
||||
onRun: () {
|
||||
onRun: (_) {
|
||||
expect(tempFile, exists);
|
||||
tempFile.writeAsStringSync(deviceControlOutput);
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ void main() {
|
||||
stdout: stdout,
|
||||
stderr: stderr,
|
||||
exitCode: exitCode,
|
||||
onRun: () {},
|
||||
onRun: (_) {},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,13 @@ class FakeCommand {
|
||||
|
||||
/// A callback that is run after [duration] expires but before the [exitCode]
|
||||
/// (and output) are passed back.
|
||||
final VoidCallback? onRun;
|
||||
///
|
||||
/// The callback will be provided the full command that matched this instance.
|
||||
/// This can be useful in the rare scenario where the full command cannot be known
|
||||
/// ahead of time (i.e. when one or more instances of [RegExp] are used to
|
||||
/// match the command). For example, the command may contain one or more
|
||||
/// randomly-generated elements, such as a temporary directory path.
|
||||
final void Function(List<String> command)? onRun;
|
||||
|
||||
/// The process' exit code.
|
||||
///
|
||||
@ -306,7 +312,7 @@ abstract class FakeProcessManager implements ProcessManager {
|
||||
throw fakeCommand.exception!; // ignore: only_throw_errors
|
||||
}
|
||||
if (fakeCommand.onRun != null) {
|
||||
fakeCommand.onRun!();
|
||||
fakeCommand.onRun!(command);
|
||||
}
|
||||
return FakeProcess(
|
||||
duration: fakeCommand.duration,
|
||||
|
Loading…
x
Reference in New Issue
Block a user