Unverified Commit 658f9e6c authored by Mikkel Nygaard Ravn's avatar Mikkel Nygaard Ravn Committed by GitHub

Make plugins work in Swift projects (#15437)

parent c0118ea4
......@@ -8,5 +8,8 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(new PluginTest('apk'));
await task(combine(<TaskFunction>[
new PluginTest('apk', <String>['-a', 'java']),
new PluginTest('apk', <String>['-a', 'kotlin']),
]));
}
......@@ -8,5 +8,8 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(new PluginTest('ios'));
await task(combine(<TaskFunction>[
new PluginTest('ios', <String>['-i', 'objc']),
new PluginTest('ios', <String>['-i', 'swift']),
]));
}
......@@ -8,5 +8,8 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';
import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async {
await task(new PluginTest('apk'));
await task(combine(<TaskFunction>[
new PluginTest('apk', <String>['-a', 'java']),
new PluginTest('apk', <String>['-a', 'kotlin']),
]));
}
......@@ -10,17 +10,31 @@ import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/utils.dart';
/// Combines several TaskFunctions with trivial success value into one.
TaskFunction combine(List<TaskFunction> tasks) {
return () async {
for (TaskFunction task in tasks) {
final TaskResult result = await task();
if (result.failed) {
return result;
}
}
return new TaskResult.success(null);
};
}
/// Defines task that creates new Flutter project, adds a plugin, and then
/// builds the specified [buildTarget].
class PluginTest {
final String buildTarget;
final List<String> options;
PluginTest(this.buildTarget);
PluginTest(this.buildTarget, this.options);
Future<TaskResult> call() async {
section('Create Flutter project');
final Directory tmp = await Directory.systemTemp.createTemp('plugin');
final FlutterProject project = await FlutterProject.create(tmp);
final FlutterProject project = await FlutterProject.create(tmp, options);
if (buildTarget == 'ios') {
await prepareProvisioningCertificates(project.rootPath);
}
......@@ -46,9 +60,12 @@ class FlutterProject {
final Directory parent;
final String name;
static Future<FlutterProject> create(Directory directory) async {
static Future<FlutterProject> create(Directory directory, List<String> options) async {
await inDirectory(directory, () async {
await flutter('create', options: <String>['--org', 'io.flutter.devicelab', 'plugintest']);
await flutter(
'create',
options: <String>['--org', 'io.flutter.devicelab']..addAll(options)..add('plugintest')
);
});
return new FlutterProject(directory, 'plugintest');
}
......
......@@ -67,5 +67,9 @@ post_install do |installer|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
# workaround for https://github.com/CocoaPods/CocoaPods/issues/7463
target.headers_build_phase.files.each do |file|
file.settings = { 'ATTRIBUTES' => ['Public'] }
end
end
end
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