Unverified Commit 649cf820 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

use_modular_headers (#42204)

parent 13a054f7
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=') ...@@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=')
end end
target 'Runner' do target 'Runner' do
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines. # referring to absolute paths on developers' machines.
system('rm -rf .symlinks') system('rm -rf .symlinks')
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
<?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>
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@interface Pair : NSObject @interface Pair : NSObject
@property(atomic, readonly, strong, nullable) NSObject* left; @property(atomic, readonly, strong, nullable) NSObject* left;
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
@interface AppDelegate () @interface AppDelegate ()
@property (atomic) uint64_t textureId; @property (atomic) uint64_t textureId;
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -5,6 +5,7 @@ flutter_application_path = 'flutterapp/' ...@@ -5,6 +5,7 @@ flutter_application_path = 'flutterapp/'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'ios_add2app' do target 'ios_add2app' do
use_modular_headers!
install_all_flutter_pods(flutter_application_path) install_all_flutter_pods(flutter_application_path)
end end
......
#import "ViewController.h" #import "ViewController.h"
#import <Flutter/Flutter.h>
#import <FlutterPluginRegistrant/GeneratedPluginRegistrant.h> @import Flutter;
@import FlutterPluginRegistrant;
// Prove plugins can be module-imported from the host app.
@import device_info;
@import google_maps_flutter;
@implementation ViewController @implementation ViewController
......
...@@ -4,5 +4,6 @@ flutter_application_path = '../hello' ...@@ -4,5 +4,6 @@ flutter_application_path = '../hello'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'Host' do target 'Host' do
use_modular_headers!
install_all_flutter_pods flutter_application_path install_all_flutter_pods flutter_application_path
end end
import UIKit import UIKit
// Prove plugins can be module-imported from the host app.
import device_info
import google_maps_flutter
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
......
...@@ -4,5 +4,6 @@ flutter_application_path = '../hello' ...@@ -4,5 +4,6 @@ flutter_application_path = '../hello'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'Host' do target 'Host' do
use_modular_headers!
install_all_flutter_pods flutter_application_path install_all_flutter_pods flutter_application_path
end end
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=') ...@@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=')
end end
target 'Runner' do target 'Runner' do
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines. # referring to absolute paths on developers' machines.
system('rm -rf .symlinks') system('rm -rf .symlinks')
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
<?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>
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -27,6 +27,8 @@ def parse_KV_file(file,separator='=') ...@@ -27,6 +27,8 @@ def parse_KV_file(file,separator='=')
end end
target 'Runner' do target 'Runner' do
use_modular_headers!
# Flutter Pods # Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR'] pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -7,6 +7,7 @@ install! 'cocoapods', :disable_input_output_paths => true ...@@ -7,6 +7,7 @@ install! 'cocoapods', :disable_input_output_paths => true
target 'Runner' do target 'Runner' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks # Uncomment this line if you're using Swift or would like to use dynamic frameworks
use_frameworks! use_frameworks!
use_modular_headers!
# Pods for Runner # Pods for Runner
pod 'MaterialControls', '~> 1.2.2' pod 'MaterialControls', '~> 1.2.2'
......
#include "AppDelegate.h" #import "AppDelegate.h"
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
@implementation AppDelegate @implementation AppDelegate
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -7,8 +7,11 @@ ...@@ -7,8 +7,11 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface GeneratedPluginRegistrant : NSObject @interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry; + (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end @end
NS_ASSUME_NONNULL_END
#endif /* GeneratedPluginRegistrant_h */ #endif /* GeneratedPluginRegistrant_h */
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -27,6 +27,8 @@ def parse_KV_file(file, separator='=') ...@@ -27,6 +27,8 @@ def parse_KV_file(file, separator='=')
end end
target 'Runner' do target 'Runner' do
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines. # referring to absolute paths on developers' machines.
system('rm -rf .symlinks') system('rm -rf .symlinks')
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
#include "PlatformViewController.h" #import "PlatformViewController.h"
@implementation AppDelegate { @implementation AppDelegate {
FlutterResult _flutterResult; FlutterResult _flutterResult;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -454,10 +454,13 @@ const String _objcPluginRegistryHeaderTemplate = '''// ...@@ -454,10 +454,13 @@ const String _objcPluginRegistryHeaderTemplate = '''//
#import <{{framework}}/{{framework}}.h> #import <{{framework}}/{{framework}}.h>
NS_ASSUME_NONNULL_BEGIN
@interface GeneratedPluginRegistrant : NSObject @interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry; + (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end @end
NS_ASSUME_NONNULL_END
#endif /* GeneratedPluginRegistrant_h */ #endif /* GeneratedPluginRegistrant_h */
'''; ''';
...@@ -466,10 +469,15 @@ const String _objcPluginRegistryImplementationTemplate = '''// ...@@ -466,10 +469,15 @@ const String _objcPluginRegistryImplementationTemplate = '''//
// //
#import "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
{{#plugins}} {{#plugins}}
#if __has_include(<{{name}}/{{class}}.h>)
#import <{{name}}/{{class}}.h> #import <{{name}}/{{class}}.h>
{{/plugins}} #else
@import {{name}};
#endif
{{/plugins}}
@implementation GeneratedPluginRegistrant @implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry { + (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
......
#include "AppDelegate.h" #import "AppDelegate.h"
#include "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=') ...@@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=')
end end
target 'Runner' do target 'Runner' do
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines. # referring to absolute paths on developers' machines.
system('rm -rf .symlinks') system('rm -rf .symlinks')
......
...@@ -34,6 +34,7 @@ end ...@@ -34,6 +34,7 @@ end
target 'Runner' do target 'Runner' do
use_frameworks! use_frameworks!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines. # referring to absolute paths on developers' machines.
......
...@@ -44,6 +44,7 @@ end ...@@ -44,6 +44,7 @@ end
target 'Runner' do target 'Runner' do
use_frameworks! use_frameworks!
use_modular_headers!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines. # referring to absolute paths on developers' machines.
......
#include "AppDelegate.h" #import "AppDelegate.h"
@implementation AppDelegate @implementation AppDelegate
......
...@@ -6,6 +6,8 @@ load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') ...@@ -6,6 +6,8 @@ load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
use_frameworks! use_frameworks!
target 'Runner' do target 'Runner' do
use_modular_headers!
install_flutter_engine_pod install_flutter_engine_pod
install_flutter_plugin_pods flutter_application_path install_flutter_plugin_pods flutter_application_path
end end
......
#include "AppDelegate.h" #import "AppDelegate.h"
#import "FlutterPluginRegistrant/GeneratedPluginRegistrant.h" #import "FlutterPluginRegistrant/GeneratedPluginRegistrant.h"
@implementation AppDelegate @implementation AppDelegate
......
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