mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
[pigeon] Use a shared generation step for platform_tests/ (#2823)
* Reorganize process helpers to reduce duplicate code * Add wrappers for common process commands * WIP generation consolidation * Re-add the Java special casing that the bash version did * Fix gradlew check * Add ignores for Dart for now * Update README * Typo fix * Autoformat * Fix Windows * Windows command fix * Try returning to runInShell:true to see if that fixes the CI hang * Revert more of _runWindowsUnitTests for CI debugging * Add missed early return for failure * Verbose build, and disable Dart generation to further reduce differences * Revert "Verbose build, and disable Dart generation to further reduce differences" This reverts commit ddfbf8b7162169c9bbd46736b3809adb7cdd92ca. * Revert "Revert more of _runWindowsUnitTests for CI debugging" This reverts commit e4e867cdf29c2886dd3dadc787c42ecb0c8720bc. * Revert "Try returning to runInShell:true to see if that fixes the CI hang" This reverts commit a124e08534e6a5af9e9e10ed6b2ccb96fa62ac9d. * Fix Windows includes
This commit is contained in:
@ -5,7 +5,11 @@ of Pigeon-generated code. The [test script](../tool/run_tests.dart) generates
|
||||
native code from [pigeons/](../pigeons/) into the native test scaffolding, and
|
||||
then drives the tests there.
|
||||
|
||||
To run these tests, use [`run_tests.dart`](../tool/run_tests.dart)
|
||||
To run these tests, use [`run_tests.dart`](../tool/run_tests.dart).
|
||||
|
||||
Alternately, if you are running them directly (e.g., from within a platform
|
||||
IDE), you can use [`generate.dart`](../tool/generate.dart) to generate the
|
||||
necessary Pigeon output.
|
||||
|
||||
## test\_plugin
|
||||
|
||||
|
9
packages/pigeon/platform_tests/alternate_language_test_plugin/lib/.gitignore
vendored
Normal file
9
packages/pigeon/platform_tests/alternate_language_test_plugin/lib/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# TODO(stuartmorgan): Remove this, so that review will show the effects of
|
||||
# changes on generated files. This will need a way to avoid unnecessary churn,
|
||||
# such as a flag to suppress version stamp generation.
|
||||
*.gen.dart
|
||||
# TODO(stuartmorgan): Add exceptions for specific files that are used in
|
||||
# integration tests, as they will need to be checked in to avoid analysis
|
||||
# failures. The exclusion of other files is to prevent having multiple
|
||||
# copies of all of the Dart output until more tests are restructured to
|
||||
# minimize duplication.
|
@ -7,31 +7,31 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0D02163D27BC7B48009BD76F /* nullable_returns.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D02163C27BC7B48009BD76F /* nullable_returns.gen.m */; };
|
||||
0D21E59A27D0502D0051D07D /* background_platform_channels.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D21E59827D0502D0051D07D /* background_platform_channels.gen.m */; };
|
||||
0D02163D27BC7B48009BD76F /* NullableReturns.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D02163C27BC7B48009BD76F /* NullableReturns.gen.m */; };
|
||||
0D21E59A27D0502D0051D07D /* BackgroundPlatformChannels.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D21E59827D0502D0051D07D /* BackgroundPlatformChannels.gen.m */; };
|
||||
0D36469D27C6BE3C0069B7BF /* NullableReturnsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D36469C27C6BE3C0069B7BF /* NullableReturnsTest.m */; };
|
||||
0D3646A027C6DCEC0069B7BF /* MockBinaryMessenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D36469F27C6DCEC0069B7BF /* MockBinaryMessenger.m */; };
|
||||
0D50127523FF75B100CD5B95 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D50127423FF75B100CD5B95 /* RunnerTests.m */; };
|
||||
0D6FD3C526A76D400046D8BD /* primitive.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6FD3C426A76D400046D8BD /* primitive.gen.m */; };
|
||||
0D6FD3C526A76D400046D8BD /* Primitive.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6FD3C426A76D400046D8BD /* Primitive.gen.m */; };
|
||||
0D6FD3C726A777C00046D8BD /* PrimitiveTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6FD3C626A777C00046D8BD /* PrimitiveTest.m */; };
|
||||
0D7A910A268D4A050056B5E1 /* ListTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D7A9109268D4A050056B5E1 /* ListTest.m */; };
|
||||
0D7A910D268E5D700056B5E1 /* all_void.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D7A910C268E5D700056B5E1 /* all_void.gen.m */; };
|
||||
0D7A910D268E5D700056B5E1 /* AllVoid.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D7A910C268E5D700056B5E1 /* AllVoid.gen.m */; };
|
||||
0D8C35EB25D45A7900B76435 /* AsyncHandlersTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D8C35EA25D45A7900B76435 /* AsyncHandlersTest.m */; };
|
||||
0DA5DFD626CC39D600D2354B /* multiple_arity.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DA5DFD526CC39D600D2354B /* multiple_arity.gen.m */; };
|
||||
0DA5DFD626CC39D600D2354B /* MultipleArity.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DA5DFD526CC39D600D2354B /* MultipleArity.gen.m */; };
|
||||
0DA5DFD826CC3A2100D2354B /* MultipleArityTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DA5DFD726CC3A2100D2354B /* MultipleArityTest.m */; };
|
||||
0DA5DFDB26CC3B3700D2354B /* HandlerBinaryMessenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DA5DFDA26CC3B3700D2354B /* HandlerBinaryMessenger.m */; };
|
||||
0DBD8C3E279B73F700E4FDBA /* NonNullFieldsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DBD8C3D279B73F700E4FDBA /* NonNullFieldsTest.m */; };
|
||||
0DBD8C41279B741800E4FDBA /* non_null_fields.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DBD8C3F279B741800E4FDBA /* non_null_fields.gen.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 */; };
|
||||
0DBD8C41279B741800E4FDBA /* NonNullFields.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DBD8C3F279B741800E4FDBA /* NonNullFields.gen.m */; };
|
||||
0DD2E6BA2684031300A7D764 /* VoidArgHost.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6A62684031200A7D764 /* VoidArgHost.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 /* AsyncHandlers.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6AF2684031300A7D764 /* AsyncHandlers.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 /* AllDatatypes.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B22684031300A7D764 /* AllDatatypes.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 /* VoidArgFlutter.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DD2E6B82684031300A7D764 /* VoidArgFlutter.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 */; };
|
||||
@ -42,7 +42,7 @@
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
CEA7789327DE9EEB00FE0824 /* null_fields.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA7789127DE9EEB00FE0824 /* null_fields.gen.m */; };
|
||||
CEA7789327DE9EEB00FE0824 /* NullFields.gen.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA7789127DE9EEB00FE0824 /* NullFields.gen.m */; };
|
||||
CEA7789527DE9F1800FE0824 /* NullFieldsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA7789427DE9F1800FE0824 /* NullFieldsTest.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -70,51 +70,51 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0D02163B27BC7B48009BD76F /* nullable_returns.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nullable_returns.gen.h; sourceTree = "<group>"; };
|
||||
0D02163C27BC7B48009BD76F /* nullable_returns.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = nullable_returns.gen.m; sourceTree = "<group>"; };
|
||||
0D21E59827D0502D0051D07D /* background_platform_channels.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = background_platform_channels.gen.m; sourceTree = "<group>"; };
|
||||
0D21E59927D0502D0051D07D /* background_platform_channels.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = background_platform_channels.gen.h; sourceTree = "<group>"; };
|
||||
0D02163B27BC7B48009BD76F /* NullableReturns.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullableReturns.gen.h; sourceTree = "<group>"; };
|
||||
0D02163C27BC7B48009BD76F /* NullableReturns.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NullableReturns.gen.m; sourceTree = "<group>"; };
|
||||
0D21E59827D0502D0051D07D /* BackgroundPlatformChannels.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BackgroundPlatformChannels.gen.m; sourceTree = "<group>"; };
|
||||
0D21E59927D0502D0051D07D /* BackgroundPlatformChannels.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackgroundPlatformChannels.gen.h; sourceTree = "<group>"; };
|
||||
0D36469C27C6BE3C0069B7BF /* NullableReturnsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NullableReturnsTest.m; sourceTree = "<group>"; };
|
||||
0D36469E27C6DCEC0069B7BF /* MockBinaryMessenger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockBinaryMessenger.h; sourceTree = "<group>"; };
|
||||
0D36469F27C6DCEC0069B7BF /* MockBinaryMessenger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MockBinaryMessenger.m; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
0D50127623FF75B100CD5B95 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
0D6FD3C326A76D400046D8BD /* primitive.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = primitive.gen.h; sourceTree = "<group>"; };
|
||||
0D6FD3C426A76D400046D8BD /* primitive.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = primitive.gen.m; sourceTree = "<group>"; };
|
||||
0D6FD3C326A76D400046D8BD /* Primitive.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Primitive.gen.h; sourceTree = "<group>"; };
|
||||
0D6FD3C426A76D400046D8BD /* Primitive.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Primitive.gen.m; sourceTree = "<group>"; };
|
||||
0D6FD3C626A777C00046D8BD /* PrimitiveTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimitiveTest.m; sourceTree = "<group>"; };
|
||||
0D7A9109268D4A050056B5E1 /* ListTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ListTest.m; sourceTree = "<group>"; };
|
||||
0D7A910B268E5D700056B5E1 /* all_void.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = all_void.gen.h; sourceTree = "<group>"; };
|
||||
0D7A910C268E5D700056B5E1 /* all_void.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = all_void.gen.m; sourceTree = "<group>"; };
|
||||
0D7A910B268E5D700056B5E1 /* AllVoid.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllVoid.gen.h; sourceTree = "<group>"; };
|
||||
0D7A910C268E5D700056B5E1 /* AllVoid.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllVoid.gen.m; sourceTree = "<group>"; };
|
||||
0D8C35EA25D45A7900B76435 /* AsyncHandlersTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AsyncHandlersTest.m; sourceTree = "<group>"; };
|
||||
0DA5DFD426CC39D600D2354B /* multiple_arity.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiple_arity.gen.h; sourceTree = "<group>"; };
|
||||
0DA5DFD526CC39D600D2354B /* multiple_arity.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = multiple_arity.gen.m; sourceTree = "<group>"; };
|
||||
0DA5DFD426CC39D600D2354B /* MultipleArity.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultipleArity.gen.h; sourceTree = "<group>"; };
|
||||
0DA5DFD526CC39D600D2354B /* MultipleArity.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultipleArity.gen.m; sourceTree = "<group>"; };
|
||||
0DA5DFD726CC3A2100D2354B /* MultipleArityTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultipleArityTest.m; sourceTree = "<group>"; };
|
||||
0DA5DFD926CC3B3700D2354B /* HandlerBinaryMessenger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HandlerBinaryMessenger.h; sourceTree = "<group>"; };
|
||||
0DA5DFDA26CC3B3700D2354B /* HandlerBinaryMessenger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HandlerBinaryMessenger.m; sourceTree = "<group>"; };
|
||||
0DBD8C3D279B73F700E4FDBA /* NonNullFieldsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NonNullFieldsTest.m; sourceTree = "<group>"; };
|
||||
0DBD8C3F279B741800E4FDBA /* non_null_fields.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = non_null_fields.gen.m; sourceTree = "<group>"; };
|
||||
0DBD8C40279B741800E4FDBA /* non_null_fields.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = non_null_fields.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6A62684031200A7D764 /* void_arg_host.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = void_arg_host.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6A72684031200A7D764 /* list.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = list.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6A82684031200A7D764 /* host2flutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = host2flutter.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6A92684031200A7D764 /* voidhost.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = voidhost.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AA2684031300A7D764 /* all_datatypes.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = all_datatypes.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AB2684031300A7D764 /* host2flutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = host2flutter.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6AC2684031300A7D764 /* void_arg_flutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = void_arg_flutter.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AD2684031300A7D764 /* list.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = list.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AE2684031300A7D764 /* async_handlers.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = async_handlers.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AF2684031300A7D764 /* async_handlers.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = async_handlers.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B02684031300A7D764 /* message.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = message.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B12684031300A7D764 /* enum.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = enum.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B22684031300A7D764 /* all_datatypes.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = all_datatypes.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B32684031300A7D764 /* voidflutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = voidflutter.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6B42684031300A7D764 /* message.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = message.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6B52684031300A7D764 /* voidhost.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = voidhost.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B62684031300A7D764 /* voidflutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = voidflutter.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B72684031300A7D764 /* enum.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = enum.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6B82684031300A7D764 /* void_arg_flutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = void_arg_flutter.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B92684031300A7D764 /* void_arg_host.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = void_arg_host.gen.h; sourceTree = "<group>"; };
|
||||
0DBD8C3F279B741800E4FDBA /* NonNullFields.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NonNullFields.gen.m; sourceTree = "<group>"; };
|
||||
0DBD8C40279B741800E4FDBA /* NonNullFields.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NonNullFields.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6A62684031200A7D764 /* VoidArgHost.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VoidArgHost.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6A72684031200A7D764 /* List.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = List.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6A82684031200A7D764 /* Host2flutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Host2flutter.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6A92684031200A7D764 /* Voidhost.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Voidhost.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AA2684031300A7D764 /* AllDatatypes.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllDatatypes.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AB2684031300A7D764 /* Host2flutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Host2flutter.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6AC2684031300A7D764 /* VoidArgFlutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VoidArgFlutter.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AD2684031300A7D764 /* List.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = List.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AE2684031300A7D764 /* AsyncHandlers.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncHandlers.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6AF2684031300A7D764 /* AsyncHandlers.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AsyncHandlers.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B02684031300A7D764 /* Message.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Message.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B12684031300A7D764 /* Enum.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Enum.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B22684031300A7D764 /* AllDatatypes.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllDatatypes.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B32684031300A7D764 /* Voidflutter.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Voidflutter.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6B42684031300A7D764 /* Message.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Message.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6B52684031300A7D764 /* Voidhost.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Voidhost.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B62684031300A7D764 /* Voidflutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Voidflutter.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B72684031300A7D764 /* Enum.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enum.gen.h; sourceTree = "<group>"; };
|
||||
0DD2E6B82684031300A7D764 /* VoidArgFlutter.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VoidArgFlutter.gen.m; sourceTree = "<group>"; };
|
||||
0DD2E6B92684031300A7D764 /* VoidArgHost.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VoidArgHost.gen.h; sourceTree = "<group>"; };
|
||||
0DF4E5C4266ECF4A00AEA855 /* AllDatatypesTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AllDatatypesTest.m; sourceTree = "<group>"; };
|
||||
0DF4E5C6266ED80900AEA855 /* EchoMessenger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EchoMessenger.h; sourceTree = "<group>"; };
|
||||
0DF4E5C7266ED80900AEA855 /* EchoMessenger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EchoMessenger.m; sourceTree = "<group>"; };
|
||||
@ -133,8 +133,8 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
CEA7789127DE9EEB00FE0824 /* null_fields.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = null_fields.gen.m; sourceTree = "<group>"; };
|
||||
CEA7789227DE9EEB00FE0824 /* null_fields.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = null_fields.gen.h; sourceTree = "<group>"; };
|
||||
CEA7789127DE9EEB00FE0824 /* NullFields.gen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NullFields.gen.m; sourceTree = "<group>"; };
|
||||
CEA7789227DE9EEB00FE0824 /* NullFields.gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullFields.gen.h; sourceTree = "<group>"; };
|
||||
CEA7789427DE9F1800FE0824 /* NullFieldsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NullFieldsTest.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@ -213,40 +213,40 @@
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CEA7789227DE9EEB00FE0824 /* null_fields.gen.h */,
|
||||
CEA7789127DE9EEB00FE0824 /* null_fields.gen.m */,
|
||||
0D21E59927D0502D0051D07D /* background_platform_channels.gen.h */,
|
||||
0D21E59827D0502D0051D07D /* background_platform_channels.gen.m */,
|
||||
0D02163B27BC7B48009BD76F /* nullable_returns.gen.h */,
|
||||
0D02163C27BC7B48009BD76F /* nullable_returns.gen.m */,
|
||||
0DBD8C40279B741800E4FDBA /* non_null_fields.gen.h */,
|
||||
0DBD8C3F279B741800E4FDBA /* non_null_fields.gen.m */,
|
||||
0DA5DFD426CC39D600D2354B /* multiple_arity.gen.h */,
|
||||
0DA5DFD526CC39D600D2354B /* multiple_arity.gen.m */,
|
||||
0D6FD3C326A76D400046D8BD /* primitive.gen.h */,
|
||||
0D6FD3C426A76D400046D8BD /* primitive.gen.m */,
|
||||
0D7A910B268E5D700056B5E1 /* all_void.gen.h */,
|
||||
0D7A910C268E5D700056B5E1 /* all_void.gen.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 */,
|
||||
CEA7789227DE9EEB00FE0824 /* NullFields.gen.h */,
|
||||
CEA7789127DE9EEB00FE0824 /* NullFields.gen.m */,
|
||||
0D21E59927D0502D0051D07D /* BackgroundPlatformChannels.gen.h */,
|
||||
0D21E59827D0502D0051D07D /* BackgroundPlatformChannels.gen.m */,
|
||||
0D02163B27BC7B48009BD76F /* NullableReturns.gen.h */,
|
||||
0D02163C27BC7B48009BD76F /* NullableReturns.gen.m */,
|
||||
0DBD8C40279B741800E4FDBA /* NonNullFields.gen.h */,
|
||||
0DBD8C3F279B741800E4FDBA /* NonNullFields.gen.m */,
|
||||
0DA5DFD426CC39D600D2354B /* MultipleArity.gen.h */,
|
||||
0DA5DFD526CC39D600D2354B /* MultipleArity.gen.m */,
|
||||
0D6FD3C326A76D400046D8BD /* Primitive.gen.h */,
|
||||
0D6FD3C426A76D400046D8BD /* Primitive.gen.m */,
|
||||
0D7A910B268E5D700056B5E1 /* AllVoid.gen.h */,
|
||||
0D7A910C268E5D700056B5E1 /* AllVoid.gen.m */,
|
||||
0DD2E6AA2684031300A7D764 /* AllDatatypes.gen.h */,
|
||||
0DD2E6B22684031300A7D764 /* AllDatatypes.gen.m */,
|
||||
0DD2E6AE2684031300A7D764 /* AsyncHandlers.gen.h */,
|
||||
0DD2E6AF2684031300A7D764 /* AsyncHandlers.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 /* VoidArgFlutter.gen.h */,
|
||||
0DD2E6B82684031300A7D764 /* VoidArgFlutter.gen.m */,
|
||||
0DD2E6B92684031300A7D764 /* VoidArgHost.gen.h */,
|
||||
0DD2E6A62684031200A7D764 /* VoidArgHost.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 */,
|
||||
@ -424,26 +424,26 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0DBD8C41279B741800E4FDBA /* non_null_fields.gen.m in Sources */,
|
||||
0DD2E6BD2684031300A7D764 /* async_handlers.gen.m in Sources */,
|
||||
0D7A910D268E5D700056B5E1 /* all_void.gen.m in Sources */,
|
||||
0DD2E6C12684031300A7D764 /* voidhost.gen.m in Sources */,
|
||||
0DD2E6BB2684031300A7D764 /* list.gen.m in Sources */,
|
||||
0DBD8C41279B741800E4FDBA /* NonNullFields.gen.m in Sources */,
|
||||
0DD2E6BD2684031300A7D764 /* AsyncHandlers.gen.m in Sources */,
|
||||
0D7A910D268E5D700056B5E1 /* AllVoid.gen.m in Sources */,
|
||||
0DD2E6C12684031300A7D764 /* Voidhost.gen.m in Sources */,
|
||||
0DD2E6BB2684031300A7D764 /* List.gen.m in Sources */,
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
|
||||
0DD2E6C32684031300A7D764 /* void_arg_flutter.gen.m in Sources */,
|
||||
0DD2E6C22684031300A7D764 /* voidflutter.gen.m in Sources */,
|
||||
0DD2E6C02684031300A7D764 /* all_datatypes.gen.m in Sources */,
|
||||
0D6FD3C526A76D400046D8BD /* primitive.gen.m in Sources */,
|
||||
0DD2E6C32684031300A7D764 /* VoidArgFlutter.gen.m in Sources */,
|
||||
0DD2E6C22684031300A7D764 /* Voidflutter.gen.m in Sources */,
|
||||
0DD2E6C02684031300A7D764 /* AllDatatypes.gen.m in Sources */,
|
||||
0D6FD3C526A76D400046D8BD /* Primitive.gen.m in Sources */,
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */,
|
||||
0DD2E6BC2684031300A7D764 /* host2flutter.gen.m in Sources */,
|
||||
0DA5DFD626CC39D600D2354B /* multiple_arity.gen.m in Sources */,
|
||||
CEA7789327DE9EEB00FE0824 /* null_fields.gen.m in Sources */,
|
||||
0DD2E6BE2684031300A7D764 /* message.gen.m in Sources */,
|
||||
0D21E59A27D0502D0051D07D /* background_platform_channels.gen.m in Sources */,
|
||||
0DD2E6BA2684031300A7D764 /* void_arg_host.gen.m in Sources */,
|
||||
0DD2E6BC2684031300A7D764 /* Host2flutter.gen.m in Sources */,
|
||||
0DA5DFD626CC39D600D2354B /* MultipleArity.gen.m in Sources */,
|
||||
CEA7789327DE9EEB00FE0824 /* NullFields.gen.m in Sources */,
|
||||
0DD2E6BE2684031300A7D764 /* Message.gen.m in Sources */,
|
||||
0D21E59A27D0502D0051D07D /* BackgroundPlatformChannels.gen.m in Sources */,
|
||||
0DD2E6BA2684031300A7D764 /* VoidArgHost.gen.m in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
0D02163D27BC7B48009BD76F /* nullable_returns.gen.m in Sources */,
|
||||
0DD2E6BF2684031300A7D764 /* enum.gen.m in Sources */,
|
||||
0D02163D27BC7B48009BD76F /* NullableReturns.gen.m in Sources */,
|
||||
0DD2E6BF2684031300A7D764 /* Enum.gen.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "AllDatatypes.gen.h"
|
||||
#import "EchoMessenger.h"
|
||||
#import "all_datatypes.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface AllDatatypesTest : XCTestCase
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "AsyncHandlers.gen.h"
|
||||
#import "MockBinaryMessenger.h"
|
||||
#import "async_handlers.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface Value ()
|
||||
|
@ -5,7 +5,7 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "EchoMessenger.h"
|
||||
#import "enum.gen.h"
|
||||
#import "Enum.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface EnumTest : XCTestCase
|
||||
@ -15,14 +15,14 @@
|
||||
@implementation EnumTest
|
||||
|
||||
- (void)testEcho {
|
||||
ACDataWithEnum *data = [[ACDataWithEnum alloc] init];
|
||||
data.state = ACEnumStateError;
|
||||
DataWithEnum *data = [[DataWithEnum alloc] init];
|
||||
data.state = EnumStateError;
|
||||
EchoBinaryMessenger *binaryMessenger =
|
||||
[[EchoBinaryMessenger alloc] initWithCodec:ACEnumApi2HostGetCodec()];
|
||||
ACEnumApi2Flutter *api = [[ACEnumApi2Flutter alloc] initWithBinaryMessenger:binaryMessenger];
|
||||
[[EchoBinaryMessenger alloc] initWithCodec:EnumApi2HostGetCodec()];
|
||||
EnumApi2Flutter *api = [[EnumApi2Flutter alloc] initWithBinaryMessenger:binaryMessenger];
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||
[api echoData:data
|
||||
completion:^(ACDataWithEnum *_Nonnull result, NSError *_Nullable error) {
|
||||
completion:^(DataWithEnum *_Nonnull result, NSError *_Nullable error) {
|
||||
XCTAssertEqual(data.state, result.state);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
@ -5,7 +5,7 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "EchoMessenger.h"
|
||||
#import "list.gen.h"
|
||||
#import "List.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface ListTest : XCTestCase
|
||||
@ -15,18 +15,18 @@
|
||||
@implementation ListTest
|
||||
|
||||
- (void)testListInList {
|
||||
LSTTestMessage *top = [[LSTTestMessage alloc] init];
|
||||
LSTTestMessage *inside = [[LSTTestMessage alloc] init];
|
||||
TestMessage *top = [[TestMessage alloc] init];
|
||||
TestMessage *inside = [[TestMessage alloc] init];
|
||||
inside.testList = @[ @1, @2, @3 ];
|
||||
top.testList = @[ inside ];
|
||||
EchoBinaryMessenger *binaryMessenger =
|
||||
[[EchoBinaryMessenger alloc] initWithCodec:LSTEchoApiGetCodec()];
|
||||
LSTEchoApi *api = [[LSTEchoApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||
[[EchoBinaryMessenger alloc] initWithCodec:EchoApiGetCodec()];
|
||||
EchoApi *api = [[EchoApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||
[api echoMsg:top
|
||||
completion:^(LSTTestMessage *_Nonnull result, NSError *_Nullable err) {
|
||||
completion:^(TestMessage *_Nonnull result, NSError *_Nullable err) {
|
||||
XCTAssertEqual(1u, result.testList.count);
|
||||
XCTAssertTrue([result.testList[0] isKindOfClass:[LSTTestMessage class]]);
|
||||
XCTAssertTrue([result.testList[0] isKindOfClass:[TestMessage class]]);
|
||||
XCTAssertEqualObjects(inside.testList, [result.testList[0] testList]);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
@ -5,7 +5,7 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "HandlerBinaryMessenger.h"
|
||||
#import "multiple_arity.gen.h"
|
||||
#import "MultipleArity.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface MultipleAritytest : XCTestCase
|
||||
|
@ -6,7 +6,7 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "EchoMessenger.h"
|
||||
#import "non_null_fields.gen.h"
|
||||
#import "NonNullFields.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface NonNullFieldsTest : XCTestCase
|
||||
@ -16,7 +16,7 @@
|
||||
@implementation NonNullFieldsTest
|
||||
|
||||
- (void)testMake {
|
||||
NNFNonNullFieldSearchRequest *request = [NNFNonNullFieldSearchRequest makeWithQuery:@"hello"];
|
||||
NonNullFieldSearchRequest *request = [NonNullFieldSearchRequest makeWithQuery:@"hello"];
|
||||
XCTAssertEqualObjects(@"hello", request.query);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "EchoMessenger.h"
|
||||
#import "null_fields.gen.h"
|
||||
#import "NullFields.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface NullFieldsSearchRequest ()
|
||||
|
@ -5,10 +5,10 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "EchoMessenger.h"
|
||||
#import "MockBinaryMessenger.h"
|
||||
#import "nullable_returns.gen.h"
|
||||
#import "NullableReturns.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface MockNullableArgHostApi : NSObject <NRNullableArgHostApi>
|
||||
@interface MockNullableArgHostApi : NSObject <NullableArgHostApi>
|
||||
@property(nonatomic, assign) BOOL didCall;
|
||||
@property(nonatomic, copy) NSNumber *x;
|
||||
@end
|
||||
@ -33,9 +33,9 @@
|
||||
|
||||
- (void)testNullableParameterWithFlutterApi {
|
||||
EchoBinaryMessenger *binaryMessenger =
|
||||
[[EchoBinaryMessenger alloc] initWithCodec:NRNullableArgHostApiGetCodec()];
|
||||
NRNullableArgFlutterApi *api =
|
||||
[[NRNullableArgFlutterApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||
[[EchoBinaryMessenger alloc] initWithCodec:NullableArgHostApiGetCodec()];
|
||||
NullableArgFlutterApi *api =
|
||||
[[NullableArgFlutterApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||
[api doitX:nil
|
||||
completion:^(NSNumber *_Nonnull result, NSError *_Nullable error) {
|
||||
@ -48,12 +48,12 @@
|
||||
- (void)testNullableParameterWithHostApi {
|
||||
MockNullableArgHostApi *api = [[MockNullableArgHostApi alloc] init];
|
||||
MockBinaryMessenger *binaryMessenger =
|
||||
[[MockBinaryMessenger alloc] initWithCodec:NRNullableArgHostApiGetCodec()];
|
||||
[[MockBinaryMessenger alloc] initWithCodec:NullableArgHostApiGetCodec()];
|
||||
NSString *channel = @"dev.flutter.pigeon.NullableArgHostApi.doit";
|
||||
NRNullableArgHostApiSetup(binaryMessenger, api);
|
||||
NullableArgHostApiSetup(binaryMessenger, api);
|
||||
XCTAssertNotNil(binaryMessenger.handlers[channel]);
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||
NSData *arguments = [NRNullableArgHostApiGetCodec() encode:@[ [NSNull null] ]];
|
||||
NSData *arguments = [NullableArgHostApiGetCodec() encode:@[ [NSNull null] ]];
|
||||
binaryMessenger.handlers[channel](arguments, ^(NSData *data) {
|
||||
[expectation fulfill];
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "EchoMessenger.h"
|
||||
#import "primitive.gen.h"
|
||||
#import "Primitive.gen.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@interface PrimitiveTest : XCTestCase
|
||||
|
@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "message.gen.h"
|
||||
#import "Message.gen.h"
|
||||
|
||||
@interface ACMessageSearchReply ()
|
||||
+ (ACMessageSearchReply *)fromMap:(NSDictionary *)dict;
|
||||
|
9
packages/pigeon/platform_tests/test_plugin/lib/.gitignore
vendored
Normal file
9
packages/pigeon/platform_tests/test_plugin/lib/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# TODO(stuartmorgan): Remove this, so that review will show the effects of
|
||||
# changes on generated files. This will need a way to avoid unnecessary churn,
|
||||
# such as a flag to suppress version stamp generation.
|
||||
*.gen.dart
|
||||
# TODO(stuartmorgan): Add exceptions for specific files that are used in
|
||||
# integration tests, as they will need to be checked in to avoid analysis
|
||||
# failures. The exclusion of other files is to prevent having multiple
|
||||
# copies of all of the Dart output until more tests are restructured to
|
||||
# minimize duplication.
|
@ -83,38 +83,38 @@ add_executable(${TEST_RUNNER}
|
||||
test/pigeon_test.cpp
|
||||
test/primitive_test.cpp
|
||||
# Generated sources.
|
||||
test/all_datatypes.g.cpp
|
||||
test/all_datatypes.g.h
|
||||
test/all_void.g.cpp
|
||||
test/all_void.g.h
|
||||
test/async_handlers.g.cpp
|
||||
test/async_handlers.g.h
|
||||
test/enum.g.cpp
|
||||
test/enum.g.h
|
||||
test/host2flutter.g.cpp
|
||||
test/host2flutter.g.h
|
||||
test/list.g.cpp
|
||||
test/list.g.h
|
||||
test/message.g.cpp
|
||||
test/message.g.h
|
||||
test/multiple_arity.g.cpp
|
||||
test/multiple_arity.g.h
|
||||
test/non_null_fields.g.cpp
|
||||
test/non_null_fields.g.h
|
||||
test/null_fields.g.cpp
|
||||
test/null_fields.g.h
|
||||
test/nullable_returns.g.cpp
|
||||
test/nullable_returns.g.h
|
||||
test/primitive.g.cpp
|
||||
test/primitive.g.h
|
||||
test/void_arg_flutter.g.cpp
|
||||
test/void_arg_flutter.g.h
|
||||
test/void_arg_host.g.cpp
|
||||
test/void_arg_host.g.h
|
||||
test/voidflutter.g.cpp
|
||||
test/voidflutter.g.h
|
||||
test/voidhost.g.cpp
|
||||
test/voidhost.g.h
|
||||
test/all_datatypes.gen.cpp
|
||||
test/all_datatypes.gen.h
|
||||
test/all_void.gen.cpp
|
||||
test/all_void.gen.h
|
||||
test/async_handlers.gen.cpp
|
||||
test/async_handlers.gen.h
|
||||
test/enum.gen.cpp
|
||||
test/enum.gen.h
|
||||
test/host2flutter.gen.cpp
|
||||
test/host2flutter.gen.h
|
||||
test/list.gen.cpp
|
||||
test/list.gen.h
|
||||
test/message.gen.cpp
|
||||
test/message.gen.h
|
||||
test/multiple_arity.gen.cpp
|
||||
test/multiple_arity.gen.h
|
||||
test/non_null_fields.gen.cpp
|
||||
test/non_null_fields.gen.h
|
||||
test/null_fields.gen.cpp
|
||||
test/null_fields.gen.h
|
||||
test/nullable_returns.gen.cpp
|
||||
test/nullable_returns.gen.h
|
||||
test/primitive.gen.cpp
|
||||
test/primitive.gen.h
|
||||
test/void_arg_flutter.gen.cpp
|
||||
test/void_arg_flutter.gen.h
|
||||
test/void_arg_host.gen.cpp
|
||||
test/void_arg_host.gen.h
|
||||
test/voidflutter.gen.cpp
|
||||
test/voidflutter.gen.h
|
||||
test/voidhost.gen.cpp
|
||||
test/voidhost.gen.h
|
||||
# Test utilities.
|
||||
test/utils/echo_messenger.cpp
|
||||
test/utils/echo_messenger.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
# TODO(stuartmorgan): Remove this, so that review will show the effects of
|
||||
# changes on generated files. This will need a way to avoid unnecessary churn,
|
||||
# such as a flag to suppress version stamp generation.
|
||||
*.g.h
|
||||
*.g.cpp
|
||||
*.gen.h
|
||||
*.gen.cpp
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "test/multiple_arity.g.h"
|
||||
#include "test/multiple_arity.gen.h"
|
||||
#include "test/utils/fake_host_messenger.h"
|
||||
|
||||
namespace multiple_arity_pigeontest {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "non_null_fields.g.h"
|
||||
#include "non_null_fields.gen.h"
|
||||
|
||||
namespace non_null_fields_pigeontest {
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <flutter/encodable_value.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "null_fields.g.h"
|
||||
#include "null_fields.gen.h"
|
||||
|
||||
namespace null_fields_pigeontest {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "test/nullable_returns.g.h"
|
||||
#include "test/nullable_returns.gen.h"
|
||||
#include "test/utils/fake_host_messenger.h"
|
||||
|
||||
namespace nullable_returns_pigeontest {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "message.g.h"
|
||||
#include "message.gen.h"
|
||||
|
||||
namespace test_plugin {
|
||||
namespace test {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "test/primitive.g.h"
|
||||
#include "test/primitive.gen.h"
|
||||
#include "test/utils/fake_host_messenger.h"
|
||||
|
||||
namespace primitive_pigeontest {
|
||||
|
@ -51,6 +51,8 @@ mktmpdir() {
|
||||
#
|
||||
# Compiles the pigeon file to a temp directory and attempts to compile the java
|
||||
# code.
|
||||
# TODO(stuartmorgan): Remove this in favor of unit testing all files, which
|
||||
# already includes compilation.
|
||||
test_pigeon_android() {
|
||||
echo "test_pigeon_android($1)"
|
||||
temp_dir=$(mktmpdir)
|
||||
@ -81,6 +83,7 @@ test_pigeon_android() {
|
||||
#
|
||||
# Compiles the pigeon file to a temp directory and attempts to run the dart
|
||||
# analyzer on it.
|
||||
# TODO(stuartmorgan): Remove this in favor of analyzing test_plugin.
|
||||
test_pigeon_dart() {
|
||||
echo "test_pigeon_dart($1, $2)"
|
||||
local flutter_project_dir=$2
|
||||
@ -103,33 +106,6 @@ 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/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/$javaName.java"
|
||||
$run_pigeon \
|
||||
--input $input \
|
||||
--dart_out /dev/null \
|
||||
--java_out $javaOut \
|
||||
--java_package "com.example.alternate_language_test_plugin"
|
||||
|
||||
java -jar ci/$java_formatter --replace $javaOut
|
||||
java -jar ci/$java_linter -c "ci/$google_checks" "$javaOut"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Stages
|
||||
###############################################################################
|
||||
@ -158,7 +134,7 @@ get_java_linter_formatter() {
|
||||
}
|
||||
|
||||
run_dart_unittests() {
|
||||
dart run tool/run_tests.dart -t dart_unittests
|
||||
dart run tool/run_tests.dart -t dart_unittests --skip-generation
|
||||
}
|
||||
|
||||
test_command_line() {
|
||||
@ -178,23 +154,23 @@ test_command_line() {
|
||||
}
|
||||
|
||||
run_flutter_unittests() {
|
||||
dart run tool/run_tests.dart -t flutter_unittests
|
||||
dart run tool/run_tests.dart -t flutter_unittests --skip-generation
|
||||
}
|
||||
|
||||
run_mock_handler_tests() {
|
||||
dart run tool/run_tests.dart -t mock_handler_tests
|
||||
dart run tool/run_tests.dart -t mock_handler_tests --skip-generation
|
||||
}
|
||||
|
||||
run_ios_swift_unittests() {
|
||||
dart run tool/run_tests.dart -t ios_swift_unittests
|
||||
dart run tool/run_tests.dart -t ios_swift_unittests --skip-generation
|
||||
}
|
||||
|
||||
run_macos_swift_unittests() {
|
||||
dart run tool/run_tests.dart -t mac_swift_unittests
|
||||
dart run tool/run_tests.dart -t mac_swift_unittests --skip-generation
|
||||
}
|
||||
|
||||
run_android_kotlin_unittests() {
|
||||
dart run tool/run_tests.dart -t android_kotlin_unittests
|
||||
dart run tool/run_tests.dart -t android_kotlin_unittests --skip-generation
|
||||
}
|
||||
|
||||
run_dart_compilation_tests() {
|
||||
@ -217,24 +193,6 @@ run_dart_compilation_tests() {
|
||||
}
|
||||
|
||||
run_ios_unittests() {
|
||||
gen_ios_unittests_code ./pigeons/all_void.dart ""
|
||||
gen_ios_unittests_code ./pigeons/all_datatypes.dart ""
|
||||
gen_ios_unittests_code ./pigeons/async_handlers.dart ""
|
||||
gen_ios_unittests_code ./pigeons/background_platform_channels.dart "BC"
|
||||
gen_ios_unittests_code ./pigeons/enum.dart "AC"
|
||||
gen_ios_unittests_code ./pigeons/enum_args.dart "EA"
|
||||
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/multiple_arity.dart ""
|
||||
gen_ios_unittests_code ./pigeons/non_null_fields.dart "NNF"
|
||||
gen_ios_unittests_code ./pigeons/null_fields.dart ""
|
||||
gen_ios_unittests_code ./pigeons/nullable_returns.dart "NR"
|
||||
gen_ios_unittests_code ./pigeons/primitive.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
|
||||
@ -276,26 +234,6 @@ run_ios_e2e_tests() {
|
||||
|
||||
run_android_unittests() {
|
||||
pushd $PWD
|
||||
gen_android_unittests_code ./pigeons/all_datatypes.dart AllDatatypes
|
||||
gen_android_unittests_code ./pigeons/all_void.dart AllVoid
|
||||
gen_android_unittests_code ./pigeons/android_unittests.dart Pigeon
|
||||
gen_android_unittests_code ./pigeons/async_handlers.dart AsyncHandlers
|
||||
gen_android_unittests_code ./pigeons/background_platform_channels.dart BackgroundPlatformChannels
|
||||
gen_android_unittests_code ./pigeons/enum.dart Enum
|
||||
gen_android_unittests_code ./pigeons/enum_args.dart EnumArgs
|
||||
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/multiple_arity.dart MultipleArity
|
||||
gen_android_unittests_code ./pigeons/non_null_fields.dart NonNullFields
|
||||
gen_android_unittests_code ./pigeons/null_fields.dart NullFields
|
||||
gen_android_unittests_code ./pigeons/nullable_returns.dart NullableReturns
|
||||
gen_android_unittests_code ./pigeons/primitive.dart Primitive
|
||||
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/alternate_language_test_plugin/example
|
||||
if [ ! -f "android/gradlew" ]; then
|
||||
flutter build apk --debug
|
||||
@ -383,6 +321,10 @@ done
|
||||
##############################################################################
|
||||
dart pub get
|
||||
dart --snapshot-kind=kernel --snapshot=bin/pigeon.dart.dill bin/pigeon.dart
|
||||
|
||||
# Pre-generate platform_test output files, which most tests rely on existing.
|
||||
dart run tool/generate.dart
|
||||
|
||||
if [ "$should_run_android_unittests" = true ]; then
|
||||
get_java_linter_formatter
|
||||
fi
|
||||
|
30
packages/pigeon/tool/generate.dart
Normal file
30
packages/pigeon/tool/generate.dart
Normal file
@ -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.
|
||||
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
// Generates the pigeon output files needed for platform_test tests.
|
||||
//
|
||||
// Eventually this may get more options to control which files are generated,
|
||||
// but for now it always generates everything needed for the platform unit
|
||||
// tests.
|
||||
|
||||
import 'dart:io' show Platform, exit;
|
||||
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import 'shared/generation.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
final String baseDir = p.dirname(p.dirname(Platform.script.toFilePath()));
|
||||
|
||||
print('Generating platform_test/ output...');
|
||||
final int exitCode = await generatePigeons(baseDir: baseDir);
|
||||
if (exitCode == 0) {
|
||||
print('Generation complete!');
|
||||
} else {
|
||||
print('Generation failed; see above for errors.');
|
||||
}
|
||||
exit(exitCode);
|
||||
}
|
@ -9,14 +9,20 @@
|
||||
///
|
||||
/// usage: dart run tool/run_tests.dart
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
import 'dart:io' show File, Platform, Process, exit, stderr, stdout;
|
||||
import 'dart:io' show File, Platform, exit;
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:args/args.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import 'shared/generation.dart';
|
||||
import 'shared/native_project_runners.dart';
|
||||
import 'shared/process_utils.dart';
|
||||
|
||||
const String _testFlag = 'test';
|
||||
const String _listFlag = 'list';
|
||||
const String _skipGenerationFlag = 'skip-generation';
|
||||
|
||||
const String testPluginRelativePath = 'platform_tests/test_plugin';
|
||||
|
||||
@ -63,105 +69,22 @@ const Map<String, _TestInfo> _tests = <String, _TestInfo>{
|
||||
description: 'Unit tests on generated Dart mock handler code.'),
|
||||
};
|
||||
|
||||
String snakeToPascalCase(String snake) {
|
||||
final List<String> parts = snake.split('_');
|
||||
return parts
|
||||
.map((String part) =>
|
||||
part.substring(0, 1).toUpperCase() + part.substring(1))
|
||||
.join();
|
||||
}
|
||||
|
||||
Future<Process> _streamOutput(Future<Process> processFuture) async {
|
||||
final Process process = await processFuture;
|
||||
stdout.addStream(process.stdout);
|
||||
stderr.addStream(process.stderr);
|
||||
return process;
|
||||
}
|
||||
|
||||
Future<int> _runProcess(String command, List<String> arguments,
|
||||
{String? workingDirectory}) async {
|
||||
final Process process = await _streamOutput(Process.start(
|
||||
command,
|
||||
arguments,
|
||||
workingDirectory: workingDirectory,
|
||||
));
|
||||
return process.exitCode;
|
||||
}
|
||||
|
||||
Future<int> _runAndroidUnitTests() async {
|
||||
throw UnimplementedError('See run_tests.sh.');
|
||||
}
|
||||
|
||||
Future<int> _runAndroidKotlinUnitTests() async {
|
||||
const String androidKotlinUnitTestsPath = './$testPluginRelativePath';
|
||||
// TODO(stuartmorgan): Move generation to a separate script in tool/ that can
|
||||
// easily be run manually as well (e.g., to look at generated code without
|
||||
// running tests, or to update generated code when running tests in an IDE).
|
||||
const List<String> tests = <String>[
|
||||
'all_datatypes',
|
||||
'all_void',
|
||||
'android_unittests',
|
||||
'async_handlers',
|
||||
'background_platform_channels',
|
||||
'enum_args',
|
||||
'enum',
|
||||
'host2flutter',
|
||||
'list',
|
||||
'message',
|
||||
'multiple_arity',
|
||||
'non_null_fields',
|
||||
'null_fields',
|
||||
'nullable_returns',
|
||||
'primitive',
|
||||
'void_arg_flutter',
|
||||
'void_arg_host',
|
||||
'voidflutter',
|
||||
'voidhost'
|
||||
];
|
||||
int generateCode = 0;
|
||||
|
||||
for (final String test in tests) {
|
||||
generateCode = await _runPigeon(
|
||||
input: './pigeons/$test.dart',
|
||||
kotlinOut:
|
||||
'$androidKotlinUnitTestsPath/android/src/main/kotlin/com/example/test_plugin/${snakeToPascalCase(test)}.kt',
|
||||
kotlinPackage: 'com.example.test_plugin',
|
||||
);
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
}
|
||||
|
||||
const String examplePath = '$androidKotlinUnitTestsPath/example';
|
||||
final Process gradlewExists = await _streamOutput(Process.start(
|
||||
'./gradlew',
|
||||
<String>[],
|
||||
workingDirectory: '$examplePath/android',
|
||||
runInShell: true,
|
||||
));
|
||||
final int gradlewExistsCode = await gradlewExists.exitCode;
|
||||
if (gradlewExistsCode != 0) {
|
||||
final Process compile = await _streamOutput(Process.start(
|
||||
'flutter',
|
||||
<String>['build', 'apk', '--debug'],
|
||||
workingDirectory: examplePath,
|
||||
runInShell: true,
|
||||
));
|
||||
final int compileCode = await compile.exitCode;
|
||||
const String examplePath = './$testPluginRelativePath/example';
|
||||
const String androidProjectPath = '$examplePath/android';
|
||||
final File gradleFile = File(p.join(androidProjectPath, 'gradlew'));
|
||||
if (!gradleFile.existsSync()) {
|
||||
final int compileCode = await runFlutterBuild(examplePath, 'apk');
|
||||
if (compileCode != 0) {
|
||||
return compileCode;
|
||||
}
|
||||
}
|
||||
|
||||
final Process run = await _streamOutput(Process.start(
|
||||
'./gradlew',
|
||||
<String>[
|
||||
'testDebugUnitTest',
|
||||
],
|
||||
workingDirectory: '$examplePath/android',
|
||||
));
|
||||
|
||||
return run.exitCode;
|
||||
return runGradleBuild(androidProjectPath, 'testDebugUnitTest');
|
||||
}
|
||||
|
||||
Future<int> _runDartCompilationTests() async {
|
||||
@ -169,15 +92,15 @@ Future<int> _runDartCompilationTests() async {
|
||||
}
|
||||
|
||||
Future<int> _runDartUnitTests() async {
|
||||
int exitCode = await _runProcess('dart', <String>['analyze', 'bin']);
|
||||
int exitCode = await runProcess('dart', <String>['analyze', 'bin']);
|
||||
if (exitCode != 0) {
|
||||
return exitCode;
|
||||
}
|
||||
exitCode = await _runProcess('dart', <String>['analyze', 'lib']);
|
||||
exitCode = await runProcess('dart', <String>['analyze', 'lib']);
|
||||
if (exitCode != 0) {
|
||||
return exitCode;
|
||||
}
|
||||
exitCode = await _runProcess('dart', <String>['test']);
|
||||
exitCode = await runProcess('dart', <String>['test']);
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
@ -188,7 +111,7 @@ Future<int> _generateDart(Map<String, String> jobs) async {
|
||||
for (final MapEntry<String, String> job in jobs.entries) {
|
||||
// TODO(gaaclarke): Make this run the jobs in parallel. A bug in Dart
|
||||
// blocked this (https://github.com/dart-lang/pub/pull/3285).
|
||||
final int result = await _runPigeon(
|
||||
final int result = await runPigeon(
|
||||
input: job.key, dartOut: job.value, streamOutput: false);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
@ -200,7 +123,7 @@ Future<int> _generateDart(Map<String, String> jobs) async {
|
||||
Future<int> _analyzeFlutterUnitTests(String flutterUnitTestsPath) async {
|
||||
final String messagePath = '$flutterUnitTestsPath/lib/message.gen.dart';
|
||||
final String messageTestPath = '$flutterUnitTestsPath/test/message_test.dart';
|
||||
final int generateTestCode = await _runPigeon(
|
||||
final int generateTestCode = await runPigeon(
|
||||
input: 'pigeons/message.dart',
|
||||
dartOut: messagePath,
|
||||
dartTestOut: messageTestPath,
|
||||
@ -209,11 +132,8 @@ Future<int> _analyzeFlutterUnitTests(String flutterUnitTestsPath) async {
|
||||
return generateTestCode;
|
||||
}
|
||||
|
||||
final int analyzeCode = await _runProcess(
|
||||
'flutter',
|
||||
<String>['analyze'],
|
||||
workingDirectory: flutterUnitTestsPath,
|
||||
);
|
||||
final int analyzeCode =
|
||||
await runFlutterCommand(flutterUnitTestsPath, 'analyze');
|
||||
if (analyzeCode != 0) {
|
||||
return analyzeCode;
|
||||
}
|
||||
@ -251,11 +171,7 @@ Future<int> _runFlutterUnitTests() async {
|
||||
return analyzeCode;
|
||||
}
|
||||
|
||||
final int testCode = await _runProcess(
|
||||
'flutter',
|
||||
<String>['test'],
|
||||
workingDirectory: flutterUnitTestsPath,
|
||||
);
|
||||
final int testCode = await runFlutterCommand(flutterUnitTestsPath, 'test');
|
||||
if (testCode != 0) {
|
||||
return testCode;
|
||||
}
|
||||
@ -272,118 +188,40 @@ Future<int> _runIosUnitTests() async {
|
||||
}
|
||||
|
||||
Future<int> _runMacOSSwiftUnitTests() async {
|
||||
const String macosSwiftUnitTestsPath = './$testPluginRelativePath';
|
||||
const List<String> tests = <String>[
|
||||
'all_void',
|
||||
];
|
||||
int generateCode = 0;
|
||||
|
||||
for (final String test in tests) {
|
||||
generateCode = await _runPigeon(
|
||||
input: './pigeons/$test.dart',
|
||||
iosSwiftOut:
|
||||
'$macosSwiftUnitTestsPath/macos/Classes/${snakeToPascalCase(test)}.gen.swift',
|
||||
);
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
}
|
||||
|
||||
const String examplePath = '$macosSwiftUnitTestsPath/example';
|
||||
final Process compile = await _streamOutput(Process.start(
|
||||
'flutter',
|
||||
<String>['build', 'macos'],
|
||||
workingDirectory: examplePath,
|
||||
runInShell: true,
|
||||
));
|
||||
final int compileCode = await compile.exitCode;
|
||||
const String examplePath = './$testPluginRelativePath/example';
|
||||
final int compileCode = await runFlutterBuild(examplePath, 'macos');
|
||||
if (compileCode != 0) {
|
||||
return compileCode;
|
||||
}
|
||||
|
||||
final Process run = await _streamOutput(Process.start(
|
||||
'xcodebuild',
|
||||
<String>[
|
||||
'-workspace',
|
||||
'Runner.xcworkspace',
|
||||
'-scheme',
|
||||
'Runner',
|
||||
'test',
|
||||
],
|
||||
workingDirectory: '$examplePath/macos',
|
||||
));
|
||||
|
||||
return run.exitCode;
|
||||
return runXcodeBuild(
|
||||
'$examplePath/macos',
|
||||
extraArguments: <String>['test'],
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> _runIosSwiftUnitTests() async {
|
||||
const String iosSwiftUnitTestsPath = './$testPluginRelativePath';
|
||||
const List<String> tests = <String>[
|
||||
'all_datatypes',
|
||||
'all_void',
|
||||
'async_handlers',
|
||||
'enum_args',
|
||||
'enum',
|
||||
'host2flutter',
|
||||
'list',
|
||||
'message',
|
||||
'multiple_arity',
|
||||
'non_null_fields',
|
||||
'null_fields',
|
||||
'nullable_returns',
|
||||
'primitive',
|
||||
'void_arg_flutter',
|
||||
'void_arg_host',
|
||||
'voidflutter',
|
||||
'voidhost'
|
||||
];
|
||||
int generateCode = 0;
|
||||
|
||||
for (final String test in tests) {
|
||||
generateCode = await _runPigeon(
|
||||
input: './pigeons/$test.dart',
|
||||
iosSwiftOut:
|
||||
'$iosSwiftUnitTestsPath/ios/Classes/${snakeToPascalCase(test)}.gen.swift',
|
||||
);
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
}
|
||||
|
||||
const String examplePath = '$iosSwiftUnitTestsPath/example';
|
||||
final Process compile = await _streamOutput(Process.start(
|
||||
'flutter',
|
||||
<String>['build', 'ios', '--simulator'],
|
||||
workingDirectory: examplePath,
|
||||
runInShell: true,
|
||||
));
|
||||
final int compileCode = await compile.exitCode;
|
||||
const String examplePath = './$testPluginRelativePath/example';
|
||||
final int compileCode = await runFlutterBuild(
|
||||
examplePath,
|
||||
'ios',
|
||||
flags: <String>['--simulator'],
|
||||
);
|
||||
if (compileCode != 0) {
|
||||
return compileCode;
|
||||
}
|
||||
|
||||
final Process run = await _streamOutput(Process.start(
|
||||
'xcodebuild',
|
||||
<String>[
|
||||
'-workspace',
|
||||
'Runner.xcworkspace',
|
||||
'-scheme',
|
||||
'Runner',
|
||||
'-sdk',
|
||||
'iphonesimulator',
|
||||
'-destination',
|
||||
'platform=iOS Simulator,name=iPhone 8',
|
||||
'test',
|
||||
],
|
||||
workingDirectory: '$examplePath/ios',
|
||||
));
|
||||
|
||||
return run.exitCode;
|
||||
return runXcodeBuild(
|
||||
'$examplePath/ios',
|
||||
sdk: 'iphonesimulator',
|
||||
destination: 'platform=iOS Simulator,name=iPhone 8',
|
||||
extraArguments: <String>['test'],
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> _runMockHandlerTests() async {
|
||||
const String unitTestsPath = './mock_handler_tester';
|
||||
final int generateCode = await _runPigeon(
|
||||
final int generateCode = await runPigeon(
|
||||
input: './pigeons/message.dart',
|
||||
dartOut: './mock_handler_tester/test/message.dart',
|
||||
dartTestOut: './mock_handler_tester/test/test.dart',
|
||||
@ -392,135 +230,23 @@ Future<int> _runMockHandlerTests() async {
|
||||
return generateCode;
|
||||
}
|
||||
|
||||
final int testCode = await _runProcess(
|
||||
'flutter',
|
||||
<String>['test'],
|
||||
workingDirectory: unitTestsPath,
|
||||
);
|
||||
final int testCode = await runFlutterCommand(unitTestsPath, 'test');
|
||||
if (testCode != 0) {
|
||||
return testCode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<int> _runPigeon(
|
||||
{required String input,
|
||||
String? kotlinOut,
|
||||
String? kotlinPackage,
|
||||
String? iosSwiftOut,
|
||||
String? cppHeaderOut,
|
||||
String? cppSourceOut,
|
||||
String? cppNamespace,
|
||||
String? dartOut,
|
||||
String? dartTestOut,
|
||||
bool streamOutput = true}) async {
|
||||
const bool hasDart = false;
|
||||
final List<String> args = <String>[
|
||||
'run',
|
||||
'pigeon',
|
||||
'--input',
|
||||
input,
|
||||
'--copyright_header',
|
||||
'./copyright_header.txt',
|
||||
];
|
||||
if (kotlinOut != null) {
|
||||
args.addAll(<String>['--experimental_kotlin_out', kotlinOut]);
|
||||
}
|
||||
if (kotlinPackage != null) {
|
||||
args.addAll(<String>['--experimental_kotlin_package', kotlinPackage]);
|
||||
}
|
||||
if (iosSwiftOut != null) {
|
||||
args.addAll(<String>['--experimental_swift_out', iosSwiftOut]);
|
||||
}
|
||||
if (cppHeaderOut != null) {
|
||||
args.addAll(<String>[
|
||||
'--experimental_cpp_header_out',
|
||||
cppHeaderOut,
|
||||
]);
|
||||
}
|
||||
if (cppSourceOut != null) {
|
||||
args.addAll(<String>[
|
||||
'--experimental_cpp_source_out',
|
||||
cppSourceOut,
|
||||
]);
|
||||
}
|
||||
if (cppNamespace != null) {
|
||||
args.addAll(<String>[
|
||||
'--cpp_namespace',
|
||||
cppNamespace,
|
||||
]);
|
||||
}
|
||||
if (dartOut != null) {
|
||||
args.addAll(<String>['--dart_out', dartOut]);
|
||||
}
|
||||
if (dartTestOut != null) {
|
||||
args.addAll(<String>['--dart_test_out', dartTestOut]);
|
||||
}
|
||||
if (!hasDart) {
|
||||
args.add('--one_language');
|
||||
}
|
||||
final Process generate = streamOutput
|
||||
? await _streamOutput(Process.start('dart', args))
|
||||
: await Process.start('dart', args);
|
||||
final int generateCode = await generate.exitCode;
|
||||
if (generateCode != 0) {
|
||||
if (!streamOutput) {
|
||||
print('dart $args failed:');
|
||||
generate.stdout.pipe(stdout);
|
||||
generate.stderr.pipe(stderr);
|
||||
}
|
||||
return generateCode;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<int> _runWindowsUnitTests() async {
|
||||
const String windowsUnitTestsPath = './$testPluginRelativePath';
|
||||
const List<String> tests = <String>[
|
||||
'all_datatypes',
|
||||
'all_void',
|
||||
'async_handlers',
|
||||
'enum',
|
||||
'host2flutter',
|
||||
'list',
|
||||
'message',
|
||||
'multiple_arity',
|
||||
'non_null_fields',
|
||||
'null_fields',
|
||||
'nullable_returns',
|
||||
'primitive',
|
||||
'void_arg_flutter',
|
||||
'void_arg_host',
|
||||
'voidflutter',
|
||||
'voidhost'
|
||||
];
|
||||
int generateCode = 0;
|
||||
|
||||
for (final String test in tests) {
|
||||
generateCode = await _runPigeon(
|
||||
input: './pigeons/$test.dart',
|
||||
cppHeaderOut: '$windowsUnitTestsPath/windows/test/$test.g.h',
|
||||
cppSourceOut: '$windowsUnitTestsPath/windows/test/$test.g.cpp',
|
||||
cppNamespace: '${test}_pigeontest');
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
}
|
||||
|
||||
const String examplePath = '$windowsUnitTestsPath/example';
|
||||
final Process compile = await _streamOutput(Process.start(
|
||||
'flutter', <String>['build', 'windows', '--debug'],
|
||||
workingDirectory: examplePath, runInShell: true));
|
||||
final int compileCode = await compile.exitCode;
|
||||
const String examplePath = './$testPluginRelativePath/example';
|
||||
final int compileCode = await runFlutterBuild(examplePath, 'windows');
|
||||
if (compileCode != 0) {
|
||||
return compileCode;
|
||||
}
|
||||
|
||||
final Process run = await _streamOutput(Process.start(
|
||||
return runProcess(
|
||||
'$examplePath/build/windows/plugins/test_plugin/Debug/test_plugin_test.exe',
|
||||
<String>[]));
|
||||
|
||||
return run.exitCode;
|
||||
<String>[]);
|
||||
}
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
@ -528,6 +254,11 @@ Future<void> main(List<String> args) async {
|
||||
..addOption(_testFlag, abbr: 't', help: 'Only run specified test.')
|
||||
..addFlag(_listFlag,
|
||||
negatable: false, abbr: 'l', help: 'List available tests.')
|
||||
// Temporarily provide a way for run_test.sh to bypass generation, since
|
||||
// it generates before doing anything else.
|
||||
// TODO(stuartmorgan): Remove this once run_test.sh is fully migrated to
|
||||
// this script.
|
||||
..addFlag(_skipGenerationFlag, negatable: false, hide: true)
|
||||
..addFlag('help',
|
||||
negatable: false, abbr: 'h', help: 'Print this reference.');
|
||||
|
||||
@ -554,6 +285,17 @@ ${parser.usage}''');
|
||||
testsToRun = <String>[argResults[_testFlag]];
|
||||
}
|
||||
|
||||
if (!argResults.wasParsed(_skipGenerationFlag)) {
|
||||
final String baseDir = p.dirname(p.dirname(Platform.script.toFilePath()));
|
||||
print('# Generating platform_test/ output...');
|
||||
final int generateExitCode = await generatePigeons(baseDir: baseDir);
|
||||
if (generateExitCode == 0) {
|
||||
print('Generation complete!');
|
||||
} else {
|
||||
print('Generation failed; see above for errors.');
|
||||
}
|
||||
}
|
||||
|
||||
// If no tests are provided, run a default based on the host platform. This is
|
||||
// the mode used by CI.
|
||||
if (testsToRun.isEmpty) {
|
||||
|
231
packages/pigeon/tool/shared/generation.dart
Normal file
231
packages/pigeon/tool/shared/generation.dart
Normal file
@ -0,0 +1,231 @@
|
||||
// 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 'package:path/path.dart' as p;
|
||||
|
||||
import 'process_utils.dart';
|
||||
|
||||
enum GeneratorLanguages {
|
||||
cpp,
|
||||
java,
|
||||
kotlin,
|
||||
objc,
|
||||
swift,
|
||||
}
|
||||
|
||||
// A map of pigeons/ files to the languages that they can't yet be generated
|
||||
// for due to limitations of that generator.
|
||||
const Map<String, Set<GeneratorLanguages>> _unsupportedFiles =
|
||||
<String, Set<GeneratorLanguages>>{
|
||||
'enum_args': <GeneratorLanguages>{GeneratorLanguages.cpp},
|
||||
};
|
||||
|
||||
String _snakeToPascalCase(String snake) {
|
||||
final List<String> parts = snake.split('_');
|
||||
return parts
|
||||
.map((String part) =>
|
||||
part.substring(0, 1).toUpperCase() + part.substring(1))
|
||||
.join();
|
||||
}
|
||||
|
||||
// Remaps some file names for Java output, since the filename on Java will be
|
||||
// the name of the generated top-level class. In some cases this is necessary
|
||||
// (e.g., "list", which collides with the Java List class in tests), and in
|
||||
// others it is just preserving previous behavior from the earlier Bash version
|
||||
// of the generation to minimize churn during the migration.
|
||||
// TODO(stuartmorgan): Remove the need for this when addressing
|
||||
// https://github.com/flutter/flutter/issues/115168.
|
||||
String _javaFilenameForName(String inputName) {
|
||||
const Map<String, String> specialCases = <String, String>{
|
||||
'android_unittests': 'Pigeon',
|
||||
'host2flutter': 'Host2Flutter',
|
||||
'list': 'PigeonList',
|
||||
'message': 'MessagePigeon',
|
||||
'voidflutter': 'VoidFlutter',
|
||||
'voidhost': 'VoidHost',
|
||||
};
|
||||
return specialCases[inputName] ?? _snakeToPascalCase(inputName);
|
||||
}
|
||||
|
||||
Future<int> generatePigeons({required String baseDir}) async {
|
||||
// TODO(stuartmorgan): Make this dynamic rather than hard-coded. Or eliminate
|
||||
// it entirely; see https://github.com/flutter/flutter/issues/115169.
|
||||
const List<String> inputs = <String>[
|
||||
'all_datatypes',
|
||||
'all_void',
|
||||
'android_unittests',
|
||||
'async_handlers',
|
||||
'background_platform_channels',
|
||||
'enum_args',
|
||||
'enum',
|
||||
'host2flutter',
|
||||
'java_double_host_api',
|
||||
'list',
|
||||
'message',
|
||||
'multiple_arity',
|
||||
'non_null_fields',
|
||||
'null_fields',
|
||||
'nullable_returns',
|
||||
'primitive',
|
||||
'void_arg_flutter',
|
||||
'void_arg_host',
|
||||
'voidflutter',
|
||||
'voidhost',
|
||||
];
|
||||
|
||||
final String outputBase = p.join(baseDir, 'platform_tests', 'test_plugin');
|
||||
final String alternateOutputBase =
|
||||
p.join(baseDir, 'platform_tests', 'alternate_language_test_plugin');
|
||||
// TODO(stuartmorgan): Eliminate this and use alternateOutputBase.
|
||||
// See https://github.com/flutter/packages/pull/2816.
|
||||
final String iosObjCBase =
|
||||
p.join(baseDir, 'platform_tests', 'ios_unit_tests');
|
||||
|
||||
for (final String input in inputs) {
|
||||
final String pascalCaseName = _snakeToPascalCase(input);
|
||||
final Set<GeneratorLanguages> skipLanguages =
|
||||
_unsupportedFiles[input] ?? <GeneratorLanguages>{};
|
||||
|
||||
// Generate the default language test plugin output.
|
||||
int generateCode = await runPigeon(
|
||||
input: './pigeons/$input.dart',
|
||||
dartOut: '$outputBase/lib/$input.gen.dart',
|
||||
// Android
|
||||
kotlinOut: skipLanguages.contains(GeneratorLanguages.kotlin)
|
||||
? null
|
||||
: '$outputBase/android/src/main/kotlin/com/example/test_plugin/$pascalCaseName.gen.kt',
|
||||
kotlinPackage: 'com.example.test_plugin',
|
||||
// iOS
|
||||
swiftOut: skipLanguages.contains(GeneratorLanguages.swift)
|
||||
? null
|
||||
: '$outputBase/ios/Classes/$pascalCaseName.gen.swift',
|
||||
// Windows
|
||||
cppHeaderOut: skipLanguages.contains(GeneratorLanguages.cpp)
|
||||
? null
|
||||
: '$outputBase/windows/test/$input.gen.h',
|
||||
cppSourceOut: skipLanguages.contains(GeneratorLanguages.cpp)
|
||||
? null
|
||||
: '$outputBase/windows/test/$input.gen.cpp',
|
||||
cppNamespace: '${input}_pigeontest',
|
||||
);
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
|
||||
// macOS has to be run as a separate generation, since currently Pigeon
|
||||
// doesn't have a way to output separate macOS and iOS Swift output in a
|
||||
// single invocation.
|
||||
generateCode = await runPigeon(
|
||||
input: './pigeons/$input.dart',
|
||||
swiftOut: skipLanguages.contains(GeneratorLanguages.swift)
|
||||
? null
|
||||
: '$outputBase/macos/Classes/$pascalCaseName.gen.swift',
|
||||
);
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
|
||||
// Generate the alternate language test plugin output.
|
||||
generateCode = await runPigeon(
|
||||
input: './pigeons/$input.dart',
|
||||
dartOut: '$alternateOutputBase/lib/$input.gen.dart',
|
||||
// Android
|
||||
// This doesn't use the '.gen' suffix since Java has strict file naming
|
||||
// rules.
|
||||
javaOut: skipLanguages.contains(GeneratorLanguages.java)
|
||||
? null
|
||||
: '$alternateOutputBase/android/src/main/java/com/example/'
|
||||
'alternate_language_test_plugin/${_javaFilenameForName(input)}.java',
|
||||
javaPackage: 'com.example.alternate_language_test_plugin',
|
||||
// iOS
|
||||
objcHeaderOut: skipLanguages.contains(GeneratorLanguages.objc)
|
||||
? null
|
||||
: '$iosObjCBase/ios/Runner/$pascalCaseName.gen.h',
|
||||
objcSourceOut: skipLanguages.contains(GeneratorLanguages.objc)
|
||||
? null
|
||||
: '$iosObjCBase/ios/Runner/$pascalCaseName.gen.m',
|
||||
);
|
||||
if (generateCode != 0) {
|
||||
return generateCode;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<int> runPigeon({
|
||||
required String input,
|
||||
String? kotlinOut,
|
||||
String? kotlinPackage,
|
||||
String? swiftOut,
|
||||
String? cppHeaderOut,
|
||||
String? cppSourceOut,
|
||||
String? cppNamespace,
|
||||
String? dartOut,
|
||||
String? dartTestOut,
|
||||
String? javaOut,
|
||||
String? javaPackage,
|
||||
String? objcHeaderOut,
|
||||
String? objcSourceOut,
|
||||
bool streamOutput = true,
|
||||
}) async {
|
||||
const bool hasDart = false;
|
||||
final List<String> args = <String>[
|
||||
'run',
|
||||
'pigeon',
|
||||
'--input',
|
||||
input,
|
||||
'--copyright_header',
|
||||
'./copyright_header.txt',
|
||||
];
|
||||
if (kotlinOut != null) {
|
||||
args.addAll(<String>['--experimental_kotlin_out', kotlinOut]);
|
||||
}
|
||||
if (kotlinPackage != null) {
|
||||
args.addAll(<String>['--experimental_kotlin_package', kotlinPackage]);
|
||||
}
|
||||
if (swiftOut != null) {
|
||||
args.addAll(<String>['--experimental_swift_out', swiftOut]);
|
||||
}
|
||||
if (cppHeaderOut != null) {
|
||||
args.addAll(<String>[
|
||||
'--experimental_cpp_header_out',
|
||||
cppHeaderOut,
|
||||
]);
|
||||
}
|
||||
if (cppSourceOut != null) {
|
||||
args.addAll(<String>[
|
||||
'--experimental_cpp_source_out',
|
||||
cppSourceOut,
|
||||
]);
|
||||
}
|
||||
if (cppNamespace != null) {
|
||||
args.addAll(<String>[
|
||||
'--cpp_namespace',
|
||||
cppNamespace,
|
||||
]);
|
||||
}
|
||||
if (dartOut != null) {
|
||||
args.addAll(<String>['--dart_out', dartOut]);
|
||||
}
|
||||
if (dartTestOut != null) {
|
||||
args.addAll(<String>['--dart_test_out', dartTestOut]);
|
||||
}
|
||||
if (!hasDart) {
|
||||
args.add('--one_language');
|
||||
}
|
||||
if (javaOut != null) {
|
||||
args.addAll(<String>['--java_out', javaOut]);
|
||||
}
|
||||
if (javaPackage != null) {
|
||||
args.addAll(<String>['--java_package', javaPackage]);
|
||||
}
|
||||
if (objcHeaderOut != null) {
|
||||
args.addAll(<String>['--objc_header_out', objcHeaderOut]);
|
||||
}
|
||||
if (objcSourceOut != null) {
|
||||
args.addAll(<String>['--objc_source_out', objcSourceOut]);
|
||||
}
|
||||
return runProcess('dart', args,
|
||||
streamOutput: streamOutput, logFailure: !streamOutput);
|
||||
}
|
71
packages/pigeon/tool/shared/native_project_runners.dart
Normal file
71
packages/pigeon/tool/shared/native_project_runners.dart
Normal file
@ -0,0 +1,71 @@
|
||||
// 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 'dart:io';
|
||||
|
||||
import 'process_utils.dart';
|
||||
|
||||
Future<int> runFlutterCommand(
|
||||
String projectDirectory,
|
||||
String command, [
|
||||
List<String> commandArguments = const <String>[],
|
||||
]) {
|
||||
final String flutterCommand = Platform.isWindows ? 'flutter.bat' : 'flutter';
|
||||
return runProcess(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
command,
|
||||
...commandArguments,
|
||||
],
|
||||
workingDirectory: projectDirectory,
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> runFlutterBuild(
|
||||
String projectDirectory,
|
||||
String target, {
|
||||
bool debug = true,
|
||||
List<String> flags = const <String>[],
|
||||
}) {
|
||||
return runFlutterCommand(
|
||||
projectDirectory,
|
||||
'build',
|
||||
<String>[
|
||||
target,
|
||||
if (debug) '--debug',
|
||||
...flags,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> runXcodeBuild(
|
||||
String nativeProjectDirectory, {
|
||||
String? sdk,
|
||||
String? destination,
|
||||
List<String> extraArguments = const <String>[],
|
||||
}) {
|
||||
return runProcess(
|
||||
'xcodebuild',
|
||||
<String>[
|
||||
'-workspace',
|
||||
'Runner.xcworkspace',
|
||||
'-scheme',
|
||||
'Runner',
|
||||
if (sdk != null) ...<String>['-sdk', sdk],
|
||||
if (destination != null) ...<String>['-destination', destination],
|
||||
...extraArguments,
|
||||
],
|
||||
workingDirectory: nativeProjectDirectory,
|
||||
);
|
||||
}
|
||||
|
||||
Future<int> runGradleBuild(String nativeProjectDirectory, [String? command]) {
|
||||
return runProcess(
|
||||
'./gradlew',
|
||||
<String>[
|
||||
if (command != null) command,
|
||||
],
|
||||
workingDirectory: nativeProjectDirectory,
|
||||
);
|
||||
}
|
32
packages/pigeon/tool/shared/process_utils.dart
Normal file
32
packages/pigeon/tool/shared/process_utils.dart
Normal file
@ -0,0 +1,32 @@
|
||||
// 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 'dart:io' show Process, stderr, stdout;
|
||||
|
||||
Future<Process> _streamOutput(Future<Process> processFuture) async {
|
||||
final Process process = await processFuture;
|
||||
stdout.addStream(process.stdout);
|
||||
stderr.addStream(process.stderr);
|
||||
return process;
|
||||
}
|
||||
|
||||
Future<int> runProcess(String command, List<String> arguments,
|
||||
{String? workingDirectory,
|
||||
bool streamOutput = true,
|
||||
bool logFailure = false}) async {
|
||||
final Future<Process> future = Process.start(
|
||||
command,
|
||||
arguments,
|
||||
workingDirectory: workingDirectory,
|
||||
);
|
||||
final Process process = await (streamOutput ? _streamOutput(future) : future);
|
||||
final int exitCode = await process.exitCode;
|
||||
if (exitCode != 0 && logFailure) {
|
||||
// ignore: avoid_print
|
||||
print('$command $arguments failed:');
|
||||
process.stdout.pipe(stdout);
|
||||
process.stderr.pipe(stderr);
|
||||
}
|
||||
return exitCode;
|
||||
}
|
Reference in New Issue
Block a user