Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pigeon][swift] Removes FlutterError in favor of PigeonError #6611

Merged
merged 25 commits into from
May 16, 2024

Commits on Apr 25, 2024

  1. [pigeon] Do not use FlutterError when generating Swift code

    Swift has more strict type system than Objective-C. For example,
    protocol conformance must not be redundant[1]. Also, Both FlutterError
    and Swift.Error are public, extension `FlutterError` to `Swift.Error`
    is also public. If someone create a such extension in the plugin
    code, Flutter app can't create a such extension in the app code, which
    forces Plugin developers to use Objective-C when they want to use
    pigeon, instead of Swift.
    
    To avoid this issue, this change makes pigeon to use another error
    type, named PigeonError, instead of FlutterError. By declaring
    PigeonError as internal visibility, their existence won't make
    compilation error even if PigeonError is declared in the app code.
    
    [1] https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Protocol-Conformance-Must-Not-Be-Redundant
    bc-lee committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    c510bd6 View commit details
    Browse the repository at this point in the history
  2. [pigeon] Add option to whether emit PigeonError class in Swift code

    While PigeonError is defined as an internal visibility, so different
    modules don't have problems with the same class name, it's still
    troublesome to have it in the generated code if users call pigeon
    multiple times in the same module.
    To solve this problem, add a new option, `swift_emit_error_class`,
    to control whether to emit the PigeonError class in the generated
    Swift code. The default value is true, which means the PigeonError
    class will be emitted as before.
    bc-lee committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    d8968d7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c2beea1 View commit details
    Browse the repository at this point in the history
  4. [pigeon] Always make sure CoreTests.gen.swift has PigeonError class

    Apparently, when checking `pod lib lint`, other generated files might be
    missing.
    bc-lee committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    6a8a94c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b874f09 View commit details
    Browse the repository at this point in the history
  6. [pigeon] Rename swiftEmitErrorClass to emitPigeonErrorClass

    And add a test for the new option.
    bc-lee committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    df102e3 View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2024

  1. Configuration menu
    Copy the full SHA
    b30a0cc View commit details
    Browse the repository at this point in the history
  2. [pigeon] Emit Error class for Swift with different names per file

    Like Kotlin, to not have a conflict with the same name of the error
    class, we should emit different names for each error class.
    bc-lee committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    30ac050 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    92c97af View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    86d9168 View commit details
    Browse the repository at this point in the history
  5. [pigeon] Apply format fix

    bc-lee committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    20ac87a View commit details
    Browse the repository at this point in the history
  6. [pigeon] Generate Swift error on CoreTests.gen.swift

    This is because `pod lib lint` runs without the generated code.
    Therefore, CoreTests.gen.swift must be able to compile on its own.
    bc-lee committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    800ba60 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8fa6b75 View commit details
    Browse the repository at this point in the history
  8. [pigeon] Run update-excerpts

    bc-lee committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    4bd3dbc View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    fae49ea View commit details
    Browse the repository at this point in the history

Commits on May 8, 2024

  1. Configuration menu
    Copy the full SHA
    b386a96 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2024

  1. Configuration menu
    Copy the full SHA
    78c3bb6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f13a06a View commit details
    Browse the repository at this point in the history
  3. Update the documentation for using PigeonError in Swift

    And replace existing usage of FlutterError.
    bc-lee committed May 9, 2024
    Configuration menu
    Copy the full SHA
    63df915 View commit details
    Browse the repository at this point in the history

Commits on May 10, 2024

  1. Configuration menu
    Copy the full SHA
    428736d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    88cd27d View commit details
    Browse the repository at this point in the history
  3. Addressing review comments

    bc-lee committed May 10, 2024
    Configuration menu
    Copy the full SHA
    a78cae7 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2024

  1. Configuration menu
    Copy the full SHA
    4ed7852 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a8ab4f8 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2024

  1. Configuration menu
    Copy the full SHA
    877015d View commit details
    Browse the repository at this point in the history