-
Notifications
You must be signed in to change notification settings - Fork 7
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 overlay support to codegen #402
Conversation
9ae47b8
to
cac9714
Compare
a602349
to
fd8162e
Compare
blocked by #407 |
fd8162e
to
ce9d644
Compare
ce9d644
to
8a0f5e4
Compare
Depends on #409 |
a279479
to
f29a8ab
Compare
I've addressed the comments, ready for re-review |
3bff8ba
to
ad0a44c
Compare
Note to self: split the refactoring and the changes, postpone the changes, merge the refactoring. |
- add support for overlays in codegen - refactor codegen to allow for the required changes to be made
ad0a44c
to
6aaa82b
Compare
I've reduced the scope of this PR to only include the mechanism for overlays and associated refactoring, without any specific overlay implemented. |
@@ -2,6 +2,25 @@ package besom.codegen | |||
|
|||
import besom.model.SemanticVersion | |||
|
|||
case class Config( |
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.
One unified Config
instead of separate CodegenConfig
, ProviderConfig
objectTypeTokens: Set[String], | ||
resourceTypeTokens: Set[String], | ||
enumValueToInstances: Map[PulumiToken, Map[ConstValue, EnumInstanceName]], | ||
parsedTypes: Map[PulumiDefinitionCoordinates, (TypeDefinition, Boolean)], |
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.
we pre-process the schema and store parsed types, resources and functions
parsedResources: Map[PulumiDefinitionCoordinates, (ResourceDefinition, Boolean)], | ||
parsedFunctions: Map[PulumiDefinitionCoordinates, (FunctionDefinition, Boolean)] | ||
)( | ||
private[codegen] val pulumiPackage: PulumiPackage, |
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.
store a reference to the deserialized schema
parsedFunctions: Map[PulumiDefinitionCoordinates, (FunctionDefinition, Boolean)] | ||
)( | ||
private[codegen] val pulumiPackage: PulumiPackage, | ||
private[codegen] val providerConfig: Config.Provider |
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.
store provider related config (e.g. overlays) per schema
def asPackageMetadata: PackageMetadata = PackageMetadata(name, Some(version)) | ||
|
||
def parseMethods( |
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.
the parsing logic moved from other places (mostly SchemaProvider and PulumiPackageOps)
def from( | ||
pulumiPackage: PulumiPackage, | ||
packageMetadata: PackageMetadata | ||
)(using Logger, Config): PulumiPackageInfo = PreProcessed.from(pulumiPackage, packageMetadata).process |
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.
invoke the new 2-stage schema processing
implicit val
changed togiven
/using
Config
with added overlays dir setting (overlaysDir
/DefaultOverlaysDir
)PulumiPackageInfo
PulumiPackageInfo
PulumiPackageInfo
SchemaProvider
andPulumiPackageOps
toPulumiPackageInfo
Overlay.scala
)fixes #286 (was closed as done, but we were just ignoring the overlays, now we can add them)