From 66a6816b6eee1661470136da24650627460591c2 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Fri, 25 Jun 2021 14:07:50 -0700 Subject: [PATCH] [pigeon] transitioned compilation tests to platform tests (#387) --- packages/pigeon/.gitignore | 2 - packages/pigeon/pigeons/host2flutter.dart | 2 +- packages/pigeon/pigeons/message.dart | 2 +- .../com/example/android_unit_tests/.gitignore | 1 + .../android_unit_tests/AllDatatypes.java | 275 ------------------ .../example/android_unit_tests/Pigeon.java | 181 ------------ .../ios/Runner.xcodeproj/project.pbxproj | 84 ++++-- .../ios_unit_tests/ios/Runner/.gitignore | 2 + .../ios_unit_tests/ios/Runner/all_datatypes.h | 41 --- .../ios_unit_tests/ios/Runner/all_datatypes.m | 149 ---------- .../ios/Runner/async_handlers.h | 32 -- .../ios/Runner/async_handlers.m | 106 ------- .../ios_unit_tests/ios/Runner/enum.h | 37 --- .../ios_unit_tests/ios/Runner/enum.m | 87 ------ .../ios/RunnerTests/AllDatatypesTest.m | 2 +- .../ios/RunnerTests/AsyncHandlersTest.m | 2 +- .../ios_unit_tests/ios/RunnerTests/EnumTest.m | 2 +- .../ios/RunnerTests/RunnerTests.m | 2 +- packages/pigeon/run_tests.sh | 170 ++++------- 19 files changed, 118 insertions(+), 1061 deletions(-) create mode 100644 packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/.gitignore delete mode 100644 packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/AllDatatypes.java delete mode 100644 packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/Pigeon.java create mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/.gitignore delete mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.h delete mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.m delete mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.h delete mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.m delete mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.h delete mode 100644 packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.m diff --git a/packages/pigeon/.gitignore b/packages/pigeon/.gitignore index f0019898d5..5af65c55ee 100644 --- a/packages/pigeon/.gitignore +++ b/packages/pigeon/.gitignore @@ -1,6 +1,4 @@ build/ -platform_tests/ios_unit_tests/ios/Runner/messages.h -platform_tests/ios_unit_tests/ios/Runner/messages.m xcuserdata/ .gradle/ .flutter-plugins diff --git a/packages/pigeon/pigeons/host2flutter.dart b/packages/pigeon/pigeons/host2flutter.dart index 1d62ec5fbf..98f8e1cc09 100644 --- a/packages/pigeon/pigeons/host2flutter.dart +++ b/packages/pigeon/pigeons/host2flutter.dart @@ -6,7 +6,7 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon(PigeonOptions( objcOptions: ObjcOptions( - prefix: 'AC', + prefix: 'H2F', ), )) class SearchRequest { diff --git a/packages/pigeon/pigeons/message.dart b/packages/pigeon/pigeons/message.dart index d6618dba79..2658dc3ea0 100644 --- a/packages/pigeon/pigeons/message.dart +++ b/packages/pigeon/pigeons/message.dart @@ -9,7 +9,7 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon(PigeonOptions( javaOptions: JavaOptions( - className: 'Pigeon', + className: 'MessagePigeon', package: 'dev.flutter.aaclarke.pigeon', ), objcOptions: ObjcOptions( diff --git a/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/.gitignore b/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/.gitignore new file mode 100644 index 0000000000..27d1535693 --- /dev/null +++ b/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/.gitignore @@ -0,0 +1 @@ +*.java diff --git a/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/AllDatatypes.java b/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/AllDatatypes.java deleted file mode 100644 index 684adfd443..0000000000 --- a/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/AllDatatypes.java +++ /dev/null @@ -1,275 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -package com.example.android_unit_tests; - -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.StandardMessageCodec; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) -public class AllDatatypes { - - /** Generated class from Pigeon that represents data sent in messages. */ - public static class Everything { - private Boolean aBool; - - public Boolean getABool() { - return aBool; - } - - public void setABool(Boolean setterArg) { - this.aBool = setterArg; - } - - private Long anInt; - - public Long getAnInt() { - return anInt; - } - - public void setAnInt(Long setterArg) { - this.anInt = setterArg; - } - - private Double aDouble; - - public Double getADouble() { - return aDouble; - } - - public void setADouble(Double setterArg) { - this.aDouble = setterArg; - } - - private String aString; - - public String getAString() { - return aString; - } - - public void setAString(String setterArg) { - this.aString = setterArg; - } - - private byte[] aByteArray; - - public byte[] getAByteArray() { - return aByteArray; - } - - public void setAByteArray(byte[] setterArg) { - this.aByteArray = setterArg; - } - - private int[] a4ByteArray; - - public int[] getA4ByteArray() { - return a4ByteArray; - } - - public void setA4ByteArray(int[] setterArg) { - this.a4ByteArray = setterArg; - } - - private long[] a8ByteArray; - - public long[] getA8ByteArray() { - return a8ByteArray; - } - - public void setA8ByteArray(long[] setterArg) { - this.a8ByteArray = setterArg; - } - - private double[] aFloatArray; - - public double[] getAFloatArray() { - return aFloatArray; - } - - public void setAFloatArray(double[] setterArg) { - this.aFloatArray = setterArg; - } - - private List aList; - - public List getAList() { - return aList; - } - - public void setAList(List setterArg) { - this.aList = setterArg; - } - - private Map aMap; - - public Map getAMap() { - return aMap; - } - - public void setAMap(Map setterArg) { - this.aMap = setterArg; - } - - Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("aBool", aBool); - toMapResult.put("anInt", anInt); - toMapResult.put("aDouble", aDouble); - toMapResult.put("aString", aString); - toMapResult.put("aByteArray", aByteArray); - toMapResult.put("a4ByteArray", a4ByteArray); - toMapResult.put("a8ByteArray", a8ByteArray); - toMapResult.put("aFloatArray", aFloatArray); - toMapResult.put("aList", aList); - toMapResult.put("aMap", aMap); - return toMapResult; - } - - static Everything fromMap(Map map) { - Everything fromMapResult = new Everything(); - Object aBool = map.get("aBool"); - fromMapResult.aBool = (Boolean) aBool; - Object anInt = map.get("anInt"); - fromMapResult.anInt = - (anInt == null) ? null : ((anInt instanceof Integer) ? (Integer) anInt : (Long) anInt); - Object aDouble = map.get("aDouble"); - fromMapResult.aDouble = (Double) aDouble; - Object aString = map.get("aString"); - fromMapResult.aString = (String) aString; - Object aByteArray = map.get("aByteArray"); - fromMapResult.aByteArray = (byte[]) aByteArray; - Object a4ByteArray = map.get("a4ByteArray"); - fromMapResult.a4ByteArray = (int[]) a4ByteArray; - Object a8ByteArray = map.get("a8ByteArray"); - fromMapResult.a8ByteArray = (long[]) a8ByteArray; - Object aFloatArray = map.get("aFloatArray"); - fromMapResult.aFloatArray = (double[]) aFloatArray; - Object aList = map.get("aList"); - fromMapResult.aList = (List) aList; - Object aMap = map.get("aMap"); - fromMapResult.aMap = (Map) aMap; - return fromMapResult; - } - } - - /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ - public static class FlutterEverything { - private final BinaryMessenger binaryMessenger; - - public FlutterEverything(BinaryMessenger argBinaryMessenger) { - this.binaryMessenger = argBinaryMessenger; - } - - public interface Reply { - void reply(T reply); - } - - public void giveMeEverything(Reply callback) { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.FlutterEverything.giveMeEverything", - new StandardMessageCodec()); - channel.send( - null, - channelReply -> { - Map outputMap = (Map) channelReply; - @SuppressWarnings("ConstantConditions") - Everything output = Everything.fromMap(outputMap); - callback.reply(output); - }); - } - - public void echo(Everything argInput, Reply callback) { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.FlutterEverything.echo", - new StandardMessageCodec()); - Map inputMap = argInput.toMap(); - channel.send( - inputMap, - channelReply -> { - Map outputMap = (Map) channelReply; - @SuppressWarnings("ConstantConditions") - Everything output = Everything.fromMap(outputMap); - callback.reply(output); - }); - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface HostEverything { - Everything giveMeEverything(); - - Everything echo(Everything arg); - - /** Sets up an instance of `HostEverything` to handle messages through the `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, HostEverything api) { - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.HostEverything.giveMeEverything", - new StandardMessageCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - Map wrapped = new HashMap<>(); - try { - Everything output = api.giveMeEverything(); - wrapped.put("result", output.toMap()); - } catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.HostEverything.echo", - new StandardMessageCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - Map wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - Everything input = Everything.fromMap((Map) message); - Everything output = api.echo(input); - wrapped.put("result", output.toMap()); - } catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - private static Map wrapError(Throwable exception) { - Map errorMap = new HashMap<>(); - errorMap.put("message", exception.toString()); - errorMap.put("code", exception.getClass().getSimpleName()); - errorMap.put("details", null); - return errorMap; - } -} diff --git a/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/Pigeon.java b/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/Pigeon.java deleted file mode 100644 index 67e1d04510..0000000000 --- a/packages/pigeon/platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/Pigeon.java +++ /dev/null @@ -1,181 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -package com.example.android_unit_tests; - -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.StandardMessageCodec; -import java.util.HashMap; -import java.util.Map; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) -public class Pigeon { - - public enum LoadingState { - loading(0), - complete(1); - - private int index; - - private LoadingState(final int index) { - this.index = index; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static class NestedRequest { - private String context; - - public String getContext() { - return context; - } - - public void setContext(String setterArg) { - this.context = setterArg; - } - - private SetRequest request; - - public SetRequest getRequest() { - return request; - } - - public void setRequest(SetRequest setterArg) { - this.request = setterArg; - } - - Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("context", context); - toMapResult.put("request", request.toMap()); - return toMapResult; - } - - static NestedRequest fromMap(Map map) { - NestedRequest fromMapResult = new NestedRequest(); - Object context = map.get("context"); - fromMapResult.context = (String) context; - Object request = map.get("request"); - fromMapResult.request = SetRequest.fromMap((Map) request); - return fromMapResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static class SetRequest { - private Long value; - - public Long getValue() { - return value; - } - - public void setValue(Long setterArg) { - this.value = setterArg; - } - - private LoadingState state; - - public LoadingState getState() { - return state; - } - - public void setState(LoadingState setterArg) { - this.state = setterArg; - } - - Map toMap() { - Map toMapResult = new HashMap<>(); - toMapResult.put("value", value); - toMapResult.put("state", state.index); - return toMapResult; - } - - static SetRequest fromMap(Map map) { - SetRequest fromMapResult = new SetRequest(); - Object value = map.get("value"); - fromMapResult.value = - (value == null) ? null : ((value instanceof Integer) ? (Integer) value : (Long) value); - Object state = map.get("state"); - fromMapResult.state = LoadingState.values()[(int) state]; - return fromMapResult; - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface NestedApi { - void setValueWithContext(NestedRequest arg); - - /** Sets up an instance of `NestedApi` to handle messages through the `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, NestedApi api) { - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.NestedApi.setValueWithContext", - new StandardMessageCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - Map wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - NestedRequest input = NestedRequest.fromMap((Map) message); - api.setValueWithContext(input); - wrapped.put("result", null); - } catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface Api { - void setValue(SetRequest arg); - - /** Sets up an instance of `Api` to handle messages through the `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, Api api) { - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.Api.setValue", new StandardMessageCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - Map wrapped = new HashMap<>(); - try { - @SuppressWarnings("ConstantConditions") - SetRequest input = SetRequest.fromMap((Map) message); - api.setValue(input); - wrapped.put("result", null); - } catch (Error | RuntimeException exception) { - wrapped.put("error", wrapError(exception)); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - - private static Map wrapError(Throwable exception) { - Map errorMap = new HashMap<>(); - errorMap.put("message", exception.toString()); - errorMap.put("code", exception.getClass().getSimpleName()); - errorMap.put("details", null); - return errorMap; - } -} 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 3b3edc8fda..1c9dd58af6 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 @@ -7,12 +7,18 @@ objects = { /* Begin PBXBuildFile section */ - 0D50126D23FF759100CD5B95 /* messages.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D50126B23FF759100CD5B95 /* messages.m */; }; 0D50127523FF75B100CD5B95 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D50127423FF75B100CD5B95 /* RunnerTests.m */; }; - 0D8C35E825D45A3000B76435 /* async_handlers.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D8C35E725D45A3000B76435 /* async_handlers.m */; }; 0D8C35EB25D45A7900B76435 /* AsyncHandlersTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D8C35EA25D45A7900B76435 /* AsyncHandlersTest.m */; }; - 0DD2E690266FDB7000A7D764 /* enum.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E68F266FDB7000A7D764 /* enum.m */; }; - 0DF4E5C3266ECF0400AEA855 /* all_datatypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DF4E5C2266ECF0400AEA855 /* all_datatypes.m */; }; + 0DD2E6BA2684031300A7D764 /* void_arg_host.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6A62684031200A7D764 /* void_arg_host.gen.m */; }; + 0DD2E6BB2684031300A7D764 /* list.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6A72684031200A7D764 /* list.gen.m */; }; + 0DD2E6BC2684031300A7D764 /* host2flutter.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6AB2684031300A7D764 /* host2flutter.gen.m */; }; + 0DD2E6BD2684031300A7D764 /* async_handlers.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6AF2684031300A7D764 /* async_handlers.gen.m */; }; + 0DD2E6BE2684031300A7D764 /* message.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B02684031300A7D764 /* message.gen.m */; }; + 0DD2E6BF2684031300A7D764 /* enum.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B12684031300A7D764 /* enum.gen.m */; }; + 0DD2E6C02684031300A7D764 /* all_datatypes.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B22684031300A7D764 /* all_datatypes.gen.m */; }; + 0DD2E6C12684031300A7D764 /* voidhost.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B52684031300A7D764 /* voidhost.gen.m */; }; + 0DD2E6C22684031300A7D764 /* voidflutter.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B62684031300A7D764 /* voidflutter.gen.m */; }; + 0DD2E6C32684031300A7D764 /* void_arg_flutter.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B82684031300A7D764 /* void_arg_flutter.gen.m */; }; 0DF4E5C5266ECF4A00AEA855 /* AllDatatypesTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DF4E5C4266ECF4A00AEA855 /* AllDatatypesTest.m */; }; 0DF4E5C8266ED80900AEA855 /* EchoMessenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DF4E5C7266ED80900AEA855 /* EchoMessenger.m */; }; 0DF4E5CB266FDAE300AEA855 /* EnumTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DF4E5CA266FDAE300AEA855 /* EnumTest.m */; }; @@ -49,18 +55,30 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0D50126B23FF759100CD5B95 /* messages.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = messages.m; sourceTree = ""; }; - 0D50126C23FF759100CD5B95 /* messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = messages.h; sourceTree = ""; }; 0D50127223FF75B100CD5B95 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 0D50127423FF75B100CD5B95 /* RunnerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerTests.m; sourceTree = ""; }; 0D50127623FF75B100CD5B95 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 0D8C35E625D45A3000B76435 /* async_handlers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = async_handlers.h; sourceTree = ""; }; - 0D8C35E725D45A3000B76435 /* async_handlers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = async_handlers.m; sourceTree = ""; }; 0D8C35EA25D45A7900B76435 /* AsyncHandlersTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AsyncHandlersTest.m; sourceTree = ""; }; - 0DD2E68E266FDB7000A7D764 /* enum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = enum.h; sourceTree = ""; }; - 0DD2E68F266FDB7000A7D764 /* enum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = enum.m; sourceTree = ""; }; - 0DF4E5C1266ECF0400AEA855 /* all_datatypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = all_datatypes.h; sourceTree = ""; }; - 0DF4E5C2266ECF0400AEA855 /* all_datatypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = all_datatypes.m; sourceTree = ""; }; + 0DD2E6A62684031200A7D764 /* void_arg_host.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = void_arg_host.gen.m; sourceTree = ""; }; + 0DD2E6A72684031200A7D764 /* list.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = list.gen.m; sourceTree = ""; }; + 0DD2E6A82684031200A7D764 /* host2flutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = host2flutter.gen.h; sourceTree = ""; }; + 0DD2E6A92684031200A7D764 /* voidhost.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = voidhost.gen.h; sourceTree = ""; }; + 0DD2E6AA2684031300A7D764 /* all_datatypes.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = all_datatypes.gen.h; sourceTree = ""; }; + 0DD2E6AB2684031300A7D764 /* host2flutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = host2flutter.gen.m; sourceTree = ""; }; + 0DD2E6AC2684031300A7D764 /* void_arg_flutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = void_arg_flutter.gen.h; sourceTree = ""; }; + 0DD2E6AD2684031300A7D764 /* list.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = list.gen.h; sourceTree = ""; }; + 0DD2E6AE2684031300A7D764 /* async_handlers.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = async_handlers.gen.h; sourceTree = ""; }; + 0DD2E6AF2684031300A7D764 /* async_handlers.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = async_handlers.gen.m; sourceTree = ""; }; + 0DD2E6B02684031300A7D764 /* message.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = message.gen.m; sourceTree = ""; }; + 0DD2E6B12684031300A7D764 /* enum.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = enum.gen.m; sourceTree = ""; }; + 0DD2E6B22684031300A7D764 /* all_datatypes.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = all_datatypes.gen.m; sourceTree = ""; }; + 0DD2E6B32684031300A7D764 /* voidflutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = voidflutter.gen.h; sourceTree = ""; }; + 0DD2E6B42684031300A7D764 /* message.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = message.gen.h; sourceTree = ""; }; + 0DD2E6B52684031300A7D764 /* voidhost.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = voidhost.gen.m; sourceTree = ""; }; + 0DD2E6B62684031300A7D764 /* voidflutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = voidflutter.gen.m; sourceTree = ""; }; + 0DD2E6B72684031300A7D764 /* enum.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = enum.gen.h; sourceTree = ""; }; + 0DD2E6B82684031300A7D764 /* void_arg_flutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = void_arg_flutter.gen.m; sourceTree = ""; }; + 0DD2E6B92684031300A7D764 /* void_arg_host.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = void_arg_host.gen.h; sourceTree = ""; }; 0DF4E5C4266ECF4A00AEA855 /* AllDatatypesTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AllDatatypesTest.m; sourceTree = ""; }; 0DF4E5C6266ED80900AEA855 /* EchoMessenger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EchoMessenger.h; sourceTree = ""; }; 0DF4E5C7266ED80900AEA855 /* EchoMessenger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EchoMessenger.m; sourceTree = ""; }; @@ -146,14 +164,26 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 0DD2E68E266FDB7000A7D764 /* enum.h */, - 0DD2E68F266FDB7000A7D764 /* enum.m */, - 0DF4E5C1266ECF0400AEA855 /* all_datatypes.h */, - 0DF4E5C2266ECF0400AEA855 /* all_datatypes.m */, - 0D8C35E625D45A3000B76435 /* async_handlers.h */, - 0D8C35E725D45A3000B76435 /* async_handlers.m */, - 0D50126C23FF759100CD5B95 /* messages.h */, - 0D50126B23FF759100CD5B95 /* messages.m */, + 0DD2E6AA2684031300A7D764 /* all_datatypes.gen.h */, + 0DD2E6B22684031300A7D764 /* all_datatypes.gen.m */, + 0DD2E6AE2684031300A7D764 /* async_handlers.gen.h */, + 0DD2E6AF2684031300A7D764 /* async_handlers.gen.m */, + 0DD2E6B72684031300A7D764 /* enum.gen.h */, + 0DD2E6B12684031300A7D764 /* enum.gen.m */, + 0DD2E6A82684031200A7D764 /* host2flutter.gen.h */, + 0DD2E6AB2684031300A7D764 /* host2flutter.gen.m */, + 0DD2E6AD2684031300A7D764 /* list.gen.h */, + 0DD2E6A72684031200A7D764 /* list.gen.m */, + 0DD2E6B42684031300A7D764 /* message.gen.h */, + 0DD2E6B02684031300A7D764 /* message.gen.m */, + 0DD2E6AC2684031300A7D764 /* void_arg_flutter.gen.h */, + 0DD2E6B82684031300A7D764 /* void_arg_flutter.gen.m */, + 0DD2E6B92684031300A7D764 /* void_arg_host.gen.h */, + 0DD2E6A62684031200A7D764 /* void_arg_host.gen.m */, + 0DD2E6B32684031300A7D764 /* voidflutter.gen.h */, + 0DD2E6B62684031300A7D764 /* voidflutter.gen.m */, + 0DD2E6A92684031200A7D764 /* voidhost.gen.h */, + 0DD2E6B52684031300A7D764 /* voidhost.gen.m */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, @@ -323,13 +353,19 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 0DD2E6BD2684031300A7D764 /* async_handlers.gen.m in Sources */, + 0DD2E6C12684031300A7D764 /* voidhost.gen.m in Sources */, + 0DD2E6BB2684031300A7D764 /* list.gen.m in Sources */, 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, - 0D50126D23FF759100CD5B95 /* messages.m in Sources */, + 0DD2E6C32684031300A7D764 /* void_arg_flutter.gen.m in Sources */, + 0DD2E6C22684031300A7D764 /* voidflutter.gen.m in Sources */, + 0DD2E6C02684031300A7D764 /* all_datatypes.gen.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, - 0DF4E5C3266ECF0400AEA855 /* all_datatypes.m in Sources */, + 0DD2E6BC2684031300A7D764 /* host2flutter.gen.m in Sources */, + 0DD2E6BE2684031300A7D764 /* message.gen.m in Sources */, + 0DD2E6BA2684031300A7D764 /* void_arg_host.gen.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - 0DD2E690266FDB7000A7D764 /* enum.m in Sources */, - 0D8C35E825D45A3000B76435 /* async_handlers.m in Sources */, + 0DD2E6BF2684031300A7D764 /* enum.gen.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/.gitignore b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/.gitignore new file mode 100644 index 0000000000..e5d71dff06 --- /dev/null +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/.gitignore @@ -0,0 +1,2 @@ +*.gen.h +*.gen.m diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.h b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.h deleted file mode 100644 index 47ea60942b..0000000000 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.h +++ /dev/null @@ -1,41 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon -#import -@protocol FlutterBinaryMessenger; -@class FlutterError; -@class FlutterStandardTypedData; - -NS_ASSUME_NONNULL_BEGIN - -@class Everything; - -@interface Everything : NSObject -@property(nonatomic, strong, nullable) NSNumber *aBool; -@property(nonatomic, strong, nullable) NSNumber *anInt; -@property(nonatomic, strong, nullable) NSNumber *aDouble; -@property(nonatomic, copy, nullable) NSString *aString; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *a4ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *a8ByteArray; -@property(nonatomic, strong, nullable) FlutterStandardTypedData *aFloatArray; -@property(nonatomic, strong, nullable) NSArray *aList; -@property(nonatomic, strong, nullable) NSDictionary *aMap; -@end - -@interface FlutterEverything : NSObject -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)giveMeEverything:(void (^)(Everything *, NSError *_Nullable))completion; -- (void)echo:(Everything *)input completion:(void (^)(Everything *, NSError *_Nullable))completion; -@end -@protocol HostEverything -- (nullable Everything *)giveMeEverything:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void HostEverythingSetup(id binaryMessenger, - id _Nullable api); - -NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.m deleted file mode 100644 index 364aececa2..0000000000 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/all_datatypes.m +++ /dev/null @@ -1,149 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon -#import "all_datatypes.h" -#import - -#if !__has_feature(objc_arc) -#error File requires ARC to be enabled. -#endif - -static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { - NSDictionary *errorDict = (NSDictionary *)[NSNull null]; - if (error) { - errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; - } - return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; -} - -@interface Everything () -+ (Everything *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; -@end - -@implementation Everything -+ (Everything *)fromMap:(NSDictionary *)dict { - Everything *result = [[Everything alloc] init]; - result.aBool = dict[@"aBool"]; - if ((NSNull *)result.aBool == [NSNull null]) { - result.aBool = nil; - } - result.anInt = dict[@"anInt"]; - if ((NSNull *)result.anInt == [NSNull null]) { - result.anInt = nil; - } - result.aDouble = dict[@"aDouble"]; - if ((NSNull *)result.aDouble == [NSNull null]) { - result.aDouble = nil; - } - result.aString = dict[@"aString"]; - if ((NSNull *)result.aString == [NSNull null]) { - result.aString = nil; - } - result.aByteArray = dict[@"aByteArray"]; - if ((NSNull *)result.aByteArray == [NSNull null]) { - result.aByteArray = nil; - } - result.a4ByteArray = dict[@"a4ByteArray"]; - if ((NSNull *)result.a4ByteArray == [NSNull null]) { - result.a4ByteArray = nil; - } - result.a8ByteArray = dict[@"a8ByteArray"]; - if ((NSNull *)result.a8ByteArray == [NSNull null]) { - result.a8ByteArray = nil; - } - result.aFloatArray = dict[@"aFloatArray"]; - if ((NSNull *)result.aFloatArray == [NSNull null]) { - result.aFloatArray = nil; - } - result.aList = dict[@"aList"]; - if ((NSNull *)result.aList == [NSNull null]) { - result.aList = nil; - } - result.aMap = dict[@"aMap"]; - if ((NSNull *)result.aMap == [NSNull null]) { - result.aMap = nil; - } - return result; -} -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.aBool ? self.aBool : [NSNull null]), @"aBool", - (self.anInt ? self.anInt : [NSNull null]), @"anInt", - (self.aDouble ? self.aDouble : [NSNull null]), @"aDouble", - (self.aString ? self.aString : [NSNull null]), @"aString", - (self.aByteArray ? self.aByteArray : [NSNull null]), - @"aByteArray", - (self.a4ByteArray ? self.a4ByteArray : [NSNull null]), - @"a4ByteArray", - (self.a8ByteArray ? self.a8ByteArray : [NSNull null]), - @"a8ByteArray", - (self.aFloatArray ? self.aFloatArray : [NSNull null]), - @"aFloatArray", (self.aList ? self.aList : [NSNull null]), - @"aList", (self.aMap ? self.aMap : [NSNull null]), @"aMap", nil]; -} -@end - -@interface FlutterEverything () -@property(nonatomic, strong) NSObject *binaryMessenger; -@end - -@implementation FlutterEverything -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { - self = [super init]; - if (self) { - _binaryMessenger = binaryMessenger; - } - return self; -} - -- (void)giveMeEverything:(void (^)(Everything *, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.FlutterEverything.giveMeEverything" - binaryMessenger:self.binaryMessenger]; - [channel sendMessage:nil - reply:^(id reply) { - NSDictionary *outputMap = reply; - Everything *output = [Everything fromMap:outputMap]; - completion(output, nil); - }]; -} -- (void)echo:(Everything *)input completion:(void (^)(Everything *, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.FlutterEverything.echo" - binaryMessenger:self.binaryMessenger]; - NSDictionary *inputMap = [input toMap]; - [channel sendMessage:inputMap - reply:^(id reply) { - NSDictionary *outputMap = reply; - Everything *output = [Everything fromMap:outputMap]; - completion(output, nil); - }]; -} -@end -void HostEverythingSetup(id binaryMessenger, id api) { - { - FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel - messageChannelWithName:@"dev.flutter.pigeon.HostEverything.giveMeEverything" - binaryMessenger:binaryMessenger]; - if (api) { - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - FlutterError *error; - Everything *output = [api giveMeEverything:&error]; - callback(wrapResult([output toMap], error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.h b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.h deleted file mode 100644 index 877d00b257..0000000000 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.h +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon -#import -@protocol FlutterBinaryMessenger; -@class FlutterError; -@class FlutterStandardTypedData; - -NS_ASSUME_NONNULL_BEGIN - -@class Value; - -@interface Value : NSObject -@property(nonatomic, strong, nullable) NSNumber *number; -@end - -@interface Api2Flutter : NSObject -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)calculate:(Value *)input completion:(void (^)(Value *, NSError *_Nullable))completion; -@end -@protocol Api2Host -- (void)calculate:(nullable Value *)input - completion:(void (^)(Value *_Nullable, FlutterError *_Nullable))completion; -- (void)voidVoid:(void (^)(FlutterError *_Nullable))completion; -@end - -extern void Api2HostSetup(id binaryMessenger, id _Nullable api); - -NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.m deleted file mode 100644 index 26fba7ec22..0000000000 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/async_handlers.m +++ /dev/null @@ -1,106 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon -#import "async_handlers.h" -#import - -#if !__has_feature(objc_arc) -#error File requires ARC to be enabled. -#endif - -static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { - NSDictionary *errorDict = (NSDictionary *)[NSNull null]; - if (error) { - errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; - } - return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; -} - -@interface Value () -+ (Value *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; -@end - -@implementation Value -+ (Value *)fromMap:(NSDictionary *)dict { - Value *result = [[Value alloc] init]; - result.number = dict[@"number"]; - if ((NSNull *)result.number == [NSNull null]) { - result.number = nil; - } - return result; -} -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.number ? self.number : [NSNull null]), @"number", nil]; -} -@end - -@interface Api2Flutter () -@property(nonatomic, strong) NSObject *binaryMessenger; -@end - -@implementation Api2Flutter -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { - self = [super init]; - if (self) { - _binaryMessenger = binaryMessenger; - } - return self; -} - -- (void)calculate:(Value *)input completion:(void (^)(Value *, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.Api2Flutter.calculate" - binaryMessenger:self.binaryMessenger]; - NSDictionary *inputMap = [input toMap]; - [channel sendMessage:inputMap - reply:^(id reply) { - NSDictionary *outputMap = reply; - Value *output = [Value fromMap:outputMap]; - completion(output, nil); - }]; -} -@end -void Api2HostSetup(id binaryMessenger, id api) { - { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.Api2Host.calculate" - binaryMessenger:binaryMessenger]; - if (api) { - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - Value *input = [Value fromMap:message]; - [api calculate:input - completion:^(Value *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult([output toMap], error)); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } - { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.Api2Host.voidVoid" - binaryMessenger:binaryMessenger]; - if (api) { - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api voidVoid:^(FlutterError *_Nullable error) { - callback(error); - }]; - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.h b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.h deleted file mode 100644 index f7c7f18c28..0000000000 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.h +++ /dev/null @@ -1,37 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon -#import -@protocol FlutterBinaryMessenger; -@class FlutterError; -@class FlutterStandardTypedData; - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSUInteger, ACState) { - ACStatePending = 0, - ACStateSuccess = 1, - ACStateError = 2, -}; - -@class ACData; - -@interface ACData : NSObject -@property(nonatomic, assign) ACState state; -@end - -@protocol ACEnumApi2Host -- (nullable ACData *)echo:(ACData *)input error:(FlutterError *_Nullable *_Nonnull)error; -@end - -extern void ACEnumApi2HostSetup(id binaryMessenger, - id _Nullable api); - -@interface ACEnumApi2Flutter : NSObject -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)echo:(ACData *)input completion:(void (^)(ACData *, NSError *_Nullable))completion; -@end -NS_ASSUME_NONNULL_END diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.m deleted file mode 100644 index e34dc08960..0000000000 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner/enum.m +++ /dev/null @@ -1,87 +0,0 @@ -// 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. - -// Autogenerated from Pigeon (v0.2.1), do not edit directly. -// See also: https://pub.dev/packages/pigeon -#import "enum.h" -#import - -#if !__has_feature(objc_arc) -#error File requires ARC to be enabled. -#endif - -static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) { - NSDictionary *errorDict = (NSDictionary *)[NSNull null]; - if (error) { - errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; - } - return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; -} - -@interface ACData () -+ (ACData *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; -@end - -@implementation ACData -+ (ACData *)fromMap:(NSDictionary *)dict { - ACData *result = [[ACData alloc] init]; - result.state = [dict[@"state"] integerValue]; - return result; -} -- (NSDictionary *)toMap { - return [NSDictionary dictionaryWithObjectsAndKeys:@(self.state), @"state", nil]; -} -@end - -void ACEnumApi2HostSetup(id binaryMessenger, id api) { - { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.EnumApi2Host.echo" - binaryMessenger:binaryMessenger]; - if (api) { - [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - ACData *input = [ACData fromMap:message]; - FlutterError *error; - ACData *output = [api echo:input error:&error]; - callback(wrapResult([output toMap], error)); - }]; - } else { - [channel setMessageHandler:nil]; - } - } -} -@interface ACEnumApi2Flutter () -@property(nonatomic, strong) NSObject *binaryMessenger; -@end - -@implementation ACEnumApi2Flutter -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { - self = [super init]; - if (self) { - _binaryMessenger = binaryMessenger; - } - return self; -} - -- (void)echo:(ACData *)input completion:(void (^)(ACData *, NSError *_Nullable))completion { - FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.EnumApi2Flutter.echo" - binaryMessenger:self.binaryMessenger]; - NSDictionary *inputMap = [input toMap]; - [channel sendMessage:inputMap - reply:^(id reply) { - NSDictionary *outputMap = reply; - ACData *output = [ACData fromMap:outputMap]; - completion(output, nil); - }]; -} -@end diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AllDatatypesTest.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AllDatatypesTest.m index 406116d826..5b09ce3040 100644 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AllDatatypesTest.m +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AllDatatypesTest.m @@ -5,7 +5,7 @@ #import #import #import "EchoMessenger.h" -#import "all_datatypes.h" +#import "all_datatypes.gen.h" /////////////////////////////////////////////////////////////////////////////////////////// @interface AllDatatypesTest : XCTestCase diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AsyncHandlersTest.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AsyncHandlersTest.m index 40b2fdc949..88214ae9f3 100644 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AsyncHandlersTest.m +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/AsyncHandlersTest.m @@ -4,7 +4,7 @@ #import #import -#import "async_handlers.h" +#import "async_handlers.gen.h" /////////////////////////////////////////////////////////////////////////////////////////// @interface Value () diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/EnumTest.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/EnumTest.m index a9f85b4279..0cbada0648 100644 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/EnumTest.m +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/EnumTest.m @@ -5,7 +5,7 @@ #import #import #import "EchoMessenger.h" -#import "enum.h" +#import "enum.gen.h" /////////////////////////////////////////////////////////////////////////////////////////// @interface EnumTest : XCTestCase diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/RunnerTests.m b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/RunnerTests.m index 59274d670a..8cff0ce175 100644 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/RunnerTests.m +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/RunnerTests/RunnerTests.m @@ -3,7 +3,7 @@ // found in the LICENSE file. #import -#import "messages.h" +#import "message.gen.h" @interface ACSearchReply () + (ACSearchReply*)fromMap:(NSDictionary*)dict; diff --git a/packages/pigeon/run_tests.sh b/packages/pigeon/run_tests.sh index 592c4cca79..b9e44ac7a9 100755 --- a/packages/pigeon/run_tests.sh +++ b/packages/pigeon/run_tests.sh @@ -53,35 +53,6 @@ mktmpdir() { mktemp -d flutter_pigeon.XXXXXX 2>/dev/null || mktemp -d -t flutter_pigeon. } -# test_pigeon_ios() -# -# Compiles the pigeon file to a temp directory and attempts to compile the objc -# code. -test_pigeon_ios() { - echo "test_pigeon_ios($1)" - temp_dir=$(mktmpdir) - - $run_pigeon \ - --no-dart_null_safety \ - --input $1 \ - --dart_out $temp_dir/pigeon.dart \ - --objc_header_out $temp_dir/pigeon.h \ - --objc_source_out $temp_dir/pigeon.m - - xcrun clang \ - -arch arm64 \ - -isysroot $(xcrun --sdk iphoneos --show-sdk-path) \ - -F $framework_path/Flutter.xcframework/ios-armv7_arm64 \ - -F $framework_path/Flutter.xcframework/ios-armv7 \ - -F $framework_path/Flutter.xcframework/ios-arm64_armv7 \ - -Werror \ - -fobjc-arc \ - -c $temp_dir/pigeon.m \ - -o $temp_dir/pigeon.o - - rm -rf $temp_dir -} - # test_pigeon_android() # # Compiles the pigeon file to a temp directory and attempts to compile the java @@ -158,6 +129,33 @@ flags: " } +gen_ios_unittests_code() { + local input=$1 + local prefix=$2 + local filename=${input##*/} + local name="${filename%.dart}" + $run_pigeon \ + --input $input \ + --objc_prefix "$prefix" \ + --dart_out /dev/null \ + --objc_header_out platform_tests/ios_unit_tests/ios/Runner/$name.gen.h \ + --objc_source_out platform_tests/ios_unit_tests/ios/Runner/$name.gen.m +} + +gen_android_unittests_code() { + local input=$1 + local javaName=$2 + local javaOut="platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/$javaName.java" + $run_pigeon \ + --input $input \ + --dart_out /dev/null \ + --java_out $javaOut \ + --java_package "com.example.android_unit_tests" + + java -jar ci/$java_formatter --replace $javaOut + java -jar ci/$java_linter -c "ci/$google_checks" "$javaOut" +} + ############################################################################### # Stages ############################################################################### @@ -242,74 +240,17 @@ run_dart_compilation_tests() { test_pigeon_dart ./pigeons/voidhost.dart } -run_java_compilation_tests() { - # DEPRECATED: These tests are deprecated, use run_android_unittests instead. - # Make sure the artifacts are present. - flutter precache - # Make sure flutter dependencies are available. - pushd $PWD - # We use e2e_tests/test_objc in order to get access to Flutter. - cd e2e_tests/test_objc/ - flutter pub get - popd - test_pigeon_android ./pigeons/async_handlers.dart - test_pigeon_android ./pigeons/host2flutter.dart - test_pigeon_android ./pigeons/java_double_host_api.dart - test_pigeon_android ./pigeons/list.dart - test_pigeon_android ./pigeons/message.dart - test_pigeon_android ./pigeons/void_arg_flutter.dart - test_pigeon_android ./pigeons/void_arg_host.dart - test_pigeon_android ./pigeons/voidflutter.dart - test_pigeon_android ./pigeons/voidhost.dart -} - -run_objc_compilation_tests() { - # DEPRECATED: These tests are deprecated, use run_ios_unittests instead. - # Make sure the artifacts are present. - flutter precache - test_pigeon_ios ./pigeons/async_handlers.dart - test_pigeon_ios ./pigeons/host2flutter.dart - test_pigeon_ios ./pigeons/list.dart - test_pigeon_ios ./pigeons/message.dart - test_pigeon_ios ./pigeons/void_arg_flutter.dart - test_pigeon_ios ./pigeons/void_arg_host.dart - test_pigeon_ios ./pigeons/voidflutter.dart - test_pigeon_ios ./pigeons/voidhost.dart -} - run_ios_unittests() { - $run_pigeon \ - --no-dart_null_safety \ - --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 - $run_pigeon \ - --no-dart_null_safety \ - --input pigeons/async_handlers.dart \ - --dart_out /dev/null \ - --objc_header_out platform_tests/ios_unit_tests/ios/Runner/async_handlers.h \ - --objc_source_out platform_tests/ios_unit_tests/ios/Runner/async_handlers.m - clang-format -i platform_tests/ios_unit_tests/ios/Runner/async_handlers.h - clang-format -i platform_tests/ios_unit_tests/ios/Runner/async_handlers.m - $run_pigeon \ - --no-dart_null_safety \ - --input pigeons/all_datatypes.dart \ - --dart_out /dev/null \ - --objc_header_out platform_tests/ios_unit_tests/ios/Runner/all_datatypes.h \ - --objc_source_out platform_tests/ios_unit_tests/ios/Runner/all_datatypes.m - clang-format -i platform_tests/ios_unit_tests/ios/Runner/all_datatypes.h - clang-format -i platform_tests/ios_unit_tests/ios/Runner/all_datatypes.m - $run_pigeon \ - --input pigeons/enum.dart \ - --objc_prefix AC \ - --dart_out /dev/null \ - --objc_header_out platform_tests/ios_unit_tests/ios/Runner/enum.h \ - --objc_source_out platform_tests/ios_unit_tests/ios/Runner/enum.m - clang-format -i platform_tests/ios_unit_tests/ios/Runner/enum.h - clang-format -i platform_tests/ios_unit_tests/ios/Runner/enum.m + gen_ios_unittests_code ./pigeons/all_datatypes.dart "" + gen_ios_unittests_code ./pigeons/async_handlers.dart "" + gen_ios_unittests_code ./pigeons/enum.dart "AC" + gen_ios_unittests_code ./pigeons/host2flutter.dart "" + gen_ios_unittests_code ./pigeons/list.dart "LST" + gen_ios_unittests_code ./pigeons/message.dart "" + gen_ios_unittests_code ./pigeons/void_arg_flutter.dart "VAF" + gen_ios_unittests_code ./pigeons/void_arg_host.dart "VAH" + gen_ios_unittests_code ./pigeons/voidflutter.dart "VF" + gen_ios_unittests_code ./pigeons/voidhost.dart "VH" pushd $PWD cd platform_tests/ios_unit_tests flutter build ios --simulator @@ -356,16 +297,17 @@ run_formatter() { run_android_unittests() { pushd $PWD - $run_pigeon \ - --input pigeons/android_unittests.dart \ - --dart_out /dev/null \ - --java_out platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/Pigeon.java \ - --java_package "com.example.android_unit_tests" - $run_pigeon \ - --input pigeons/all_datatypes.dart \ - --dart_out /dev/null \ - --java_out platform_tests/android_unit_tests/android/app/src/main/java/com/example/android_unit_tests/AllDatatypes.java \ - --java_package "com.example.android_unit_tests" + gen_android_unittests_code ./pigeons/all_datatypes.dart AllDatatypes + gen_android_unittests_code ./pigeons/android_unittests.dart Pigeon + gen_android_unittests_code ./pigeons/async_handlers.dart AsyncHandlers + gen_android_unittests_code ./pigeons/host2flutter.dart Host2Flutter + gen_android_unittests_code ./pigeons/java_double_host_api.dart JavaDoubleHostApi + gen_android_unittests_code ./pigeons/list.dart PigeonList + gen_android_unittests_code ./pigeons/message.dart MessagePigeon + gen_android_unittests_code ./pigeons/void_arg_flutter.dart VoidArgFlutter + gen_android_unittests_code ./pigeons/void_arg_host.dart VoidArgHost + gen_android_unittests_code ./pigeons/voidflutter.dart VoidFlutter + gen_android_unittests_code ./pigeons/voidhost.dart VoidHost cd platform_tests/android_unit_tests if [ ! -f "android/gradlew" ]; then flutter build apk --debug @@ -385,9 +327,7 @@ should_run_flutter_unittests=true should_run_formatter=true should_run_ios_e2e_tests=true should_run_ios_unittests=true -should_run_java_compilation_tests=true should_run_mock_handler_tests=true -should_run_objc_compilation_tests=true while getopts "t:l?h" opt; do case $opt in t) @@ -398,9 +338,7 @@ while getopts "t:l?h" opt; do should_run_formatter=false should_run_ios_e2e_tests=false should_run_ios_unittests=false - should_run_java_compilation_tests=false should_run_mock_handler_tests=false - should_run_objc_compilation_tests=false case $OPTARG in android_unittests) should_run_android_unittests=true ;; dart_compilation_tests) should_run_dart_compilation_tests=true ;; @@ -408,9 +346,7 @@ while getopts "t:l?h" opt; do flutter_unittests) should_run_flutter_unittests=true ;; ios_e2e_tests) should_run_ios_e2e_tests=true ;; ios_unittests) should_run_ios_unittests=true ;; - java_compilation_tests) should_run_java_compilation_tests=true ;; mock_handler_tests) should_run_mock_handler_tests=true ;; - objc_compilation_tests) should_run_objc_compilation_tests=true ;; *) echo "unrecognized test: $OPTARG" exit 1 @@ -425,9 +361,7 @@ while getopts "t:l?h" opt; do flutter_unittests - Unit tests on generated Dart code. ios_e2e_tests - End-to-end objc tests run on iOS Simulator ios_unittests - Unit tests on generated Objc code. - java_compilation_tests - Compilation tests on generated Java code. mock_handler_tests - Unit tests on generated Dart mock handler code. - objc_compilation_tests - Compilation tests on generated Objc code. " exit 1 ;; @@ -449,7 +383,7 @@ done ############################################################################## pub get dart --snapshot-kind=kernel --snapshot=bin/pigeon.dart.dill bin/pigeon.dart -if [ "$should_run_java_compilation_tests" = true ]; then +if [ "$should_run_android_unittests" = true ]; then get_java_linter_formatter fi test_running_without_arguments @@ -465,12 +399,6 @@ fi if [ "$should_run_dart_compilation_tests" = true ]; then run_dart_compilation_tests fi -if [ "$should_run_java_compilation_tests" = true ]; then - run_java_compilation_tests -fi -if [ "$should_run_objc_compilation_tests" = true ]; then - run_objc_compilation_tests -fi if [ "$should_run_ios_unittests" = true ]; then run_ios_unittests fi