From 2d9a886638278090e6d96f4bc34a0cb8c9cb1ff1 Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Thu, 14 Jul 2022 16:33:44 -0400 Subject: [PATCH] dev,genbzl: add support for generating syntax diagrams Release note: None --- dev | 2 +- pkg/cmd/dev/generate.go | 12 ++ pkg/gen/BUILD.bazel | 6 + pkg/gen/bnf.bzl | 256 ++++++++++++++++++++++++++++++++++++++ pkg/gen/diagrams.bzl | 253 +++++++++++++++++++++++++++++++++++++ pkg/gen/gen.bzl | 14 +++ pkg/gen/genbzl/targets.go | 15 ++- 7 files changed, 553 insertions(+), 5 deletions(-) create mode 100644 pkg/gen/bnf.bzl create mode 100644 pkg/gen/diagrams.bzl diff --git a/dev b/dev index 16df7c20d428..6298cf77c05e 100755 --- a/dev +++ b/dev @@ -3,7 +3,7 @@ set -euo pipefail # Bump this counter to force rebuilding `dev` on all machines. -DEV_VERSION=42 +DEV_VERSION=43 THIS_DIR=$(cd "$(dirname "$0")" && pwd) BINARY_DIR=$THIS_DIR/bin/dev-versions diff --git a/pkg/cmd/dev/generate.go b/pkg/cmd/dev/generate.go index 0462dd8970de..5d98dbe1c4a8 100644 --- a/pkg/cmd/dev/generate.go +++ b/pkg/cmd/dev/generate.go @@ -37,6 +37,8 @@ func makeGenerateCmd(runE func(cmd *cobra.Command, args []string) error) *cobra. dev generate bazel # DEPS.bzl and BUILD.bazel files dev generate cgo # files that help non-Bazel systems (IDEs, go) link to our C dependencies dev generate docs # generates documentation + dev generate diagrams # generates syntax diagrams + dev generate bnf # generates syntax bnf files dev generate go # generates go code (execgen, stringer, protobufs, etc.), plus everything 'cgo' generates dev generate go_nocgo # generates go code (execgen, stringer, protobufs, etc.) dev generate protobuf # *.pb.go files (subset of 'dev generate go') @@ -73,6 +75,8 @@ func (d *dev) generate(cmd *cobra.Command, targets []string) error { "parser": d.generateParser, "optgen": d.generateOptGen, "schemachanger": d.generateSchemaChanger, + "diagrams": d.generateDiagrams, + "bnf": d.generateBNF, } if len(targets) == 0 { @@ -199,6 +203,14 @@ func (d *dev) generateSchemaChanger(cmd *cobra.Command) error { return d.generateTarget(cmd.Context(), "//pkg/gen:schemachanger") } +func (d *dev) generateDiagrams(cmd *cobra.Command) error { + return d.generateTarget(cmd.Context(), "//pkg/gen:diagrams") +} + +func (d *dev) generateBNF(cmd *cobra.Command) error { + return d.generateTarget(cmd.Context(), "//pkg/gen:bnf") +} + func (d *dev) generateTarget(ctx context.Context, target string) error { if err := d.exec.CommandContextInheritingStdStreams( ctx, "bazel", "run", target, diff --git a/pkg/gen/BUILD.bazel b/pkg/gen/BUILD.bazel index de9b72777c75..a8e260bfb580 100644 --- a/pkg/gen/BUILD.bazel +++ b/pkg/gen/BUILD.bazel @@ -1,6 +1,8 @@ load( ":gen.bzl", "bindata", + "bnf", + "diagrams", "docs", "execgen", "gen", @@ -33,6 +35,10 @@ parser() schemachanger() +diagrams() + +bnf() + gen( name = "gen", srcs = [ diff --git a/pkg/gen/bnf.bzl b/pkg/gen/bnf.bzl new file mode 100644 index 000000000000..5458603cd3b6 --- /dev/null +++ b/pkg/gen/bnf.bzl @@ -0,0 +1,256 @@ +# Generated by genbzl + +BNF_SRCS = [ + "//docs/generated/sql/bnf:abort_stmt.bnf", + "//docs/generated/sql/bnf:add_column.bnf", + "//docs/generated/sql/bnf:add_constraint.bnf", + "//docs/generated/sql/bnf:alter_backup.bnf", + "//docs/generated/sql/bnf:alter_changefeed.bnf", + "//docs/generated/sql/bnf:alter_column.bnf", + "//docs/generated/sql/bnf:alter_database_add_region_stmt.bnf", + "//docs/generated/sql/bnf:alter_database_add_super_region.bnf", + "//docs/generated/sql/bnf:alter_database_alter_super_region.bnf", + "//docs/generated/sql/bnf:alter_database_drop_region.bnf", + "//docs/generated/sql/bnf:alter_database_drop_super_region.bnf", + "//docs/generated/sql/bnf:alter_database_owner.bnf", + "//docs/generated/sql/bnf:alter_database_primary_region.bnf", + "//docs/generated/sql/bnf:alter_database_stmt.bnf", + "//docs/generated/sql/bnf:alter_database_survival_goal_stmt.bnf", + "//docs/generated/sql/bnf:alter_database_to_schema_stmt.bnf", + "//docs/generated/sql/bnf:alter_ddl_stmt.bnf", + "//docs/generated/sql/bnf:alter_default_privileges_stmt.bnf", + "//docs/generated/sql/bnf:alter_index_partition_by.bnf", + "//docs/generated/sql/bnf:alter_index_stmt.bnf", + "//docs/generated/sql/bnf:alter_partition_stmt.bnf", + "//docs/generated/sql/bnf:alter_primary_key.bnf", + "//docs/generated/sql/bnf:alter_range_relocate_stmt.bnf", + "//docs/generated/sql/bnf:alter_range_stmt.bnf", + "//docs/generated/sql/bnf:alter_rename_view_stmt.bnf", + "//docs/generated/sql/bnf:alter_role_stmt.bnf", + "//docs/generated/sql/bnf:alter_scatter_index_stmt.bnf", + "//docs/generated/sql/bnf:alter_scatter_stmt.bnf", + "//docs/generated/sql/bnf:alter_schema.bnf", + "//docs/generated/sql/bnf:alter_sequence.bnf", + "//docs/generated/sql/bnf:alter_sequence_options_stmt.bnf", + "//docs/generated/sql/bnf:alter_sequence_owner_stmt.bnf", + "//docs/generated/sql/bnf:alter_sequence_set_schema_stmt.bnf", + "//docs/generated/sql/bnf:alter_stmt.bnf", + "//docs/generated/sql/bnf:alter_table.bnf", + "//docs/generated/sql/bnf:alter_table_locality_stmt.bnf", + "//docs/generated/sql/bnf:alter_table_owner_stmt.bnf", + "//docs/generated/sql/bnf:alter_table_partition_by.bnf", + "//docs/generated/sql/bnf:alter_table_reset_storage_param.bnf", + "//docs/generated/sql/bnf:alter_table_set_schema_stmt.bnf", + "//docs/generated/sql/bnf:alter_table_set_storage_param.bnf", + "//docs/generated/sql/bnf:alter_table_stmt.bnf", + "//docs/generated/sql/bnf:alter_tenant_csetting_stmt.bnf", + "//docs/generated/sql/bnf:alter_type.bnf", + "//docs/generated/sql/bnf:alter_view.bnf", + "//docs/generated/sql/bnf:alter_view_owner_stmt.bnf", + "//docs/generated/sql/bnf:alter_view_set_schema_stmt.bnf", + "//docs/generated/sql/bnf:alter_zone_database_stmt.bnf", + "//docs/generated/sql/bnf:alter_zone_index_stmt.bnf", + "//docs/generated/sql/bnf:alter_zone_partition_stmt.bnf", + "//docs/generated/sql/bnf:alter_zone_range_stmt.bnf", + "//docs/generated/sql/bnf:alter_zone_table_stmt.bnf", + "//docs/generated/sql/bnf:analyze_stmt.bnf", + "//docs/generated/sql/bnf:backup.bnf", + "//docs/generated/sql/bnf:begin_stmt.bnf", + "//docs/generated/sql/bnf:begin_transaction.bnf", + "//docs/generated/sql/bnf:cancel_all_jobs_stmt.bnf", + "//docs/generated/sql/bnf:cancel_job.bnf", + "//docs/generated/sql/bnf:cancel_query.bnf", + "//docs/generated/sql/bnf:cancel_session.bnf", + "//docs/generated/sql/bnf:cancel_stmt.bnf", + "//docs/generated/sql/bnf:check_column_level.bnf", + "//docs/generated/sql/bnf:check_table_level.bnf", + "//docs/generated/sql/bnf:close_cursor_stmt.bnf", + "//docs/generated/sql/bnf:col_qualification.bnf", + "//docs/generated/sql/bnf:column_def.bnf", + "//docs/generated/sql/bnf:comment.bnf", + "//docs/generated/sql/bnf:commit_transaction.bnf", + "//docs/generated/sql/bnf:copy_from_stmt.bnf", + "//docs/generated/sql/bnf:create_as_col_qual_list.bnf", + "//docs/generated/sql/bnf:create_as_constraint_def.bnf", + "//docs/generated/sql/bnf:create_changefeed_stmt.bnf", + "//docs/generated/sql/bnf:create_database_stmt.bnf", + "//docs/generated/sql/bnf:create_ddl_stmt.bnf", + "//docs/generated/sql/bnf:create_extension_stmt.bnf", + "//docs/generated/sql/bnf:create_func_stmt.bnf", + "//docs/generated/sql/bnf:create_index_stmt.bnf", + "//docs/generated/sql/bnf:create_index_with_storage_param.bnf", + "//docs/generated/sql/bnf:create_inverted_index_stmt.bnf", + "//docs/generated/sql/bnf:create_role_stmt.bnf", + "//docs/generated/sql/bnf:create_schedule_for_backup_stmt.bnf", + "//docs/generated/sql/bnf:create_schema_stmt.bnf", + "//docs/generated/sql/bnf:create_sequence_stmt.bnf", + "//docs/generated/sql/bnf:create_stats_stmt.bnf", + "//docs/generated/sql/bnf:create_stmt.bnf", + "//docs/generated/sql/bnf:create_table_as_stmt.bnf", + "//docs/generated/sql/bnf:create_table_stmt.bnf", + "//docs/generated/sql/bnf:create_table_with_storage_param.bnf", + "//docs/generated/sql/bnf:create_type.bnf", + "//docs/generated/sql/bnf:create_view_stmt.bnf", + "//docs/generated/sql/bnf:deallocate_stmt.bnf", + "//docs/generated/sql/bnf:declare_cursor_stmt.bnf", + "//docs/generated/sql/bnf:default_value_column_level.bnf", + "//docs/generated/sql/bnf:delete_stmt.bnf", + "//docs/generated/sql/bnf:discard_stmt.bnf", + "//docs/generated/sql/bnf:drop_column.bnf", + "//docs/generated/sql/bnf:drop_constraint.bnf", + "//docs/generated/sql/bnf:drop_database.bnf", + "//docs/generated/sql/bnf:drop_ddl_stmt.bnf", + "//docs/generated/sql/bnf:drop_index.bnf", + "//docs/generated/sql/bnf:drop_owned_by_stmt.bnf", + "//docs/generated/sql/bnf:drop_role_stmt.bnf", + "//docs/generated/sql/bnf:drop_schedule_stmt.bnf", + "//docs/generated/sql/bnf:drop_schema.bnf", + "//docs/generated/sql/bnf:drop_sequence_stmt.bnf", + "//docs/generated/sql/bnf:drop_stmt.bnf", + "//docs/generated/sql/bnf:drop_table.bnf", + "//docs/generated/sql/bnf:drop_type.bnf", + "//docs/generated/sql/bnf:drop_view.bnf", + "//docs/generated/sql/bnf:execute_stmt.bnf", + "//docs/generated/sql/bnf:experimental_audit.bnf", + "//docs/generated/sql/bnf:explain_analyze_stmt.bnf", + "//docs/generated/sql/bnf:explain_stmt.bnf", + "//docs/generated/sql/bnf:explainable_stmt.bnf", + "//docs/generated/sql/bnf:export_stmt.bnf", + "//docs/generated/sql/bnf:family_def.bnf", + "//docs/generated/sql/bnf:fetch_cursor_stmt.bnf", + "//docs/generated/sql/bnf:for_locking.bnf", + "//docs/generated/sql/bnf:foreign_key_column_level.bnf", + "//docs/generated/sql/bnf:foreign_key_table_level.bnf", + "//docs/generated/sql/bnf:generic_set.bnf", + "//docs/generated/sql/bnf:grant_stmt.bnf", + "//docs/generated/sql/bnf:import_csv.bnf", + "//docs/generated/sql/bnf:import_dump.bnf", + "//docs/generated/sql/bnf:import_into.bnf", + "//docs/generated/sql/bnf:index_def.bnf", + "//docs/generated/sql/bnf:insert_rest.bnf", + "//docs/generated/sql/bnf:insert_stmt.bnf", + "//docs/generated/sql/bnf:iso_level.bnf", + "//docs/generated/sql/bnf:joined_table.bnf", + "//docs/generated/sql/bnf:legacy_begin_stmt.bnf", + "//docs/generated/sql/bnf:legacy_end_stmt.bnf", + "//docs/generated/sql/bnf:legacy_transaction_stmt.bnf", + "//docs/generated/sql/bnf:like_table_option_list.bnf", + "//docs/generated/sql/bnf:limit_clause.bnf", + "//docs/generated/sql/bnf:move_cursor_stmt.bnf", + "//docs/generated/sql/bnf:not_null_column_level.bnf", + "//docs/generated/sql/bnf:offset_clause.bnf", + "//docs/generated/sql/bnf:on_conflict.bnf", + "//docs/generated/sql/bnf:opt_frame_clause.bnf", + "//docs/generated/sql/bnf:opt_locality.bnf", + "//docs/generated/sql/bnf:opt_persistence_temp_table.bnf", + "//docs/generated/sql/bnf:opt_with_storage_parameter_list.bnf", + "//docs/generated/sql/bnf:pause_all_jobs_stmt.bnf", + "//docs/generated/sql/bnf:pause_job.bnf", + "//docs/generated/sql/bnf:pause_schedule.bnf", + "//docs/generated/sql/bnf:pause_stmt.bnf", + "//docs/generated/sql/bnf:preparable_stmt.bnf", + "//docs/generated/sql/bnf:prepare_stmt.bnf", + "//docs/generated/sql/bnf:primary_key_column_level.bnf", + "//docs/generated/sql/bnf:primary_key_table_level.bnf", + "//docs/generated/sql/bnf:reassign_owned_by_stmt.bnf", + "//docs/generated/sql/bnf:refresh_materialized_views.bnf", + "//docs/generated/sql/bnf:release_savepoint.bnf", + "//docs/generated/sql/bnf:rename_column.bnf", + "//docs/generated/sql/bnf:rename_constraint.bnf", + "//docs/generated/sql/bnf:rename_database.bnf", + "//docs/generated/sql/bnf:rename_index.bnf", + "//docs/generated/sql/bnf:rename_sequence.bnf", + "//docs/generated/sql/bnf:rename_table.bnf", + "//docs/generated/sql/bnf:reset_csetting_stmt.bnf", + "//docs/generated/sql/bnf:reset_session_stmt.bnf", + "//docs/generated/sql/bnf:reset_stmt.bnf", + "//docs/generated/sql/bnf:restore.bnf", + "//docs/generated/sql/bnf:resume_all_jobs_stmt.bnf", + "//docs/generated/sql/bnf:resume_job.bnf", + "//docs/generated/sql/bnf:resume_schedule.bnf", + "//docs/generated/sql/bnf:resume_stmt.bnf", + "//docs/generated/sql/bnf:revoke_stmt.bnf", + "//docs/generated/sql/bnf:rollback_transaction.bnf", + "//docs/generated/sql/bnf:routine_body_stmt.bnf", + "//docs/generated/sql/bnf:routine_return_stmt.bnf", + "//docs/generated/sql/bnf:row_source_extension_stmt.bnf", + "//docs/generated/sql/bnf:savepoint_stmt.bnf", + "//docs/generated/sql/bnf:scrub_database_stmt.bnf", + "//docs/generated/sql/bnf:scrub_stmt.bnf", + "//docs/generated/sql/bnf:scrub_table_stmt.bnf", + "//docs/generated/sql/bnf:select_clause.bnf", + "//docs/generated/sql/bnf:select_stmt.bnf", + "//docs/generated/sql/bnf:set_cluster_setting.bnf", + "//docs/generated/sql/bnf:set_csetting_stmt.bnf", + "//docs/generated/sql/bnf:set_exprs_internal.bnf", + "//docs/generated/sql/bnf:set_local_stmt.bnf", + "//docs/generated/sql/bnf:set_operation.bnf", + "//docs/generated/sql/bnf:set_or_reset_csetting_stmt.bnf", + "//docs/generated/sql/bnf:set_rest.bnf", + "//docs/generated/sql/bnf:set_rest_more.bnf", + "//docs/generated/sql/bnf:set_session_stmt.bnf", + "//docs/generated/sql/bnf:set_transaction.bnf", + "//docs/generated/sql/bnf:set_transaction_stmt.bnf", + "//docs/generated/sql/bnf:show_backup.bnf", + "//docs/generated/sql/bnf:show_cluster_setting.bnf", + "//docs/generated/sql/bnf:show_columns_stmt.bnf", + "//docs/generated/sql/bnf:show_constraints_stmt.bnf", + "//docs/generated/sql/bnf:show_create_schedules_stmt.bnf", + "//docs/generated/sql/bnf:show_create_stmt.bnf", + "//docs/generated/sql/bnf:show_databases_stmt.bnf", + "//docs/generated/sql/bnf:show_default_privileges_stmt.bnf", + "//docs/generated/sql/bnf:show_enums.bnf", + "//docs/generated/sql/bnf:show_full_scans.bnf", + "//docs/generated/sql/bnf:show_grants_stmt.bnf", + "//docs/generated/sql/bnf:show_indexes_stmt.bnf", + "//docs/generated/sql/bnf:show_jobs.bnf", + "//docs/generated/sql/bnf:show_keys.bnf", + "//docs/generated/sql/bnf:show_local_or_tenant_csettings_stmt.bnf", + "//docs/generated/sql/bnf:show_locality.bnf", + "//docs/generated/sql/bnf:show_locality_stmt.bnf", + "//docs/generated/sql/bnf:show_partitions_stmt.bnf", + "//docs/generated/sql/bnf:show_range_for_row_stmt.bnf", + "//docs/generated/sql/bnf:show_ranges_stmt.bnf", + "//docs/generated/sql/bnf:show_regions.bnf", + "//docs/generated/sql/bnf:show_roles_stmt.bnf", + "//docs/generated/sql/bnf:show_savepoint_status.bnf", + "//docs/generated/sql/bnf:show_schedules.bnf", + "//docs/generated/sql/bnf:show_schemas.bnf", + "//docs/generated/sql/bnf:show_sequences.bnf", + "//docs/generated/sql/bnf:show_session_stmt.bnf", + "//docs/generated/sql/bnf:show_sessions.bnf", + "//docs/generated/sql/bnf:show_statements.bnf", + "//docs/generated/sql/bnf:show_stats.bnf", + "//docs/generated/sql/bnf:show_survival_goal_stmt.bnf", + "//docs/generated/sql/bnf:show_tables.bnf", + "//docs/generated/sql/bnf:show_trace.bnf", + "//docs/generated/sql/bnf:show_transactions_stmt.bnf", + "//docs/generated/sql/bnf:show_transfer_stmt.bnf", + "//docs/generated/sql/bnf:show_types_stmt.bnf", + "//docs/generated/sql/bnf:show_users_stmt.bnf", + "//docs/generated/sql/bnf:show_var.bnf", + "//docs/generated/sql/bnf:show_zone_stmt.bnf", + "//docs/generated/sql/bnf:simple_select_clause.bnf", + "//docs/generated/sql/bnf:sort_clause.bnf", + "//docs/generated/sql/bnf:split_index_at.bnf", + "//docs/generated/sql/bnf:split_table_at.bnf", + "//docs/generated/sql/bnf:stmt.bnf", + "//docs/generated/sql/bnf:stmt_block.bnf", + "//docs/generated/sql/bnf:stmt_without_legacy_transaction.bnf", + "//docs/generated/sql/bnf:table_clause.bnf", + "//docs/generated/sql/bnf:table_constraint.bnf", + "//docs/generated/sql/bnf:table_ref.bnf", + "//docs/generated/sql/bnf:transaction_stmt.bnf", + "//docs/generated/sql/bnf:truncate_stmt.bnf", + "//docs/generated/sql/bnf:unique_column_level.bnf", + "//docs/generated/sql/bnf:unique_table_level.bnf", + "//docs/generated/sql/bnf:unsplit_index_at.bnf", + "//docs/generated/sql/bnf:unsplit_table_at.bnf", + "//docs/generated/sql/bnf:update_stmt.bnf", + "//docs/generated/sql/bnf:upsert_stmt.bnf", + "//docs/generated/sql/bnf:use_stmt.bnf", + "//docs/generated/sql/bnf:validate_constraint.bnf", + "//docs/generated/sql/bnf:values_clause.bnf", + "//docs/generated/sql/bnf:window_definition.bnf", + "//docs/generated/sql/bnf:with_clause.bnf", +] diff --git a/pkg/gen/diagrams.bzl b/pkg/gen/diagrams.bzl new file mode 100644 index 000000000000..bb7fb86140ae --- /dev/null +++ b/pkg/gen/diagrams.bzl @@ -0,0 +1,253 @@ +# Generated by genbzl + +DIAGRAMS_SRCS = [ + "//docs/generated/sql/bnf:abort.html", + "//docs/generated/sql/bnf:add_column.html", + "//docs/generated/sql/bnf:add_constraint.html", + "//docs/generated/sql/bnf:alter.html", + "//docs/generated/sql/bnf:alter_backup.html", + "//docs/generated/sql/bnf:alter_changefeed.html", + "//docs/generated/sql/bnf:alter_column.html", + "//docs/generated/sql/bnf:alter_database.html", + "//docs/generated/sql/bnf:alter_database_add_region.html", + "//docs/generated/sql/bnf:alter_database_add_super_region.html", + "//docs/generated/sql/bnf:alter_database_alter_super_region.html", + "//docs/generated/sql/bnf:alter_database_drop_region.html", + "//docs/generated/sql/bnf:alter_database_drop_super_region.html", + "//docs/generated/sql/bnf:alter_database_owner.html", + "//docs/generated/sql/bnf:alter_database_primary_region.html", + "//docs/generated/sql/bnf:alter_database_survival_goal.html", + "//docs/generated/sql/bnf:alter_database_to_schema.html", + "//docs/generated/sql/bnf:alter_ddl.html", + "//docs/generated/sql/bnf:alter_default_privileges.html", + "//docs/generated/sql/bnf:alter_index.html", + "//docs/generated/sql/bnf:alter_index_partition_by.html", + "//docs/generated/sql/bnf:alter_partition.html", + "//docs/generated/sql/bnf:alter_primary_key.html", + "//docs/generated/sql/bnf:alter_range.html", + "//docs/generated/sql/bnf:alter_range_relocate.html", + "//docs/generated/sql/bnf:alter_rename_view.html", + "//docs/generated/sql/bnf:alter_role.html", + "//docs/generated/sql/bnf:alter_scatter.html", + "//docs/generated/sql/bnf:alter_scatter_index.html", + "//docs/generated/sql/bnf:alter_schema.html", + "//docs/generated/sql/bnf:alter_sequence.html", + "//docs/generated/sql/bnf:alter_sequence_options.html", + "//docs/generated/sql/bnf:alter_sequence_owner.html", + "//docs/generated/sql/bnf:alter_sequence_set_schema.html", + "//docs/generated/sql/bnf:alter_table.html", + "//docs/generated/sql/bnf:alter_table_locality.html", + "//docs/generated/sql/bnf:alter_table_owner.html", + "//docs/generated/sql/bnf:alter_table_partition_by.html", + "//docs/generated/sql/bnf:alter_table_reset_storage_param.html", + "//docs/generated/sql/bnf:alter_table_set_schema.html", + "//docs/generated/sql/bnf:alter_table_set_storage_param.html", + "//docs/generated/sql/bnf:alter_tenant_csetting.html", + "//docs/generated/sql/bnf:alter_type.html", + "//docs/generated/sql/bnf:alter_view.html", + "//docs/generated/sql/bnf:alter_view_owner.html", + "//docs/generated/sql/bnf:alter_view_set_schema.html", + "//docs/generated/sql/bnf:alter_zone_database.html", + "//docs/generated/sql/bnf:alter_zone_index.html", + "//docs/generated/sql/bnf:alter_zone_partition.html", + "//docs/generated/sql/bnf:alter_zone_range.html", + "//docs/generated/sql/bnf:alter_zone_table.html", + "//docs/generated/sql/bnf:analyze.html", + "//docs/generated/sql/bnf:backup.html", + "//docs/generated/sql/bnf:begin.html", + "//docs/generated/sql/bnf:begin_transaction.html", + "//docs/generated/sql/bnf:cancel.html", + "//docs/generated/sql/bnf:cancel_all_jobs.html", + "//docs/generated/sql/bnf:cancel_job.html", + "//docs/generated/sql/bnf:cancel_query.html", + "//docs/generated/sql/bnf:cancel_session.html", + "//docs/generated/sql/bnf:check_column_level.html", + "//docs/generated/sql/bnf:check_table_level.html", + "//docs/generated/sql/bnf:close_cursor.html", + "//docs/generated/sql/bnf:col_qualification.html", + "//docs/generated/sql/bnf:column_def.html", + "//docs/generated/sql/bnf:comment.html", + "//docs/generated/sql/bnf:commit_transaction.html", + "//docs/generated/sql/bnf:copy_from.html", + "//docs/generated/sql/bnf:create.html", + "//docs/generated/sql/bnf:create_as_col_qual_list.html", + "//docs/generated/sql/bnf:create_as_constraint_def.html", + "//docs/generated/sql/bnf:create_changefeed.html", + "//docs/generated/sql/bnf:create_database.html", + "//docs/generated/sql/bnf:create_ddl.html", + "//docs/generated/sql/bnf:create_extension.html", + "//docs/generated/sql/bnf:create_func.html", + "//docs/generated/sql/bnf:create_index.html", + "//docs/generated/sql/bnf:create_index_with_storage_param.html", + "//docs/generated/sql/bnf:create_inverted_index.html", + "//docs/generated/sql/bnf:create_role.html", + "//docs/generated/sql/bnf:create_schedule_for_backup.html", + "//docs/generated/sql/bnf:create_schema.html", + "//docs/generated/sql/bnf:create_sequence.html", + "//docs/generated/sql/bnf:create_stats.html", + "//docs/generated/sql/bnf:create_table.html", + "//docs/generated/sql/bnf:create_table_as.html", + "//docs/generated/sql/bnf:create_table_with_storage_param.html", + "//docs/generated/sql/bnf:create_type.html", + "//docs/generated/sql/bnf:create_view.html", + "//docs/generated/sql/bnf:deallocate.html", + "//docs/generated/sql/bnf:declare_cursor.html", + "//docs/generated/sql/bnf:default_value_column_level.html", + "//docs/generated/sql/bnf:delete.html", + "//docs/generated/sql/bnf:discard.html", + "//docs/generated/sql/bnf:drop.html", + "//docs/generated/sql/bnf:drop_column.html", + "//docs/generated/sql/bnf:drop_constraint.html", + "//docs/generated/sql/bnf:drop_database.html", + "//docs/generated/sql/bnf:drop_ddl.html", + "//docs/generated/sql/bnf:drop_index.html", + "//docs/generated/sql/bnf:drop_owned_by.html", + "//docs/generated/sql/bnf:drop_role.html", + "//docs/generated/sql/bnf:drop_schedule.html", + "//docs/generated/sql/bnf:drop_schema.html", + "//docs/generated/sql/bnf:drop_sequence.html", + "//docs/generated/sql/bnf:drop_table.html", + "//docs/generated/sql/bnf:drop_type.html", + "//docs/generated/sql/bnf:drop_view.html", + "//docs/generated/sql/bnf:execute.html", + "//docs/generated/sql/bnf:experimental_audit.html", + "//docs/generated/sql/bnf:explain.html", + "//docs/generated/sql/bnf:explain_analyze.html", + "//docs/generated/sql/bnf:explainable.html", + "//docs/generated/sql/bnf:export.html", + "//docs/generated/sql/bnf:family_def.html", + "//docs/generated/sql/bnf:fetch_cursor.html", + "//docs/generated/sql/bnf:for_locking.html", + "//docs/generated/sql/bnf:foreign_key_column_level.html", + "//docs/generated/sql/bnf:foreign_key_table_level.html", + "//docs/generated/sql/bnf:generic_set.html", + "//docs/generated/sql/bnf:grant.html", + "//docs/generated/sql/bnf:import_csv.html", + "//docs/generated/sql/bnf:import_dump.html", + "//docs/generated/sql/bnf:import_into.html", + "//docs/generated/sql/bnf:index_def.html", + "//docs/generated/sql/bnf:insert.html", + "//docs/generated/sql/bnf:insert_rest.html", + "//docs/generated/sql/bnf:iso_level.html", + "//docs/generated/sql/bnf:joined_table.html", + "//docs/generated/sql/bnf:legacy_begin.html", + "//docs/generated/sql/bnf:legacy_end.html", + "//docs/generated/sql/bnf:legacy_transaction.html", + "//docs/generated/sql/bnf:like_table_option_list.html", + "//docs/generated/sql/bnf:limit_clause.html", + "//docs/generated/sql/bnf:move_cursor.html", + "//docs/generated/sql/bnf:not_null_column_level.html", + "//docs/generated/sql/bnf:offset_clause.html", + "//docs/generated/sql/bnf:on_conflict.html", + "//docs/generated/sql/bnf:opt_frame_clause.html", + "//docs/generated/sql/bnf:opt_locality.html", + "//docs/generated/sql/bnf:opt_persistence_temp_table.html", + "//docs/generated/sql/bnf:opt_with_storage_parameter_list.html", + "//docs/generated/sql/bnf:pause.html", + "//docs/generated/sql/bnf:pause_all_jobs.html", + "//docs/generated/sql/bnf:pause_job.html", + "//docs/generated/sql/bnf:pause_schedule.html", + "//docs/generated/sql/bnf:preparable.html", + "//docs/generated/sql/bnf:prepare.html", + "//docs/generated/sql/bnf:primary_key_column_level.html", + "//docs/generated/sql/bnf:primary_key_table_level.html", + "//docs/generated/sql/bnf:reassign_owned_by.html", + "//docs/generated/sql/bnf:refresh_materialized_views.html", + "//docs/generated/sql/bnf:release_savepoint.html", + "//docs/generated/sql/bnf:rename_column.html", + "//docs/generated/sql/bnf:rename_constraint.html", + "//docs/generated/sql/bnf:rename_database.html", + "//docs/generated/sql/bnf:rename_index.html", + "//docs/generated/sql/bnf:rename_sequence.html", + "//docs/generated/sql/bnf:rename_table.html", + "//docs/generated/sql/bnf:reset.html", + "//docs/generated/sql/bnf:reset_csetting.html", + "//docs/generated/sql/bnf:reset_session.html", + "//docs/generated/sql/bnf:restore.html", + "//docs/generated/sql/bnf:resume.html", + "//docs/generated/sql/bnf:resume_all_jobs.html", + "//docs/generated/sql/bnf:resume_job.html", + "//docs/generated/sql/bnf:resume_schedule.html", + "//docs/generated/sql/bnf:revoke.html", + "//docs/generated/sql/bnf:rollback_transaction.html", + "//docs/generated/sql/bnf:routine_body.html", + "//docs/generated/sql/bnf:routine_return.html", + "//docs/generated/sql/bnf:row_source_extension.html", + "//docs/generated/sql/bnf:savepoint.html", + "//docs/generated/sql/bnf:scrub.html", + "//docs/generated/sql/bnf:scrub_database.html", + "//docs/generated/sql/bnf:scrub_table.html", + "//docs/generated/sql/bnf:select.html", + "//docs/generated/sql/bnf:select_clause.html", + "//docs/generated/sql/bnf:set_cluster_setting.html", + "//docs/generated/sql/bnf:set_csetting.html", + "//docs/generated/sql/bnf:set_exprs_internal.html", + "//docs/generated/sql/bnf:set_local.html", + "//docs/generated/sql/bnf:set_operation.html", + "//docs/generated/sql/bnf:set_or_reset_csetting.html", + "//docs/generated/sql/bnf:set_rest.html", + "//docs/generated/sql/bnf:set_rest_more.html", + "//docs/generated/sql/bnf:set_session.html", + "//docs/generated/sql/bnf:set_transaction.html", + "//docs/generated/sql/bnf:show_backup.html", + "//docs/generated/sql/bnf:show_cluster_setting.html", + "//docs/generated/sql/bnf:show_columns.html", + "//docs/generated/sql/bnf:show_constraints.html", + "//docs/generated/sql/bnf:show_create.html", + "//docs/generated/sql/bnf:show_create_schedules.html", + "//docs/generated/sql/bnf:show_databases.html", + "//docs/generated/sql/bnf:show_default_privileges.html", + "//docs/generated/sql/bnf:show_enums.html", + "//docs/generated/sql/bnf:show_full_scans.html", + "//docs/generated/sql/bnf:show_grants.html", + "//docs/generated/sql/bnf:show_indexes.html", + "//docs/generated/sql/bnf:show_jobs.html", + "//docs/generated/sql/bnf:show_keys.html", + "//docs/generated/sql/bnf:show_local_or_tenant_csettings.html", + "//docs/generated/sql/bnf:show_locality.html", + "//docs/generated/sql/bnf:show_partitions.html", + "//docs/generated/sql/bnf:show_range_for_row.html", + "//docs/generated/sql/bnf:show_ranges.html", + "//docs/generated/sql/bnf:show_regions.html", + "//docs/generated/sql/bnf:show_roles.html", + "//docs/generated/sql/bnf:show_savepoint_status.html", + "//docs/generated/sql/bnf:show_schedules.html", + "//docs/generated/sql/bnf:show_schemas.html", + "//docs/generated/sql/bnf:show_sequences.html", + "//docs/generated/sql/bnf:show_session.html", + "//docs/generated/sql/bnf:show_sessions.html", + "//docs/generated/sql/bnf:show_statements.html", + "//docs/generated/sql/bnf:show_stats.html", + "//docs/generated/sql/bnf:show_survival_goal.html", + "//docs/generated/sql/bnf:show_tables.html", + "//docs/generated/sql/bnf:show_trace.html", + "//docs/generated/sql/bnf:show_transactions.html", + "//docs/generated/sql/bnf:show_transfer.html", + "//docs/generated/sql/bnf:show_types.html", + "//docs/generated/sql/bnf:show_users.html", + "//docs/generated/sql/bnf:show_var.html", + "//docs/generated/sql/bnf:show_zone.html", + "//docs/generated/sql/bnf:simple_select_clause.html", + "//docs/generated/sql/bnf:sort_clause.html", + "//docs/generated/sql/bnf:split_index_at.html", + "//docs/generated/sql/bnf:split_table_at.html", + "//docs/generated/sql/bnf:stmt.html", + "//docs/generated/sql/bnf:stmt_block.html", + "//docs/generated/sql/bnf:stmt_without_legacy_transaction.html", + "//docs/generated/sql/bnf:table_clause.html", + "//docs/generated/sql/bnf:table_constraint.html", + "//docs/generated/sql/bnf:table_ref.html", + "//docs/generated/sql/bnf:transaction.html", + "//docs/generated/sql/bnf:truncate.html", + "//docs/generated/sql/bnf:unique_column_level.html", + "//docs/generated/sql/bnf:unique_table_level.html", + "//docs/generated/sql/bnf:unsplit_index_at.html", + "//docs/generated/sql/bnf:unsplit_table_at.html", + "//docs/generated/sql/bnf:update.html", + "//docs/generated/sql/bnf:upsert.html", + "//docs/generated/sql/bnf:use.html", + "//docs/generated/sql/bnf:validate_constraint.html", + "//docs/generated/sql/bnf:values_clause.html", + "//docs/generated/sql/bnf:window_definition.html", + "//docs/generated/sql/bnf:with_clause.html", +] diff --git a/pkg/gen/gen.bzl b/pkg/gen/gen.bzl index 367991521389..b94e36a59dbb 100644 --- a/pkg/gen/gen.bzl +++ b/pkg/gen/gen.bzl @@ -29,6 +29,8 @@ load(":protobuf.bzl", "PROTOBUF_SRCS") load(":stringer.bzl", "STRINGER_SRCS") load(":parser.bzl", "PARSER_SRCS") load(":schemachanger.bzl", "SCHEMACHANGER_SRCS") +load(":diagrams.bzl", "DIAGRAMS_SRCS") +load(":bnf.bzl", "BNF_SRCS") # GeneratedFileInfo provides two pieces of information to the _hoist_files # rule. It provides the set of files to be hoisted via the generated_files @@ -295,5 +297,17 @@ def schemachanger(): srcs = SCHEMACHANGER_SRCS, ) +def diagrams(): + _hoist_no_prefix( + name = "diagrams", + srcs = DIAGRAMS_SRCS, + ) + +def bnf(): + _hoist_no_prefix( + name = "bnf", + srcs = BNF_SRCS, + ) + def gen(name, srcs): _hoist_files(name = name, data = srcs, tags = ["no-remote-exec"]) diff --git a/pkg/gen/genbzl/targets.go b/pkg/gen/genbzl/targets.go index 563dc522d8b5..11cb0ca2e7e8 100644 --- a/pkg/gen/genbzl/targets.go +++ b/pkg/gen/genbzl/targets.go @@ -53,11 +53,17 @@ let targets = attr("exec_tools", "(opt|lang)gen", kind("genrule rule", {{ .All in let og = labels("outs", $targets) in $og - filter(".*:.*(-gen|gen-).*", $og)`, }, + { + target: "diagrams", + query: `labels("outs", //docs/generated/sql/bnf:svg)`, + }, + { + target: "bnf", + query: `labels("outs", //docs/generated/sql/bnf:bnf)`, + }, { target: "docs", - query: ` -kind("generated file", //docs/...:*) - - labels("outs", //docs/generated/sql/bnf:svg)`, + query: `kind("generated file", //docs/...:*) - ({{ template "diagrams" $ }})`, }, { target: "parser", @@ -79,7 +85,6 @@ in ($all ^ labels("out", kind("_gomock_prog_gen rule", {{ .All }}))) + //pkg/testutils/lint/passes/errcheck:errcheck_excludes.txt + //build/bazelutil:test_force_build_cdeps.txt + //build/bazelutil:test_stamping.txt - + labels("outs", //docs/generated/sql/bnf:svg) `, doNotGenerate: true, }, @@ -101,6 +106,8 @@ kind("generated file", {{ .All }}) - ( + ({{ template "excluded" $ }}) + ({{ template "parser" $ }}) + ({{ template "schemachanger" $ }}) + + ({{ template "diagrams" $ }}) + + ({{ template "bnf" $ }}) )`, }, }