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

tool: scaffold files after generating the visited messages #3516

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ func RunGenerateCRD(ctx context.Context, o *GenerateCRDOptions) error {
if err := typeGenerator.VisitProto(resourceProtoFullName); err != nil {
return err
}
}
if err := typeGenerator.WriteVisitedMessages(); err != nil {
return err
}
if err := typeGenerator.WriteOutputMessages(); err != nil {
return err
}

for _, resource := range o.Resources { // A separate loop is needed to scaffold files AFTER all the visited messages have been generated.
if o.SkipScaffoldFiles {
log.Info("skipping scaffolding type, refs and identity files", "resource", resource.ProtoName)
} else {
Expand Down Expand Up @@ -201,14 +209,6 @@ func RunGenerateCRD(ctx context.Context, o *GenerateCRDOptions) error {
}
}

if err := typeGenerator.WriteVisitedMessages(); err != nil {
return err
}

if err := typeGenerator.WriteOutputMessages(); err != nil {
return err
}

addCopyright := true
if err := typeGenerator.WriteFiles(addCopyright); err != nil {
return err
Expand Down
Loading