-
Notifications
You must be signed in to change notification settings - Fork 433
Generate availability annotations #2232
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
Conversation
Motivation: gRPC is moving from specifying the platforms in the package manifest to annotating code with availability annotations. In order to do this the generateed code must also be annotated. Modifications: - Generate appropriate annotations Result: Generated code has availability annotations
@@ -341,6 +353,7 @@ extension [CodeBlock] { | |||
package static func serviceMetadata( | |||
accessModifier: AccessModifier? = nil, | |||
service: ServiceDescriptor, | |||
availability: AvailabilityDescription, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API breakage is detecting a false positive here:
3 breaking changes detected in GRPCCodeGen:
💔 API breakage: func Array.serviceMetadata(accessModifier:service:namer:) has parameter 2 type change from GRPCCodeGen.Namer to GRPCCodeGen.AvailabilityDescription
💔 API breakage: func Array.serviceMetadata(accessModifier:service:namer:) has removed default argument from parameter 2
💔 API breakage: func Array.serviceMetadata(accessModifier:service:namer:) has been renamed to func serviceMetadata(accessModifier:service:availability:namer:)
/// The default platform availability is: | ||
/// - macOS 15.0 | ||
/// - iOS 18.0 | ||
/// - tvOS 18.0 | ||
/// - watchOS 11.0 | ||
/// - visionOS 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we include macCatalyst
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macCatalyst
is a derivative of iOS so it doesn't need to be included in the availability annotations (unless its availability differs from iOS).
I couldn't find authoritative documentation on this, but:
- NSHipster has an article on availability which mentions the same here
- Swift doesn't include macCatalyst in its availability macros (see here)
I also just tested this locally by building code for Mac Catalyst which only had iOS availability annotations on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL. We should reconsider what we do in other projects then, because we have added it explicitly elsewhere.
Co-authored-by: Gus Cairo <[email protected]>
Motivation:
gRPC is moving from specifying the platforms in the package manifest to annotating code with availability annotations. In order to do this the generateed code must also be annotated.
Modifications:
Result:
Generated code has availability annotations