Migrated upb code generators to the new code_generator_lite.h library.

This will remove the dependency on the heavyweight code_generator target.

PiperOrigin-RevId: 672093911
pull/18172/head
Joshua Haberman 6 months ago committed by Copybara-Service
parent 65c9e69f97
commit da825e80b1
  1. 3
      upb_generator/BUILD
  2. 1
      upb_generator/c/BUILD
  3. 1
      upb_generator/c/generator.cc
  4. 3
      upb_generator/minitable/BUILD
  5. 2
      upb_generator/minitable/generator.cc
  6. 3
      upb_generator/minitable/main.cc
  7. 21
      upb_generator/plugin.h

@ -110,6 +110,9 @@ bootstrap_cc_library(
copts = UPB_DEFAULT_CPPOPTS,
visibility = ["//upb:friend_generators"],
deps = [
"//src/google/protobuf/compiler:code_generator_lite",
"//upb:base",
"//upb:mem",
"//upb:port",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log:absl_check",

@ -40,7 +40,6 @@ bootstrap_cc_library(
copts = UPB_DEFAULT_CPPOPTS,
visibility = ["//pkg:__pkg__"],
deps = [
"//src/google/protobuf/compiler:code_generator",
"//upb:base",
"//upb:mem",
"//upb:mini_table",

@ -28,7 +28,6 @@
#include "absl/strings/str_replace.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/code_generator.h"
#include "upb/base/descriptor_constants.h"
#include "upb/base/status.hpp"
#include "upb/base/string_view.h"

@ -35,7 +35,7 @@ bootstrap_cc_library(
],
copts = UPB_DEFAULT_CPPOPTS,
deps = [
"//src/google/protobuf/compiler:code_generator",
"//src/google/protobuf/compiler:code_generator_lite",
"//upb:base",
"//upb:mem",
"//upb:mini_table",
@ -78,6 +78,7 @@ bootstrap_cc_library(
copts = UPB_DEFAULT_CPPOPTS,
visibility = ["//pkg:__pkg__"],
deps = [
"//src/google/protobuf/compiler:code_generator_lite",
"//upb:base",
"//upb:port",
"@com_google_absl//absl/log:absl_check",

@ -18,7 +18,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/compiler/code_generator_lite.h"
#include "upb/mini_table/enum.h"
#include "upb/mini_table/field.h"
#include "upb/mini_table/internal/field.h"

@ -6,10 +6,13 @@
// https://developers.google.com/open-source/licenses/bsd
#include <string>
#include <utility>
#include <vector>
#include "absl/log/absl_log.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/code_generator_lite.h"
#include "upb/base/status.hpp"
#include "upb/base/string_view.h"
#include "upb/reflection/def.hpp"

@ -10,8 +10,11 @@
#include <stdio.h>
#include <cstring>
#include <string>
#include <utility>
#include <vector>
#ifdef _WIN32
#include <fcntl.h>
#include <io.h>
@ -19,8 +22,12 @@
#include "absl/container/flat_hash_set.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/compiler/code_generator_lite.h"
#include "upb/base/status.hpp"
#include "upb/base/string_view.h"
#include "upb/mem/arena.h"
#include "upb/mem/arena.hpp"
#include "upb/reflection/def.hpp"
#include "upb/reflection/descriptor_bootstrap.h"
#include "upb_generator/plugin_bootstrap.h"
@ -34,17 +41,7 @@ namespace generator {
inline std::vector<std::pair<std::string, std::string>> ParseGeneratorParameter(
const absl::string_view text) {
std::vector<std::pair<std::string, std::string>> ret;
for (absl::string_view sp : absl::StrSplit(text, ',', absl::SkipEmpty())) {
std::string::size_type equals_pos = sp.find_first_of('=');
std::pair<std::string, std::string> value;
if (equals_pos == std::string::npos) {
value.first = std::string(sp);
} else {
value.first = std::string(sp.substr(0, equals_pos));
value.second = std::string(sp.substr(equals_pos + 1));
}
ret.push_back(std::move(value));
}
google::protobuf::compiler::ParseGeneratorParameter(text, &ret);
return ret;
}

Loading…
Cancel
Save