-
Notifications
You must be signed in to change notification settings - Fork 220
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
Add DirectedCodegen to make codegen simpler #1167
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mtdowling
force-pushed
the
directed-codegen-draft
branch
10 times, most recently
from
April 2, 2022 07:33
c09aa2d
to
eed6306
Compare
DirectedCodegen is an attempt to make using all the different pieces of smithy-codegen-core easier. It wires integrations together with your generator, automatically calls all the methods of integrations in the appropriate order, executes the methods of the directed code generator, and provides well-defined methods that help guide new code generation projects. The goal is to point people in the right direction using methods rather than just provide a blank slate and expect everything to built from the ground up.
mtdowling
force-pushed
the
directed-codegen-draft
branch
from
April 2, 2022 07:36
eed6306
to
d50a9d7
Compare
mtdowling
force-pushed
the
directed-codegen-draft
branch
from
April 4, 2022 04:46
a4291ed
to
c907513
Compare
CodegenContext did not previously have a writerDelegator(), but this will almost certainly be implemented in every SmithyIntegration and has been so far in Smithy code generators that have similar abstractions. By Adding a SymbolWriter generic to CodegenContext, we can also simplify the generics needed to implement DirectedCodegen. This provides a big simplification and helps standardize generators, but it does furhter lock-in the design decisions made in SymbolWriter. To account for this and the variance that can occur across languages to generate documentation, the abstract writeDocs methods was removed from SymbolWriter. The impact of this is likely just the removal of an `@Override` annotation in implementations.
mtdowling
force-pushed
the
directed-codegen-draft
branch
from
April 4, 2022 04:51
c907513
to
cf16839
Compare
JordonPhillips
requested changes
Apr 6, 2022
smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/directed/Directive.java
Outdated
Show resolved
Hide resolved
...n-core/src/main/java/software/amazon/smithy/codegen/core/directed/DirectedCodegenRunner.java
Outdated
Show resolved
Hide resolved
...n-core/src/main/java/software/amazon/smithy/codegen/core/directed/DirectedCodegenRunner.java
Outdated
Show resolved
Hide resolved
...n-core/src/main/java/software/amazon/smithy/codegen/core/directed/DirectedCodegenRunner.java
Outdated
Show resolved
Hide resolved
...odegen-core/src/main/java/software/amazon/smithy/codegen/core/directed/GenerateResource.java
Outdated
Show resolved
Hide resolved
kstich
approved these changes
Apr 6, 2022
mtdowling
force-pushed
the
directed-codegen-draft
branch
from
April 6, 2022 21:37
70566e0
to
3d7e566
Compare
We will be added proper enum shapes in Smithy IDL 2.0, and we want code generators to explicitly pay attention to doing this codegen step. Adding a new required directive method later would be a breaking change unless se give it a default implementation, but a default implementation won't force implementers to notice enums need codegen. The solution in this commit is to support both string shape and enum shape codegen from the same directive. Generators need to ask the directive what kind of shape is being generated to know how to perform enum codegen. Generators that perform this transformation in advance can just assume they're only given enum shapes during code generation. Add Directive suffix to directive classes This helps to make their relationship and intent more clear, in particular classes like "Customize" that seemed overly ambiguous.
mtdowling
force-pushed
the
directed-codegen-draft
branch
from
April 6, 2022 22:01
2e0d704
to
8e8a410
Compare
kstich
approved these changes
Apr 6, 2022
JordonPhillips
approved these changes
Apr 7, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DirectedCodegen is an attempt to make using all the different pieces of
smithy-codegen-core easier. It wires integrations together with your
generator, automatically calls all the methods of integrations in the
appropriate order, executes the methods of the directed code generator,
and provides well-defined methods that help guide new code generation
projects. The goal is to point people in the right direction using
methods rather than just provide a blank slate and expect everything to
built from the ground up.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.