Unverified Commit b80b9bea authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Set DEFINES_MODULE for FlutterPluginRegistrant to generate modulemap (#40302)

parent 69a29646
......@@ -29,6 +29,8 @@
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
......
......@@ -156,7 +156,7 @@ Future<void> main() async {
String content = await pubspec.readAsString();
content = content.replaceFirst(
'\ndependencies:\n',
'\ndependencies:\n device_info:\n package_info:\n',
'\ndependencies:\n device_info:\n google_maps_flutter:\n', // One dynamic and one static framework.
);
await pubspec.writeAsString(content, flush: true);
await inDirectory(projectDir, () async {
......@@ -192,7 +192,7 @@ Future<void> main() async {
if (!podfileLockOutput.contains(':path: Flutter/engine')
|| !podfileLockOutput.contains(':path: Flutter/FlutterPluginRegistrant')
|| !podfileLockOutput.contains(':path: Flutter/.symlinks/device_info/ios')
|| !podfileLockOutput.contains(':path: Flutter/.symlinks/package_info/ios')) {
|| !podfileLockOutput.contains(':path: Flutter/.symlinks/google_maps_flutter/ios')) {
return TaskResult.failure('Building ephemeral host app Podfile.lock does not contain expected pods');
}
......@@ -232,18 +232,18 @@ Future<void> main() async {
return TaskResult.failure('Failed to build editable host .app');
}
section('Add to existing iOS app');
section('Add to existing iOS Objective-C app');
final Directory hostApp = Directory(path.join(tempDir.path, 'hello_host_app'));
mkdir(hostApp);
final Directory objectiveCHostApp = Directory(path.join(tempDir.path, 'hello_host_app'));
mkdir(objectiveCHostApp);
recursiveCopy(
Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'ios_host_app')),
hostApp,
objectiveCHostApp,
);
final File analyticsOutputFile = File(path.join(tempDir.path, 'analytics.log'));
await inDirectory(hostApp, () async {
final File objectiveCAnalyticsOutputFile = File(path.join(tempDir.path, 'analytics-objc.log'));
final Directory objectiveCBuildDirectory = Directory(path.join(tempDir.path, 'build-objc'));
await inDirectory(objectiveCHostApp, () async {
await exec('pod', <String>['install']);
await exec(
'xcodebuild',
......@@ -258,37 +258,37 @@ Future<void> main() async {
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'CONFIGURATION_BUILD_DIR=${tempDir.path}',
'CONFIGURATION_BUILD_DIR=${objectiveCBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
environment: <String, String> {
'FLUTTER_ANALYTICS_LOG_FILE': analyticsOutputFile.path,
'FLUTTER_ANALYTICS_LOG_FILE': objectiveCAnalyticsOutputFile.path,
}
);
});
final bool existingAppBuilt = exists(File(path.join(
tempDir.path,
objectiveCBuildDirectory.path,
'Host.app',
'Host',
)));
if (!existingAppBuilt) {
return TaskResult.failure('Failed to build existing app .app');
return TaskResult.failure('Failed to build existing Objective-C app .app');
}
final String analyticsOutput = analyticsOutputFile.readAsStringSync();
if (!analyticsOutput.contains('cd24: ios')
|| !analyticsOutput.contains('cd25: true')
|| !analyticsOutput.contains('viewName: build/bundle')) {
final String objectiveCAnalyticsOutput = objectiveCAnalyticsOutputFile.readAsStringSync();
if (!objectiveCAnalyticsOutput.contains('cd24: ios')
|| !objectiveCAnalyticsOutput.contains('cd25: true')
|| !objectiveCAnalyticsOutput.contains('viewName: build/bundle')) {
return TaskResult.failure(
'Building outer app produced the following analytics: "$analyticsOutput"'
'Building outer Objective-C app produced the following analytics: "$objectiveCAnalyticsOutput"'
'but not the expected strings: "cd24: ios", "cd25: true", "viewName: build/bundle"'
);
}
section('Fail building existing iOS app if flutter script fails');
section('Fail building existing Objective-C iOS app if flutter script fails');
int xcodebuildExitCode = 0;
await inDirectory(hostApp, () async {
await inDirectory(objectiveCHostApp, () async {
xcodebuildExitCode = await exec(
'xcodebuild',
<String>[
......@@ -303,7 +303,7 @@ Future<void> main() async {
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'CONFIGURATION_BUILD_DIR=${tempDir.path}',
'CONFIGURATION_BUILD_DIR=${objectiveCBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
canFail: true
......@@ -311,7 +311,62 @@ Future<void> main() async {
});
if (xcodebuildExitCode != 65) { // 65 returned on PhaseScriptExecution failure.
return TaskResult.failure('Host app build succeeded though flutter script failed');
return TaskResult.failure('Host Objective-C app build succeeded though flutter script failed');
}
section('Add to existing iOS Swift app');
final Directory swiftHostApp = Directory(path.join(tempDir.path, 'hello_host_app_swift'));
mkdir(swiftHostApp);
recursiveCopy(
Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'ios_host_app_swift')),
swiftHostApp,
);
final File swiftAnalyticsOutputFile = File(path.join(tempDir.path, 'analytics-swift.log'));
final Directory swiftBuildDirectory = Directory(path.join(tempDir.path, 'build-swift'));
await inDirectory(swiftHostApp, () async {
await exec('pod', <String>['install']);
await exec(
'xcodebuild',
<String>[
'-workspace',
'Host.xcworkspace',
'-scheme',
'Host',
'-configuration',
'Debug',
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'CONFIGURATION_BUILD_DIR=${swiftBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
environment: <String, String> {
'FLUTTER_ANALYTICS_LOG_FILE': swiftAnalyticsOutputFile.path,
}
);
});
final bool existingSwiftAppBuilt = exists(File(path.join(
swiftBuildDirectory.path,
'Host.app',
'Host',
)));
if (!existingSwiftAppBuilt) {
return TaskResult.failure('Failed to build existing Swift app .app');
}
final String swiftAnalyticsOutput = swiftAnalyticsOutputFile.readAsStringSync();
if (!swiftAnalyticsOutput.contains('cd24: ios')
|| !swiftAnalyticsOutput.contains('cd25: true')
|| !swiftAnalyticsOutput.contains('viewName: build/bundle')) {
return TaskResult.failure(
'Building outer Swift app produced the following analytics: "$swiftAnalyticsOutput"'
'but not the expected strings: "cd24: ios", "cd25: true", "viewName: build/bundle"'
);
}
return TaskResult.success(null);
......
......@@ -4,6 +4,7 @@
@implementation ViewController
// Boiler-plate add-to-app demo. Not integration tested anywhere.
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Host.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
}
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}
import UIKit
import Flutter
import FlutterPluginRegistrant
class ViewController: UIViewController {
var flutterEngine : FlutterEngine?;
// Boiler-plate add-to-app demo. Not integration tested anywhere.
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type:UIButton.ButtonType.custom)
button.addTarget(self, action: #selector(handleButtonAction), for: .touchUpInside)
button.setTitle("Press me", for: UIControl.State.normal)
button.frame = CGRect(x: 80.0, y: 210.0, width: 160.0, height: 40.0)
button.backgroundColor = UIColor.blue
self.view.addSubview(button)
self.flutterEngine = FlutterEngine(name: "io.flutter", project: nil);
}
@objc func handleButtonAction() {
let flutterEngine = self.flutterEngine;
GeneratedPluginRegistrant.register(with: flutterEngine);
let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)!;
self.present(flutterViewController, animated: false, completion: nil)
}
}
platform :ios, '9.0'
flutter_application_path = '../hello'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'Host' do
install_all_flutter_pods flutter_application_path
end
......@@ -384,6 +384,7 @@ Depends on all your plugins, and provides a function to register them.
s.source = { :path => '.' }
s.public_header_files = './Classes/**/*.h'
s.static_framework = true
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.dependency '{{framework}}'
{{#plugins}}
s.dependency '{{name}}'
......
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