1 # Copyright (c) 2009-2024, Google LLC
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file or at
6 # https://developers.google.com/open-source/licenses/bsd
8 load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
9 load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_CPPOPTS")
11 "//upb_generator:bootstrap_compiler.bzl",
12 "bootstrap_cc_binary",
13 "bootstrap_cc_library",
16 package(default_applicable_licenses = ["//:license"])
27 hdrs = ["generator.h"],
29 "//upb_generator:common",
30 "//upb_generator:file_layout",
31 "//upb_generator:plugin",
32 "//upb_generator:plugin_upb_proto",
33 "//upb/reflection:descriptor_upb_proto",
34 "//upb/reflection:reflection",
36 copts = UPB_DEFAULT_CPPOPTS,
40 "//src/google/protobuf/compiler:code_generator_lite",
46 "//upb/mini_table:internal",
47 "//upb_generator/common:names",
48 "@com_google_absl//absl/container:flat_hash_map",
49 "@com_google_absl//absl/container:flat_hash_set",
50 "@com_google_absl//absl/log:absl_check",
51 "@com_google_absl//absl/log:absl_log",
52 "@com_google_absl//absl/strings",
61 "//src/google/protobuf/compiler/hpb:__pkg__",
62 "//src/google/protobuf/compiler/rust:__pkg__",
63 "//third_party/kotlin/protobuf/generator/native:__pkg__",
64 "//upb_generator:__subpackages__",
69 "@com_google_absl//absl/strings",
74 name = "names_internal",
75 srcs = ["names_internal.cc"],
76 hdrs = ["names_internal.h"],
79 "//upb_generator/c:__pkg__",
82 "//upb_generator/common:names",
83 "@com_google_absl//absl/strings",
88 name = "protoc-gen-upb_minitable",
90 ":generator_with_main",
92 copts = UPB_DEFAULT_CPPOPTS,
94 "//editions/codegen_tests:__pkg__",
95 "//net/proto2/contrib/protoc_explorer:__pkg__",
96 "//rust:__subpackages__",
97 "//third_party/prototiller/transformer:__pkg__",
101 # TODO: This wrapper lib is a hack that we need because of how CcInfo works in Bazel 6.
102 # In Bazel 7, our cmake dependency scraping works fine with cc_binary.
103 bootstrap_cc_library(
104 name = "generator_with_main",
108 "//upb_generator:file_layout",
109 "//upb_generator:common",
110 "//upb_generator:plugin",
111 "//upb/reflection:reflection",
113 copts = UPB_DEFAULT_CPPOPTS,
114 visibility = ["//pkg:__pkg__"],
118 "//src/google/protobuf/compiler:code_generator_lite",
121 "//upb_generator/common:names",
122 "@com_google_absl//absl/log:absl_check",
123 "@com_google_absl//absl/log:absl_log",
124 "@com_google_absl//absl/strings",
128 proto_lang_toolchain(
130 command_line = "--upb_minitable_out=$(OUT)",
131 output_files = "multiple",
132 plugin = ":protoc-gen-upb_minitable_stage1",
133 plugin_format_flag = "--plugin=protoc-gen-upb_minitable=%s",
134 progress_message = "Generating upb minitables",
135 runtime = "//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
136 # TODO: Restrict to "//bazel:__pkg__" once we are on Bazel >=6.5.
137 visibility = ["//visibility:public"],