crossplane-contrib / terraform-provider-gen

Apache License 2.0
13 stars 3 forks source link

Ordering of code generation stages #4

Closed kasey closed 3 years ago

kasey commented 3 years ago

Currently there is a circular dependency in the code generation process. Before the controller-gen and angryjet tools are run, a generated type asserted as a resource.Managed or metav1.Object will be invalid, because the methodsets that satisfy these interfaces are not yet present.

controller-gen and angryjet can't run on invalid code, so the source files that rely on these type assertions or inferences (compare.go, encode.go, decode.go) can't be put in place until after these tools have successfully run.

The code generation tool needs to break up the process of generating source files into a couple distinct stages for this to flow cleanly from a single execution:

Note that all these files are currently generated, this issue is simply about refactoring the code that drives code generation to reorder them and take a break to run go generate after the first step.