mirror of
https://github.com/flutter/packages.git
synced 2025-06-30 23:03:11 +08:00
[tool/ci] Add iOS/macOS and Dart support to fetch-deps
(#4562)
Adds `fetch-deps` support for: - iOS/macOS dependencies, using `pod install` - Dart package dependencies, using `pub get` To make avoid doing extra work in the Dart dependencies step when using this with `*_platform_tests` CI, also adds flags for all of the other platforms, and adds a flag that allows skipping Dart dependencies for any package that doesn't have an example supporting any requested platform. This means that we can pass, e.g., `--windows --supporting-target-platforms-only` to only fetch Dart packages for packages with examples that will be build during the build-and-drive Windows tests. Adds this as a new step in every platform tests CI task, and in the standard analyze step, so that we will pre-fetch Dart packages (and for iOS/macOS, pods). This won't yet fully eliminate later network access (see https://github.com/flutter/flutter/issues/131204), but will give us early warning on any major failures, such as pub being entirely unreachable from the bots. - These are marked as an infrastructure step; we'll have to see if this ends up being confusing in practice. If `pub` resolution fails for legitimate reasons, such as a PR that tries to require a version of a package that doesn't exist or that has conflicts, this will cause a failure that is marked as infra. My assumption is that the much more common case is going to be that it is actually an infra failure. Fixes https://github.com/flutter/flutter/issues/130280
This commit is contained in:
@ -36,7 +36,142 @@ void main() {
|
||||
CommandRunner<void>('fetch_deps_test', 'Test for $FetchDepsCommand');
|
||||
runner.addCommand(command);
|
||||
});
|
||||
|
||||
group('dart', () {
|
||||
test('runs pub get', () async {
|
||||
final RepositoryPackage plugin = createFakePlugin(
|
||||
'plugin1', packagesDir, platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
'flutter',
|
||||
const <String>['pub', 'get'],
|
||||
plugin.directory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('fails if pub get fails', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
processRunner
|
||||
.mockProcessesForExecutable[getFlutterCommand(mockPlatform)] =
|
||||
<FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(exitCode: 1)),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps'], errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Failed to "pub get"'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips unsupported packages when any platforms are passed',
|
||||
() async {
|
||||
final RepositoryPackage packageWithBoth = createFakePackage(
|
||||
'supports_both', packagesDir, extraFiles: <String>[
|
||||
'example/linux/placeholder',
|
||||
'example/windows/placeholder'
|
||||
]);
|
||||
final RepositoryPackage packageWithOne = createFakePackage(
|
||||
'supports_one', packagesDir,
|
||||
extraFiles: <String>['example/linux/placeholder']);
|
||||
createFakePackage('supports_neither', packagesDir);
|
||||
|
||||
await runCapturingPrint(runner, <String>[
|
||||
'fetch-deps',
|
||||
'--linux',
|
||||
'--windows',
|
||||
'--supporting-target-platforms-only'
|
||||
]);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
'dart',
|
||||
const <String>['pub', 'get'],
|
||||
packageWithBoth.path,
|
||||
),
|
||||
ProcessCall(
|
||||
'dart',
|
||||
const <String>['pub', 'get'],
|
||||
packageWithOne.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('android', () {
|
||||
test('runs pub get before gradlew dependencies', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin1', packagesDir, extraFiles: <String>[
|
||||
'example/android/gradlew',
|
||||
], platformSupport: <String, PlatformDetails>{
|
||||
platformAndroid: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final Directory androidDir = plugin
|
||||
.getExamples()
|
||||
.first
|
||||
.platformDirectory(FlutterPlatform.android);
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--android']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
'flutter',
|
||||
const <String>['pub', 'get'],
|
||||
plugin.directory.path,
|
||||
),
|
||||
ProcessCall(
|
||||
androidDir.childFile('gradlew').path,
|
||||
const <String>['plugin1:dependencies'],
|
||||
androidDir.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('runs gradlew dependencies', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin1', packagesDir, extraFiles: <String>[
|
||||
@ -50,8 +185,8 @@ void main() {
|
||||
.first
|
||||
.platformDirectory(FlutterPlatform.android);
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps']);
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
@ -89,8 +224,8 @@ void main() {
|
||||
(RepositoryPackage example) =>
|
||||
example.platformDirectory(FlutterPlatform.android));
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps']);
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
@ -123,8 +258,8 @@ void main() {
|
||||
.first
|
||||
.platformDirectory(FlutterPlatform.android);
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps']);
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
@ -164,7 +299,8 @@ void main() {
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps'], errorHandler: (Error e) {
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
@ -199,7 +335,8 @@ void main() {
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps'], errorHandler: (Error e) {
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
@ -212,41 +349,479 @@ void main() {
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips non-Android plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir);
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Package does not have native Android dependencies.')
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips non-inline plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformAndroid: const PlatformDetails(PlatformSupport.federated)
|
||||
});
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--android']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Package does not have native Android dependencies.')
|
||||
],
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
test('skips non-Android plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir);
|
||||
group('ios', () {
|
||||
test('runs pub get before pod install', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin1', packagesDir, extraFiles: <String>[
|
||||
'example/ios/Flutter/Generated.xcconfig',
|
||||
], platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps']);
|
||||
final Directory iOSDir =
|
||||
plugin.getExamples().first.platformDirectory(FlutterPlatform.ios);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains(
|
||||
'SKIPPING: Plugin does not have an Android implementation.')
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps', '--ios']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall(
|
||||
'flutter',
|
||||
<String>['precache', '--ios'],
|
||||
null,
|
||||
),
|
||||
ProcessCall(
|
||||
'flutter',
|
||||
const <String>['pub', 'get'],
|
||||
plugin.directory.path,
|
||||
),
|
||||
ProcessCall(
|
||||
'pod',
|
||||
const <String>['install'],
|
||||
iOSDir.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('runs on all examples', () async {
|
||||
final List<String> examples = <String>['example1', 'example2'];
|
||||
final RepositoryPackage plugin = createFakePlugin(
|
||||
'plugin1', packagesDir,
|
||||
examples: examples,
|
||||
extraFiles: <String>[
|
||||
'example/example1/ios/Flutter/Generated.xcconfig',
|
||||
'example/example2/ios/Flutter/Generated.xcconfig',
|
||||
],
|
||||
));
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final Iterable<Directory> exampleIOSDirs = plugin.getExamples().map(
|
||||
(RepositoryPackage example) =>
|
||||
example.platformDirectory(FlutterPlatform.ios));
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--ios']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall(
|
||||
'flutter',
|
||||
<String>['precache', '--ios'],
|
||||
null,
|
||||
),
|
||||
for (final Directory directory in exampleIOSDirs)
|
||||
ProcessCall(
|
||||
'pod',
|
||||
const <String>['install'],
|
||||
directory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('runs pub get if example is not configured', () async {
|
||||
final RepositoryPackage plugin = createFakePlugin(
|
||||
'plugin1', packagesDir, platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final RepositoryPackage example = plugin.getExamples().first;
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--ios']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall(
|
||||
'flutter',
|
||||
<String>['precache', '--ios'],
|
||||
null,
|
||||
),
|
||||
ProcessCall(
|
||||
'flutter',
|
||||
const <String>['pub', 'get'],
|
||||
example.directory.path,
|
||||
),
|
||||
ProcessCall(
|
||||
'pod',
|
||||
const <String>['install'],
|
||||
example.platformDirectory(FlutterPlatform.ios).path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('fails if pre-pod pub get fails', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
processRunner
|
||||
.mockProcessesForExecutable[getFlutterCommand(mockPlatform)] =
|
||||
<FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(), <String>['precache']),
|
||||
FakeProcessInfo(MockProcess(exitCode: 1), <String>['pub', 'get']),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--ios'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Unable to configure project'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('fails if pod install fails', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
processRunner.mockProcessesForExecutable['pod'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(exitCode: 1)),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--ios'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('The following packages had errors:'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips non-iOS plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir);
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--ios']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Package does not have native iOS dependencies.')
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips non-inline plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.federated)
|
||||
});
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--ios']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Package does not have native iOS dependencies.')
|
||||
],
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
test('skips non-inline plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformAndroid: const PlatformDetails(PlatformSupport.federated)
|
||||
});
|
||||
group('macos', () {
|
||||
test('runs pub get before pod install', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin1', packagesDir, extraFiles: <String>[
|
||||
'example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig',
|
||||
], platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps']);
|
||||
final Directory macOSDir =
|
||||
plugin.getExamples().first.platformDirectory(FlutterPlatform.macos);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains(
|
||||
'SKIPPING: Plugin does not have an Android implementation.')
|
||||
final List<String> output =
|
||||
await runCapturingPrint(runner, <String>['fetch-deps', '--macos']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall(
|
||||
'flutter',
|
||||
<String>['precache', '--macos'],
|
||||
null,
|
||||
),
|
||||
ProcessCall(
|
||||
'flutter',
|
||||
const <String>['pub', 'get'],
|
||||
plugin.directory.path,
|
||||
),
|
||||
ProcessCall(
|
||||
'pod',
|
||||
const <String>['install'],
|
||||
macOSDir.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('runs on all examples', () async {
|
||||
final List<String> examples = <String>['example1', 'example2'];
|
||||
final RepositoryPackage plugin = createFakePlugin(
|
||||
'plugin1', packagesDir,
|
||||
examples: examples,
|
||||
extraFiles: <String>[
|
||||
'example/example1/macos/Flutter/ephemeral/Flutter-Generated.xcconfig',
|
||||
'example/example2/macos/Flutter/ephemeral/Flutter-Generated.xcconfig',
|
||||
],
|
||||
));
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final Iterable<Directory> examplemacOSDirs = plugin.getExamples().map(
|
||||
(RepositoryPackage example) =>
|
||||
example.platformDirectory(FlutterPlatform.macos));
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--macos']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall(
|
||||
'flutter',
|
||||
<String>['precache', '--macos'],
|
||||
null,
|
||||
),
|
||||
for (final Directory directory in examplemacOSDirs)
|
||||
ProcessCall(
|
||||
'pod',
|
||||
const <String>['install'],
|
||||
directory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('runs pub get if example is not configured', () async {
|
||||
final RepositoryPackage plugin = createFakePlugin(
|
||||
'plugin1', packagesDir, platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
final RepositoryPackage example = plugin.getExamples().first;
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--macos']);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
const ProcessCall(
|
||||
'flutter',
|
||||
<String>['precache', '--macos'],
|
||||
null,
|
||||
),
|
||||
ProcessCall(
|
||||
'flutter',
|
||||
const <String>['pub', 'get'],
|
||||
example.directory.path,
|
||||
),
|
||||
ProcessCall(
|
||||
'pod',
|
||||
const <String>['install'],
|
||||
example.platformDirectory(FlutterPlatform.macos).path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin1'),
|
||||
contains('No issues found!'),
|
||||
]));
|
||||
});
|
||||
|
||||
test('fails if pre-pod pub get fails', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
processRunner
|
||||
.mockProcessesForExecutable[getFlutterCommand(mockPlatform)] =
|
||||
<FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(), <String>['precache']),
|
||||
FakeProcessInfo(MockProcess(exitCode: 1), <String>['pub', 'get']),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--macos'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Unable to configure project'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('fails if pod install fails', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline)
|
||||
});
|
||||
|
||||
processRunner.mockProcessesForExecutable['pod'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(exitCode: 1)),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--macos'],
|
||||
errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('The following packages had errors:'),
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips non-macOS plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir);
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--macos']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Package does not have native macOS dependencies.')
|
||||
],
|
||||
));
|
||||
});
|
||||
|
||||
test('skips non-inline plugins', () async {
|
||||
createFakePlugin('plugin1', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.federated)
|
||||
});
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['fetch-deps', '--no-dart', '--macos']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(
|
||||
<Matcher>[
|
||||
contains('Package does not have native macOS dependencies.')
|
||||
],
|
||||
));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -394,6 +394,7 @@ class RecordingProcessRunner extends ProcessRunner {
|
||||
String executable,
|
||||
List<String> args, {
|
||||
Directory? workingDir,
|
||||
Map<String, String>? environment,
|
||||
bool exitOnError = false,
|
||||
}) async {
|
||||
recordedCalls.add(ProcessCall(executable, args, workingDir?.path));
|
||||
@ -412,6 +413,7 @@ class RecordingProcessRunner extends ProcessRunner {
|
||||
String executable,
|
||||
List<String> args, {
|
||||
Directory? workingDir,
|
||||
Map<String, String>? environment,
|
||||
bool exitOnError = false,
|
||||
bool logOnError = false,
|
||||
Encoding stdoutEncoding = io.systemEncoding,
|
||||
|
Reference in New Issue
Block a user