Set DEFINES_MODULE=YES in plugin templates (#41828)

This commit is contained in:
Jenn Magder
2019-10-03 18:35:20 -07:00
committed by GitHub
parent f8c75305ca
commit 4331c172d7
4 changed files with 79 additions and 7 deletions

View File

@@ -881,6 +881,7 @@ Future<void> _runIntegrationTests() async {
await _runDevicelabTest('flutter_create_offline_test_windows');
} else if (Platform.isMacOS) {
await _runDevicelabTest('flutter_create_offline_test_mac');
await _runDevicelabTest('plugin_lint_mac');
// TODO(jmagman): Re-enable once flakiness is resolved.
// await _runDevicelabTest('module_test_ios');
}

View File

@@ -0,0 +1,69 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:io';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
/// Tests that the Flutter plugin template works. Use `pod lib lint`
/// to confirm the plugin module can be imported into an app.
Future<void> main() async {
await task(() async {
section('Create Objective-C iOS plugin');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_plugin_test.');
try {
const String objcPluginName = 'test_plugin_objc';
await inDirectory(tempDir, () async {
await flutter(
'create',
options: <String>[
'--org',
'io.flutter.devicelab',
'--template=plugin',
'--ios-language=objc',
objcPluginName,
],
);
});
final String objcPodspecPath = path.join(tempDir.path, objcPluginName, 'ios', '$objcPluginName.podspec');
section('Lint Objective-C iOS plugin as framework');
await inDirectory(tempDir, () async {
await exec(
'pod',
<String>[
'lib',
'lint',
objcPodspecPath,
'--allow-warnings',
],
);
});
section('Lint Objective-C iOS plugin as library');
await inDirectory(tempDir, () async {
await exec(
'pod',
<String>[
'lib',
'lint',
objcPodspecPath,
'--allow-warnings',
'--use-libraries',
],
);
});
return TaskResult.success(null);
} catch (e) {
return TaskResult.failure(e.toString());
} finally {
rmTree(tempDir);
}
});
}