Unverified Commit 1513b971 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Add integration test for plugins without ios directories (#62630)

parent d261f1ef
...@@ -78,6 +78,11 @@ Future<void> main() async { ...@@ -78,6 +78,11 @@ Future<void> main() async {
); );
}); });
checkDirectoryNotExists(path.join(
pluginCDirectory.path,
'android',
));
final File pluginCpubspec = File(path.join(pluginCDirectory.path, 'pubspec.yaml')); final File pluginCpubspec = File(path.join(pluginCDirectory.path, 'pubspec.yaml'));
await pluginCpubspec.writeAsString(''' await pluginCpubspec.writeAsString('''
name: plugin_c name: plugin_c
...@@ -98,6 +103,27 @@ environment: ...@@ -98,6 +103,27 @@ environment:
flutter: ">=1.5.0 <2.0.0" flutter: ">=1.5.0 <2.0.0"
''', flush: true); ''', flush: true);
section('Create plugin D without ios/ directory');
final Directory pluginDDirectory = Directory(path.join(tempDir.path, 'plugin_d'));
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org',
'io.flutter.devicelab.plugin_d',
'--template=plugin',
'--platforms=android',
pluginDDirectory.path,
],
);
});
checkDirectoryNotExists(path.join(
pluginDDirectory.path,
'ios',
));
section('Write dummy Kotlin code in plugin B'); section('Write dummy Kotlin code in plugin B');
final File pluginBKotlinClass = File(path.join( final File pluginBKotlinClass = File(path.join(
...@@ -120,7 +146,7 @@ public class DummyPluginBClass { ...@@ -120,7 +146,7 @@ public class DummyPluginBClass {
} }
''', flush: true); ''', flush: true);
section('Make plugin A depend on plugin B and plugin C'); section('Make plugin A depend on plugin B, C, and D');
final File pluginApubspec = File(path.join(pluginADirectory.path, 'pubspec.yaml')); final File pluginApubspec = File(path.join(pluginADirectory.path, 'pubspec.yaml'));
String pluginApubspecContent = await pluginApubspec.readAsString(); String pluginApubspecContent = await pluginApubspec.readAsString();
...@@ -130,7 +156,9 @@ public class DummyPluginBClass { ...@@ -130,7 +156,9 @@ public class DummyPluginBClass {
' plugin_b:\n' ' plugin_b:\n'
' path: ${pluginBDirectory.path}\n' ' path: ${pluginBDirectory.path}\n'
' plugin_c:\n' ' plugin_c:\n'
' path: ${pluginCDirectory.path}\n', ' path: ${pluginCDirectory.path}\n'
' plugin_d:\n'
' path: ${pluginDDirectory.path}\n',
); );
await pluginApubspec.writeAsString(pluginApubspecContent, flush: true); await pluginApubspec.writeAsString(pluginApubspecContent, flush: true);
...@@ -187,7 +215,7 @@ public class DummyPluginAClass { ...@@ -187,7 +215,7 @@ public class DummyPluginAClass {
'[' '['
'{' '{'
'"name":"plugin_a",' '"name":"plugin_a",'
'"dependencies":["plugin_b","plugin_c"]' '"dependencies":["plugin_b","plugin_c","plugin_d"]'
'},' '},'
'{' '{'
'"name":"plugin_b",' '"name":"plugin_b",'
...@@ -196,6 +224,10 @@ public class DummyPluginAClass { ...@@ -196,6 +224,10 @@ public class DummyPluginAClass {
'{' '{'
'"name":"plugin_c",' '"name":"plugin_c",'
'"dependencies":[]' '"dependencies":[]'
'},'
'{'
'"name":"plugin_d",'
'"dependencies":[]'
'}' '}'
']'; ']';
final String graphString = json.encode(dependencyGraph); final String graphString = json.encode(dependencyGraph);
...@@ -206,7 +238,7 @@ public class DummyPluginAClass { ...@@ -206,7 +238,7 @@ public class DummyPluginAClass {
); );
} }
section('Build plugin A example app'); section('Build plugin A example Android app');
final StringBuffer stderr = StringBuffer(); final StringBuffer stderr = StringBuffer();
await inDirectory(exampleApp, () async { await inDirectory(exampleApp, () async {
...@@ -237,6 +269,56 @@ public class DummyPluginAClass { ...@@ -237,6 +269,56 @@ public class DummyPluginAClass {
return TaskResult.failure('Failed to build plugin A example APK'); return TaskResult.failure('Failed to build plugin A example APK');
} }
if (Platform.isMacOS) {
section('Build plugin A example iOS app');
await inDirectory(exampleApp, () async {
await evalFlutter(
'build',
options: <String>[
'ios',
'--no-codesign',
],
);
});
final Directory appBundle = Directory(path.join(
pluginADirectory.path,
'example',
'build',
'ios',
'iphoneos',
'Runner.app',
));
if (!exists(appBundle)) {
return TaskResult.failure('Failed to build plugin A example iOS app');
}
checkDirectoryExists(path.join(
appBundle.path,
'Frameworks',
'plugin_a.framework',
));
checkDirectoryExists(path.join(
appBundle.path,
'Frameworks',
'plugin_b.framework',
));
checkDirectoryExists(path.join(
appBundle.path,
'Frameworks',
'plugin_c.framework',
));
// Plugin D is Android only and should not be embedded.
checkDirectoryNotExists(path.join(
appBundle.path,
'Frameworks',
'plugin_d.framework',
));
}
return TaskResult.success(null); return TaskResult.success(null);
} on TaskResult catch (taskResult) { } on TaskResult catch (taskResult) {
return taskResult; return taskResult;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment