Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented May 6, 2025

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

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
@glbrntt glbrntt added the 🆕 semver/minor Adds new public API. label May 6, 2025
@glbrntt glbrntt requested a review from gjcairo May 6, 2025 12:53
@glbrntt glbrntt enabled auto-merge (squash) May 6, 2025 12:53
package static func serviceMetadata(
accessModifier: AccessModifier? = nil,
service: ServiceDescriptor,
availability: AvailabilityDescription,
Copy link
Collaborator Author

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:)

Comment on lines +117 to +122
/// The default platform availability is:
/// - macOS 15.0
/// - iOS 18.0
/// - tvOS 18.0
/// - watchOS 11.0
/// - visionOS 2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include macCatalyst?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

@glbrntt glbrntt requested a review from gjcairo May 7, 2025 13:43
@glbrntt glbrntt disabled auto-merge May 8, 2025 07:06
@glbrntt glbrntt merged commit b18eb73 into grpc:main May 8, 2025
35 of 36 checks passed
@glbrntt glbrntt deleted the v2/availability-code-gen branch May 8, 2025 07:06
@rnro rnro mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants