Skip to content

Conversation

@stefanadranca
Copy link
Collaborator

Motivation:

The protocols from GRPCCore that structs and protocols from the generated code conform to can be used only for some OSes, so we need to add the same availability guards in the generated code.

Modifications:

  • created the AvailabilityDescription struct in StructuredSwiftRepresentation
  • created the declaraion for a guarded declaration
  • created the rendering functions for guarded declarations and the availability guard
  • added the guarded declaration in the translators where needed
  • changed the tests accordingly

Result:

The generated code will contain the necessary availability guards.

Motivation:

The protocols from GRPCCore that structs and protocols from the generated code conform to
can be used only for some OSes, so we need to add the same availability guards in the generated
code.

Modifications:

- created the AvailabilityDescription struct in StructuredSwiftRepresentation
- created the declaraion for a guarded declaration
- created the rendering functions for guarded declarations and the availability guard
- added the guarded declaration in the translators where needed
- changed the tests accordingly

Result:

The generated code will contain the necessary availability guards.
@stefanadranca stefanadranca requested a review from glbrntt February 5, 2024 17:55
Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

This looks good but needs a test for the text based renderer

Comment on lines +1080 to +1083
func renderGuardedDeclaration(availability: AvailabilityDescription, declaration: Declaration) {
renderAvailability(availability)
renderDeclaration(declaration)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a test to the TextBasedRendererTests for this?

@glbrntt glbrntt merged commit 0daf4a1 into grpc:main Feb 6, 2024
@glbrntt glbrntt added the version/v2 Relates to v2 label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version/v2 Relates to v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants