diff --git a/packages/pigeon/e2e_tests/test_objc/android/app/src/main/java/io/flutter/plugins/Dartle.java b/packages/pigeon/e2e_tests/test_objc/android/app/src/main/java/io/flutter/plugins/Dartle.java new file mode 100644 index 000000000000..2cbb0c15288b --- /dev/null +++ b/packages/pigeon/e2e_tests/test_objc/android/app/src/main/java/io/flutter/plugins/Dartle.java @@ -0,0 +1,222 @@ +// Autogenerated from Pigeon (v0.1.0-experimental.9), do not edit directly. +// See also: https://pub.dev/packages/pigeon + +package dev.flutter.aaclarke.pigeon; + +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.StandardMessageCodec; +import java.util.HashMap; + +/** Generated class from Pigeon. */ +public class Dartle { + + /** Generated class from Pigeon that represents data sent in messages. */ + public static class SearchReply { + private String result; + + public String getResult() { + return result; + } + + public void setResult(String setterArg) { + this.result = setterArg; + } + + private String error; + + public String getError() { + return error; + } + + public void setError(String setterArg) { + this.error = setterArg; + } + + HashMap toMap() { + HashMap toMapResult = new HashMap(); + toMapResult.put("result", result); + toMapResult.put("error", error); + return toMapResult; + } + + static SearchReply fromMap(HashMap map) { + SearchReply fromMapResult = new SearchReply(); + fromMapResult.result = (String) map.get("result"); + fromMapResult.error = (String) map.get("error"); + return fromMapResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static class SearchRequest { + private String query; + + public String getQuery() { + return query; + } + + public void setQuery(String setterArg) { + this.query = setterArg; + } + + private Long anInt; + + public Long getAnInt() { + return anInt; + } + + public void setAnInt(Long setterArg) { + this.anInt = setterArg; + } + + private Boolean aBool; + + public Boolean getABool() { + return aBool; + } + + public void setABool(Boolean setterArg) { + this.aBool = setterArg; + } + + HashMap toMap() { + HashMap toMapResult = new HashMap(); + toMapResult.put("query", query); + toMapResult.put("anInt", anInt); + toMapResult.put("aBool", aBool); + return toMapResult; + } + + static SearchRequest fromMap(HashMap map) { + SearchRequest fromMapResult = new SearchRequest(); + fromMapResult.query = (String) map.get("query"); + fromMapResult.anInt = + (map.get("anInt") instanceof Integer) + ? (Integer) map.get("anInt") + : (Long) map.get("anInt"); + fromMapResult.aBool = (Boolean) map.get("aBool"); + return fromMapResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static class Nested { + private SearchRequest request; + + public SearchRequest getRequest() { + return request; + } + + public void setRequest(SearchRequest setterArg) { + this.request = setterArg; + } + + HashMap toMap() { + HashMap toMapResult = new HashMap(); + toMapResult.put("request", request); + return toMapResult; + } + + static Nested fromMap(HashMap map) { + Nested fromMapResult = new Nested(); + fromMapResult.request = (SearchRequest) map.get("request"); + return fromMapResult; + } + } + + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ + public static class FlutterSearchApi { + private BinaryMessenger binaryMessenger; + + public FlutterSearchApi(BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + public interface Reply { + void reply(T reply); + } + + public void search(SearchRequest argInput, Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.FlutterSearchApi.search", + new StandardMessageCodec()); + HashMap inputMap = argInput.toMap(); + channel.send( + inputMap, + new BasicMessageChannel.Reply() { + public void reply(Object channelReply) { + HashMap outputMap = (HashMap) channelReply; + SearchReply output = SearchReply.fromMap(outputMap); + callback.reply(output); + } + }); + } + } + + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ + public interface NestedApi { + SearchReply search(Nested arg); + + /** Sets up an instance of `NestedApi` to handle messages through the `binaryMessenger` */ + public static void setup(BinaryMessenger binaryMessenger, NestedApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.NestedApi.search", new StandardMessageCodec()); + channel.setMessageHandler( + new BasicMessageChannel.MessageHandler() { + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + Nested input = Nested.fromMap((HashMap) message); + HashMap wrapped = new HashMap(); + try { + SearchReply output = api.search(input); + wrapped.put("result", output.toMap()); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + } + }); + } + } + } + + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ + public interface Api { + SearchReply search(SearchRequest arg); + + /** Sets up an instance of `Api` to handle messages through the `binaryMessenger` */ + public static void setup(BinaryMessenger binaryMessenger, Api api) { + { + BasicMessageChannel channel = + new BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.Api.search", new StandardMessageCodec()); + channel.setMessageHandler( + new BasicMessageChannel.MessageHandler() { + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + SearchRequest input = SearchRequest.fromMap((HashMap) message); + HashMap wrapped = new HashMap(); + try { + SearchReply output = api.search(input); + wrapped.put("result", output.toMap()); + } catch (Exception exception) { + wrapped.put("error", wrapError(exception)); + } + reply.reply(wrapped); + } + }); + } + } + } + + private static HashMap wrapError(Exception exception) { + HashMap errorMap = new HashMap(); + errorMap.put("message", exception.toString()); + errorMap.put("code", null); + errorMap.put("details", null); + return errorMap; + } +} diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner.xcodeproj/project.pbxproj b/packages/pigeon/e2e_tests/test_objc/ios/Runner.xcodeproj/project.pbxproj index d8ec4073b545..ec36ad09c2bc 100644 --- a/packages/pigeon/e2e_tests/test_objc/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 0D74DF16246C6DAB00400EBA /* MyEngineControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D74DF15246C6DAB00400EBA /* MyEngineControl.m */; }; + 0D74DF19246C780F00400EBA /* MyPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D74DF18246C780F00400EBA /* MyPlugin.m */; }; 0D89130E23C8F951005E0326 /* dartle.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D89130D23C8F951005E0326 /* dartle.m */; }; 0D89131123C8FB14005E0326 /* MyFlutterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D89131023C8FB14005E0326 /* MyFlutterViewController.m */; }; 0D89131423C8FCD2005E0326 /* MyApi.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D89131323C8FCD2005E0326 /* MyApi.m */; }; @@ -46,6 +48,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0D74DF14246C6DAB00400EBA /* MyEngineControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyEngineControl.h; sourceTree = ""; }; + 0D74DF15246C6DAB00400EBA /* MyEngineControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyEngineControl.m; sourceTree = ""; }; + 0D74DF17246C780F00400EBA /* MyPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyPlugin.h; sourceTree = ""; }; + 0D74DF18246C780F00400EBA /* MyPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyPlugin.m; sourceTree = ""; }; 0D89130C23C8F951005E0326 /* dartle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dartle.h; sourceTree = ""; }; 0D89130D23C8F951005E0326 /* dartle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = dartle.m; sourceTree = ""; }; 0D89130F23C8FB14005E0326 /* MyFlutterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyFlutterViewController.h; sourceTree = ""; }; @@ -175,6 +181,10 @@ 0D89131323C8FCD2005E0326 /* MyApi.m */, 0DA878AE2453583800622EF2 /* MyNestedApi.h */, 0DA878AF2453583800622EF2 /* MyNestedApi.m */, + 0D74DF14246C6DAB00400EBA /* MyEngineControl.h */, + 0D74DF15246C6DAB00400EBA /* MyEngineControl.m */, + 0D74DF17246C780F00400EBA /* MyPlugin.h */, + 0D74DF18246C780F00400EBA /* MyPlugin.m */, ); path = Runner; sourceTree = ""; @@ -371,12 +381,14 @@ buildActionMask = 2147483647; files = ( 0D89131423C8FCD2005E0326 /* MyApi.m in Sources */, + 0D74DF16246C6DAB00400EBA /* MyEngineControl.m in Sources */, 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 0D89130E23C8F951005E0326 /* dartle.m in Sources */, 0D89131123C8FB14005E0326 /* MyFlutterViewController.m in Sources */, 0DA878B02453583800622EF2 /* MyNestedApi.m in Sources */, + 0D74DF19246C780F00400EBA /* MyPlugin.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyApi.h b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyApi.h index 68940a979079..0157ca27936a 100644 --- a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyApi.h +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyApi.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN /// Implementation of the Pigeon generated interface Api. -@interface MyApi : NSObject +@interface MyApi : NSObject @end NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyEngineControl.h b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyEngineControl.h new file mode 100644 index 000000000000..efa8ee4b5f14 --- /dev/null +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyEngineControl.h @@ -0,0 +1,14 @@ +// Copyright 2013 The Flutter 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 +#import "dartle.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MyEngineControl : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyEngineControl.m b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyEngineControl.m new file mode 100644 index 000000000000..daffe12a32bc --- /dev/null +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyEngineControl.m @@ -0,0 +1,22 @@ +// Copyright 2013 The Flutter 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 "MyEngineControl.h" +#import "MyPlugin.h" + +#if !__has_feature(objc_arc) +#error ARC must be enabled! +#endif + +@implementation MyEngineControl +- (void)createDestroyContextThenDeallocEngine:(FlutterError* _Nullable* _Nonnull)error { + @autoreleasepool { + FlutterEngine* engine = + [[FlutterEngine alloc] initWithName:@"createDestroyContextThenDeallocEngine"]; + [engine run]; + [MyPlugin registerWithRegistrar:[engine registrarForPlugin:@"MyPlugin"]]; + [engine destroyContext]; + } +} +@end diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyFlutterViewController.m b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyFlutterViewController.m index 5994306ac055..dfe846baff83 100644 --- a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyFlutterViewController.m +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyFlutterViewController.m @@ -1,5 +1,6 @@ #import "MyFlutterViewController.h" #import "MyApi.h" +#import "MyEngineControl.h" #import "MyNestedApi.h" #import "dartle.h" @@ -12,6 +13,7 @@ - (void)viewDidLoad { [super viewDidLoad]; ACApiSetup(self.engine.binaryMessenger, [[MyApi alloc] init]); ACNestedApiSetup(self.engine.binaryMessenger, [[MyNestedApi alloc] init]); + ACEngineControlSetup(self.engine.binaryMessenger, [[MyEngineControl alloc] init]); } @end diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyNestedApi.h b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyNestedApi.h index 4dd1e2615514..91159db2e973 100644 --- a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyNestedApi.h +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyNestedApi.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN /// Implementation of the Pigeon generated interface NestedApi. -@interface MyNestedApi : NSObject +@interface MyNestedApi : NSObject - (ACSearchReply *)search:(ACNested *)input error:(FlutterError *_Nullable *_Nonnull)error; @end diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyPlugin.h b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyPlugin.h new file mode 100644 index 000000000000..14cf636ece0b --- /dev/null +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyPlugin.h @@ -0,0 +1,14 @@ +// Copyright 2013 The Flutter 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 +#import "MyApi.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MyPlugin : NSObject +- (instancetype)initWithRegistrar:(nonnull NSObject *)registrar; +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyPlugin.m b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyPlugin.m new file mode 100644 index 000000000000..6cf5e3c5a80c --- /dev/null +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/MyPlugin.m @@ -0,0 +1,30 @@ +// Copyright 2013 The Flutter 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 "MyPlugin.h" + + +@implementation MyPlugin + ++ (void)registerWithRegistrar:(nonnull NSObject *)registrar { + MyPlugin* instance = [[MyPlugin alloc] initWithRegistrar:registrar]; + [registrar publish:instance]; + ACApiSetup(registrar.messenger, instance); +} + +- (instancetype)initWithRegistrar:(nonnull NSObject *)registrar { + self = [super init]; + return self; +} + +- (nonnull ACSearchReply *)search:(nonnull ACSearchRequest *)input error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + ACSearchReply* reply = [[ACSearchReply alloc] init]; + return reply; +} + +- (void)detachFromEngineForRegistrar:(NSObject*)registrar { + ACApiSetup(registrar.messenger, nil); +} + +@end diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.h b/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.h index 91d45fa85257..e26045c3f25c 100644 --- a/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.h +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.h @@ -26,6 +26,13 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, strong, nullable) ACSearchRequest *request; @end +@protocol ACEngineControl +- (void)createDestroyContextThenDeallocEngine:(FlutterError *_Nullable *_Nonnull)error; +@end + +extern void ACEngineControlSetup(id binaryMessenger, + id api); + @interface ACFlutterSearchApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; - (void)search:(ACSearchRequest *)input completion:(void (^)(ACSearchReply *, NSError *))completion; diff --git a/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.m b/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.m index 05c5b1721659..9d1796f17bff 100644 --- a/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.m +++ b/packages/pigeon/e2e_tests/test_objc/ios/Runner/dartle.m @@ -94,6 +94,23 @@ - (NSDictionary *)toMap { } @end +void ACEngineControlSetup(id binaryMessenger, id api) { + { + FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel + messageChannelWithName: + @"dev.flutter.pigeon.EngineControl.createDestroyContextThenDeallocEngine" + binaryMessenger:binaryMessenger]; + if (api) { + [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { + FlutterError *error; + [api createDestroyContextThenDeallocEngine:&error]; + callback(wrapResult(nil, error)); + }]; + } else { + [channel setMessageHandler:nil]; + } + } +} @interface ACFlutterSearchApi () @property(nonatomic, strong) NSObject *binaryMessenger; @end diff --git a/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart b/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart index cb9f3b9493e9..df5797dc6c46 100644 --- a/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart +++ b/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart @@ -64,6 +64,30 @@ class Nested { } } +class EngineControl { + Future createDestroyContextThenDeallocEngine() async { + const BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.EngineControl.createDestroyContextThenDeallocEngine', + StandardMessageCodec()); + + final Map replyMap = await channel.send(null); + if (replyMap == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + details: null); + } else if (replyMap['error'] != null) { + final Map error = replyMap['error']; + throw PlatformException( + code: error['code'], + message: error['message'], + details: error['details']); + } else { + // noop + } + } +} + abstract class FlutterSearchApi { SearchReply search(SearchRequest arg); } diff --git a/packages/pigeon/e2e_tests/test_objc/test_driver/e2e_test.dart b/packages/pigeon/e2e_tests/test_objc/test_driver/e2e_test.dart index e97639adb67c..ef47cbe46828 100644 --- a/packages/pigeon/e2e_tests/test_objc/test_driver/e2e_test.dart +++ b/packages/pigeon/e2e_tests/test_objc/test_driver/e2e_test.dart @@ -28,4 +28,9 @@ void main() { }, throwsException); expect(reply, isNull); }); + + testWidgets('CreateDestoryContextDeallocEngine', (WidgetTester tester) async { + EngineControl engineControl = EngineControl(); + await engineControl.createDestroyContextThenDeallocEngine(); + }); } diff --git a/packages/pigeon/pigeons/message.dart b/packages/pigeon/pigeons/message.dart index 955836642ba7..a816a95cd575 100644 --- a/packages/pigeon/pigeons/message.dart +++ b/packages/pigeon/pigeons/message.dart @@ -38,3 +38,8 @@ void configurePigeon(PigeonOptions options) { abstract class FlutterSearchApi { SearchReply search(SearchRequest request); } + +@HostApi() +abstract class EngineControl { + void createDestroyContextThenDeallocEngine(); +} diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/.last_build_id b/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/.last_build_id new file mode 100644 index 000000000000..4492d5ab9f8a --- /dev/null +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Flutter/.last_build_id @@ -0,0 +1 @@ +4fa9a3419efd8b1c4223f3bc2ab69687 \ No newline at end of file diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj index f285dc91805e..20ab37a48ec5 100644 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj @@ -11,10 +11,6 @@ 0D50127523FF75B100CD5B95 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D50127423FF75B100CD5B95 /* RunnerTests.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -39,8 +35,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -56,13 +50,11 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -83,8 +75,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,9 +93,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -271,7 +259,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -408,7 +396,6 @@ }; 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -482,7 +469,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -538,7 +524,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/packages/pigeon/run_tests.sh b/packages/pigeon/run_tests.sh index c04296a8d279..6f59ae6609cb 100755 --- a/packages/pigeon/run_tests.sh +++ b/packages/pigeon/run_tests.sh @@ -1,10 +1,16 @@ # exit when any command fails set -e +############################################################ +# Variable Initialization +############################################################ flutter=$(which flutter) flutter_bin=$(dirname $flutter) framework_path="$flutter_bin/cache/artifacts/engine/ios/" +############################################################ +# Helper Functions +############################################################ test_pigeon_ios() { temp_dir=$(mktemp -d -t pigeon) @@ -48,6 +54,9 @@ test_pigeon_android() { rm -rf $temp_dir } +############################################################ +# Compilation Tests +############################################################ pub run test test/ test_pigeon_android ./pigeons/voidflutter.dart test_pigeon_android ./pigeons/voidhost.dart @@ -62,6 +71,29 @@ test_pigeon_ios ./pigeons/voidflutter.dart test_pigeon_ios ./pigeons/void_arg_host.dart test_pigeon_ios ./pigeons/void_arg_flutter.dart +############################################################ +# iOS unit tests +############################################################ +pub run pigeon \ + --input pigeons/message.dart \ + --dart_out /dev/null \ + --objc_header_out platform_tests/ios_unit_tests/ios/Runner/messages.h \ + --objc_source_out platform_tests/ios_unit_tests/ios/Runner/messages.m +clang-format -i platform_tests/ios_unit_tests/ios/Runner/messages.h +clang-format -i platform_tests/ios_unit_tests/ios/Runner/messages.m +pushd $PWD +cd platform_tests/ios_unit_tests/ios/ +xcodebuild \ + -workspace Runner.xcworkspace \ + -scheme RunnerTests \ + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 8' \ + test | xcpretty +popd + +############################################################ +# iOS e2e tests +############################################################ DARTLE_H="e2e_tests/test_objc/ios/Runner/dartle.h" DARTLE_M="e2e_tests/test_objc/ios/Runner/dartle.m" DARTLE_DART="e2e_tests/test_objc/lib/dartle.dart" @@ -84,5 +116,8 @@ xcodebuild \ test | xcpretty popd +############################################################ +# Formatting generated code +############################################################ cd ../.. -pub global activate flutter_plugin_tools && pub global run flutter_plugin_tools format \ No newline at end of file +pub global activate flutter_plugin_tools && pub global run flutter_plugin_tools format