Make plugins work in Swift projects (#15437)
This commit is contained in:
parent
c0118ea4b9
commit
658f9e6c83
@ -8,5 +8,8 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';
|
|||||||
import 'package:flutter_devicelab/framework/framework.dart';
|
import 'package:flutter_devicelab/framework/framework.dart';
|
||||||
|
|
||||||
Future<Null> main() async {
|
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';
|
import 'package:flutter_devicelab/framework/framework.dart';
|
||||||
|
|
||||||
Future<Null> main() async {
|
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';
|
import 'package:flutter_devicelab/framework/framework.dart';
|
||||||
|
|
||||||
Future<Null> main() async {
|
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/ios.dart';
|
||||||
import 'package:flutter_devicelab/framework/utils.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
|
/// Defines task that creates new Flutter project, adds a plugin, and then
|
||||||
/// builds the specified [buildTarget].
|
/// builds the specified [buildTarget].
|
||||||
class PluginTest {
|
class PluginTest {
|
||||||
final String buildTarget;
|
final String buildTarget;
|
||||||
|
final List<String> options;
|
||||||
|
|
||||||
PluginTest(this.buildTarget);
|
PluginTest(this.buildTarget, this.options);
|
||||||
|
|
||||||
Future<TaskResult> call() async {
|
Future<TaskResult> call() async {
|
||||||
section('Create Flutter project');
|
section('Create Flutter project');
|
||||||
final Directory tmp = await Directory.systemTemp.createTemp('plugin');
|
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') {
|
if (buildTarget == 'ios') {
|
||||||
await prepareProvisioningCertificates(project.rootPath);
|
await prepareProvisioningCertificates(project.rootPath);
|
||||||
}
|
}
|
||||||
@ -46,9 +60,12 @@ class FlutterProject {
|
|||||||
final Directory parent;
|
final Directory parent;
|
||||||
final String name;
|
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 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');
|
return new FlutterProject(directory, 'plugintest');
|
||||||
}
|
}
|
||||||
|
@ -67,5 +67,9 @@ post_install do |installer|
|
|||||||
target.build_configurations.each do |config|
|
target.build_configurations.each do |config|
|
||||||
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user