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

feat: add directed codegen #681

Merged
merged 2 commits into from
Mar 27, 2024
Merged

feat: add directed codegen #681

merged 2 commits into from
Mar 27, 2024

Conversation

AndrewFossAWS
Copy link
Contributor

@AndrewFossAWS AndrewFossAWS commented Mar 14, 2024

Description of changes

  • Implement directed codegen
  • Verified the geneated code changes remain the same for aws-sdk-swift

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


class DirectedSwiftCodegen(val context: PluginContext) :
DirectedCodegen<GenerationContext, SwiftSettings, SwiftIntegration> {
private val LOGGER = Logger.getLogger(javaClass.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: is there a Kotlin logging library we should be using instead of the Java one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there is an "official" kotlin logging library so I am using the Java one for now. Can add it later if needed to.

Copy link
Contributor

@sichanyoo sichanyoo left a comment

Choose a reason for hiding this comment

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

A suggestion and a question.

Comment on lines +289 to +277
putFormatter('D', SwiftSymbolFormatter(shouldSetDefault = true, shouldRenderOptional = true))
putFormatter('T', SwiftSymbolFormatter(shouldSetDefault = false, shouldRenderOptional = true))
putFormatter('N', SwiftSymbolFormatter(shouldSetDefault = false, shouldRenderOptional = false))
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the usecases for these formatters? Could comments be added here for quick reference?

Copy link
Contributor

@syall syall left a comment

Choose a reason for hiding this comment

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

Approving pending CI passes.

For ktlint, you can run ./gradlew ktlint and ./gradlew ktlintFormat

…emove CodegenVisitor and add missing CustomDebugStringConvertibleGenerator to directed codegen
@AndrewFossAWS AndrewFossAWS merged commit abc38fb into main Mar 27, 2024
12 checks passed
@AndrewFossAWS AndrewFossAWS deleted the dcg branch March 27, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants