[pigeon] Allows swift generator to skip error class generation
Since the Kotlin generator allows skipping error class generation, it makes sense for the Swift generator to have the same option.
Related to: #6183 https://github.com/flutter/flutter/issues/142099
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene page, which explains my responsibilities.
- [x] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use
dart format.) - [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I linked to at least one issue that this PR fixes in the description above.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [x] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes. - [x] I updated/added relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Hi @tarrinneal,
In your previous PR #6183 , there are a few parts that I don't really understand (mostly about how to generate test files), for example the code kotlinIncludeErrorClass: input != 'core_tests', in packages/pigeon/tool/shared/generation.dart. Could you please guide me through these test cases?
looks like the test cases using the default error class name in Swift have failed.
How can I run those custom_package_tests test cases on my local machine?
if you navigate to the pigeon directory you can run dart run tool/test.dart -f -t ios_swift_integration_tests
This code
final bool kotlinErrorClassGenerationTestFiles =
input == 'core_tests' || input == 'background_platform_channels';
final String kotlinErrorName = kotlinErrorClassGenerationTestFiles
? 'FlutterError'
: '${pascalCaseName}Error';
and the corresponding usage of kotlinErrorName ensures that there are two files with the same error class name. You'll need to do that for swift as well.
if you navigate to the pigeon directory you can run
dart run tool/test.dart -f -t ios_swift_integration_tests
Thanks @tarrinneal I am now able to run those test cases.
and the corresponding usage of kotlinErrorName ensures that there are two files with the same error class name. You'll need to do that for swift as well.
I saw swiftErrorUseDefaultErrorName which has the same purpose as kotlinErrorClassGenerationTestFiles. Updated!
@stuartmorgan for 2nd review