mirror of
https://github.com/flutter/packages.git
synced 2025-05-31 13:38:45 +08:00
[flutter_plugin_tools] Allow disabling Swift Package Manager when building examples (#7145)
You can use the Flutter plugin tool to [build the plugins' examples apps](https://github.com/flutter/packages/tree/main/script/tool#run-dart-integration-tests). Currently, the tool can enable the Swift Package Manager feature. This change allows the tool to disable the Swift Package Manager feature. This will be useful for when SPM is enabled by default on a release channel. Preparation for: https://github.com/flutter/flutter/issues/151567
This commit is contained in:
@ -164,6 +164,53 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
test('building for iOS with CocoaPods on master channel', () async {
|
||||
mockPlatform.isMacOS = true;
|
||||
mockPlatform.environment['CHANNEL'] = 'master';
|
||||
|
||||
final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline),
|
||||
});
|
||||
|
||||
final Directory pluginExampleDirectory = getExampleDir(plugin);
|
||||
|
||||
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||
'build-examples',
|
||||
'--ios',
|
||||
'--enable-experiment=exp1',
|
||||
'--no-swift-package-manager',
|
||||
]);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<String>[
|
||||
'\nBUILDING plugin/example for iOS',
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>['config', '--no-enable-swift-package-manager'],
|
||||
null,
|
||||
),
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>[
|
||||
'build',
|
||||
'ios',
|
||||
'--no-codesign',
|
||||
'--enable-experiment=exp1'
|
||||
],
|
||||
pluginExampleDirectory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test('building for iOS with Swift Package Manager on master channel',
|
||||
() async {
|
||||
mockPlatform.isMacOS = true;
|
||||
@ -212,6 +259,50 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'building for iOS with CocoaPods on stable channel does not disable SPM',
|
||||
() async {
|
||||
mockPlatform.isMacOS = true;
|
||||
mockPlatform.environment['CHANNEL'] = 'stable';
|
||||
|
||||
final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformIOS: const PlatformDetails(PlatformSupport.inline),
|
||||
});
|
||||
|
||||
final Directory pluginExampleDirectory = getExampleDir(plugin);
|
||||
|
||||
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||
'build-examples',
|
||||
'--ios',
|
||||
'--enable-experiment=exp1',
|
||||
'--no-swift-package-manager',
|
||||
]);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<String>[
|
||||
'\nBUILDING plugin/example for iOS',
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>[
|
||||
'build',
|
||||
'ios',
|
||||
'--no-codesign',
|
||||
'--enable-experiment=exp1'
|
||||
],
|
||||
pluginExampleDirectory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'building for iOS with Swift Package Manager on stable channel does not enable SPM',
|
||||
() async {
|
||||
@ -353,6 +444,48 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
test('building for macOS with CocoaPods on master channel', () async {
|
||||
mockPlatform.isMacOS = true;
|
||||
mockPlatform.environment['CHANNEL'] = 'master';
|
||||
|
||||
final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline),
|
||||
});
|
||||
|
||||
final Directory pluginExampleDirectory = getExampleDir(plugin);
|
||||
|
||||
final List<String> output = await runCapturingPrint(runner,
|
||||
<String>['build-examples', '--macos', '--no-swift-package-manager']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<String>[
|
||||
'\nBUILDING plugin/example for macOS',
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>['config', '--no-enable-swift-package-manager'],
|
||||
null,
|
||||
),
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>[
|
||||
'build',
|
||||
'macos',
|
||||
],
|
||||
pluginExampleDirectory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
test('building for macOS with Swift Package Manager on master channel',
|
||||
() async {
|
||||
mockPlatform.isMacOS = true;
|
||||
@ -395,6 +528,44 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'building for macOS with CocoaPods on stable channel does not disable SPM',
|
||||
() async {
|
||||
mockPlatform.isMacOS = true;
|
||||
mockPlatform.environment['CHANNEL'] = 'stable';
|
||||
|
||||
final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformMacOS: const PlatformDetails(PlatformSupport.inline),
|
||||
});
|
||||
|
||||
final Directory pluginExampleDirectory = getExampleDir(plugin);
|
||||
|
||||
final List<String> output = await runCapturingPrint(runner,
|
||||
<String>['build-examples', '--macos', '--no-swift-package-manager']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<String>[
|
||||
'\nBUILDING plugin/example for macOS',
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>[
|
||||
'build',
|
||||
'macos',
|
||||
],
|
||||
pluginExampleDirectory.path,
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'building for macOS with Swift Package Manager on stable channel does not enable SPM',
|
||||
() async {
|
||||
|
Reference in New Issue
Block a user