forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bazel,dev: add robust support/validation for checked-in generated code
While testing cockroachdb#68663, I noticed that there were a few build targets that didn't look as I expected since they referenced checked-in generated code in order to generate that same code in the sandbox -- e.g., the checked-in `batch_generated.go` was used to generate an (identical) file `batch_generated-gen.go` within the sandbox. I filed the issue cockroachdb#68654 to investigate this, and gave a college try to stamping out the recursive structure by refactoring the affected code. I wasn't successful :( While looking at this I encountered comments by Irfan in `pkg/{roachpb/gen,sql/opt/optgen/cmd/langgen}/BUILD.bazel` explaining that this generated code needs to remain checked-in in order to bootstrap new versions of the code, and that our tooling needs to have support for extracting this code back into the workspace so devs can have a sane workflow. Fair enough, so this PR implements all of that. * Add `dev generate go` to generate the checked-in generated code; * fix up `dev generate` so that it generates for `bazel`, `docs`, and `go` altogether (so `dev generate` is a one-step thing you can do to generate everything you'll need to pass CI); * build the generated Go code via the sandbox in CI and test to make sure it matches what's checked in. Closes cockroachdb#68654. Release note: None
- Loading branch information
1 parent
ab15e5f
commit 522e15b
Showing
11 changed files
with
218 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# These files are generated by the build system, but also must be | ||
# checked into tree. The syntax here is: | ||
# $TARGET|$GENERATED_FILENAME|$FILENAME_TO_RENAME_TO | ||
# This list is consumed by `dev` as well as in CI for validation. | ||
# Lines beginning with # are ignored. | ||
//pkg/roachpb:gen-batch-generated|batch_generated-gen.go|batch_generated.go | ||
//pkg/sql/opt/optgen/lang:gen-expr|expr-gen.og.go|expr.og.go | ||
//pkg/sql/opt/optgen/lang:gen-operator|operator-gen.og.go|operator.og.go |
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
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
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
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
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
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
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
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
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
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