move upb/hpb_generator -> protobuf/compiler/hpb
PiperOrigin-RevId: 649112245
diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml
index c514b75..de1c084 100644
--- a/.github/workflows/test_upb.yml
+++ b/.github/workflows/test_upb.yml
@@ -40,7 +40,7 @@
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.3.0' }}-75f2a85ece6526cc3d54087018c0f1097d78d42b
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: upb-bazel
- bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //hpb_generator/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
+ bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
exclude-targets: ${{ matrix.config.exclude-targets }}
linux-gcc:
@@ -59,7 +59,7 @@
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:12.2-6.3.0-63dd26c0c7a808d92673a3e52e848189d4ab0f17"
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-gcc"
- bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt //bazel/... //benchmarks/... //lua/... //hpb_generator/... //python/... //upb/... //upb_generator/...
+ bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
windows:
strategy:
@@ -80,7 +80,7 @@
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-windows"
- bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/... //hpb_generator/...
+ bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/...
version: 6.3.0
exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test
@@ -107,7 +107,7 @@
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-macos"
- bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //hpb_generator/... //python/... //upb/... //upb_generator/...
+ bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
version: 6.3.0
no-python:
diff --git a/hpb/BUILD b/hpb/BUILD
index 9b55e7c..b9674c2 100644
--- a/hpb/BUILD
+++ b/hpb/BUILD
@@ -138,8 +138,8 @@
copts = UPB_DEFAULT_CPPOPTS,
deps = [
":protos_internal",
- "//hpb_generator/tests:test_model_upb_cc_proto",
- "//hpb_generator/tests:test_model_upb_proto",
+ "//src/google/protobuf/compiler/hpb/tests:test_model_upb_cc_proto",
+ "//src/google/protobuf/compiler/hpb/tests:test_model_upb_proto",
"//upb:mem",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
@@ -168,7 +168,7 @@
deps = [
"//hpb",
"//hpb:protos_extension_lock",
- "//hpb_generator/tests:test_model_upb_cc_proto",
+ "//src/google/protobuf/compiler/hpb/tests:test_model_upb_cc_proto",
"//upb:mem",
"@com_google_absl//absl/hash",
"@com_google_absl//absl/log:absl_check",
diff --git a/hpb/bazel/upb_cc_proto_library.bzl b/hpb/bazel/upb_cc_proto_library.bzl
index 34c1b15..f6561e4 100644
--- a/hpb/bazel/upb_cc_proto_library.bzl
+++ b/hpb/bazel/upb_cc_proto_library.bzl
@@ -235,12 +235,12 @@
_upb_cc_proto_library_aspect = aspect(
attrs = {
"_ccopts": attr.label(
- default = "//protos:upb_cc_proto_library_copts__for_generated_code_only_do_not_use",
+ default = "//hpb:upb_cc_proto_library_copts__for_generated_code_only_do_not_use",
),
"_gen_upbprotos": attr.label(
executable = True,
cfg = "exec",
- default = "//hpb_generator:protoc-gen-upb-protos",
+ default = "//src/google/protobuf/compiler/hpb:protoc-gen-upb-protos",
),
"_protoc": attr.label(
executable = True,
diff --git a/hpb/protos.h b/hpb/protos.h
index 0255437..e01d134 100644
--- a/hpb/protos.h
+++ b/hpb/protos.h
@@ -78,6 +78,10 @@
Proxy<T> p_;
};
+// Suppress -Wctad-maybe-unsupported with our manual deduction guide
+template <typename T>
+Ptr(T* m) -> Ptr<T>;
+
inline absl::string_view UpbStrToStringView(upb_StringView str) {
return absl::string_view(str.data, str.size);
}
diff --git a/hpb/protos_extension_lock_test.cc b/hpb/protos_extension_lock_test.cc
index 989b6c9..e666573 100644
--- a/hpb/protos_extension_lock_test.cc
+++ b/hpb/protos_extension_lock_test.cc
@@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#include "absl/hash/hash.h"
#include "absl/log/absl_check.h"
-#include "hpb_generator/tests/test_model.upb.proto.h"
+#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h"
#include "google/protobuf/hpb/protos.h"
#include "upb/mem/arena.hpp"
diff --git a/hpb/protos_internal_test.cc b/hpb/protos_internal_test.cc
index 0d7be95..d3749a9 100644
--- a/hpb/protos_internal_test.cc
+++ b/hpb/protos_internal_test.cc
@@ -9,8 +9,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "hpb_generator/tests/test_model.upb.h"
-#include "hpb_generator/tests/test_model.upb.proto.h"
+#include "google/protobuf/compiler/hpb/tests/test_model.upb.h"
+#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h"
#include "upb/mem/arena.h"
namespace protos::testing {
diff --git a/hpb_generator/BUILD b/hpb_generator/BUILD
index 88d3873..63cfe8b 100644
--- a/hpb_generator/BUILD
+++ b/hpb_generator/BUILD
@@ -29,7 +29,9 @@
":names",
":output",
"//:protobuf",
+ "//src/google/protobuf",
"//src/google/protobuf/compiler:code_generator",
+ "//src/google/protobuf/compiler:plugin",
"//upb_generator:file_layout",
],
)
@@ -56,6 +58,7 @@
":names",
":output",
"//:protobuf",
+ "//src/google/protobuf",
"//upb_generator:common",
"//upb_generator:file_layout",
"//upb_generator:keywords",
@@ -85,6 +88,7 @@
visibility = ["//visibility:public"],
deps = [
"//:protobuf",
+ "//src/google/protobuf",
"//src/google/protobuf/compiler:code_generator",
"@com_google_absl//absl/strings",
],
diff --git a/hpb_generator/README.md b/hpb_generator/README.md
index 05b64c0..ce85bb1 100644
--- a/hpb_generator/README.md
+++ b/hpb_generator/README.md
@@ -1,8 +1,8 @@
-`protos` Generator
+hpb Generator
==================
-This directory contains the generator for the [`protos`
-API](https://github.com/protocolbuffers/protobuf/tree/main/protos), an
+This directory contains the generator for the [`hpb`
+API](https://github.com/protocolbuffers/protobuf/tree/main/hpb), an
experimental C++ protobuf implementation. Most users should use the standard
C++ implementation
[here](https://github.com/protocolbuffers/protobuf/tree/main/src).
diff --git a/hpb_generator/gen_accessors.cc b/hpb_generator/gen_accessors.cc
index cb873cf..e70be76 100644
--- a/hpb_generator/gen_accessors.cc
+++ b/hpb_generator/gen_accessors.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/gen_accessors.h"
+#include "google/protobuf/compiler/hpb/gen_accessors.h"
#include <string>
@@ -14,17 +14,17 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/gen_repeated_fields.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/names.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/gen_repeated_fields.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/names.h"
+#include "google/protobuf/compiler/hpb/output.h"
#include "upb_generator/common.h"
#include "upb_generator/keywords.h"
#include "upb_generator/names.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
using NameToFieldDescriptorMap =
absl::flat_hash_map<absl::string_view, const protobuf::FieldDescriptor*>;
diff --git a/hpb_generator/gen_accessors.h b/hpb_generator/gen_accessors.h
index 1136f58..cad3d2a 100644
--- a/hpb_generator/gen_accessors.h
+++ b/hpb_generator/gen_accessors.h
@@ -5,16 +5,16 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_ACCESSORS_H_
-#define UPB_PROTOS_GENERATOR_ACCESSORS_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_ACCESSORS_H_
+#define PROTOBUF_COMPILER_HBP_GEN_ACCESSORS_H_
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
void WriteFieldAccessorsInHeader(const protobuf::Descriptor* desc,
Output& output);
@@ -25,4 +25,4 @@
Output& output);
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_ACCESSORS_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_ACCESSORS_H_
diff --git a/hpb_generator/gen_enums.cc b/hpb_generator/gen_enums.cc
index 5c89454..4ecedb4 100644
--- a/hpb_generator/gen_enums.cc
+++ b/hpb_generator/gen_enums.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/gen_enums.h"
+#include "google/protobuf/compiler/hpb/gen_enums.h"
#include <algorithm>
#include <limits>
@@ -14,12 +14,12 @@
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/names.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/names.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
// Convert enum value to C++ literal.
//
diff --git a/hpb_generator/gen_enums.h b/hpb_generator/gen_enums.h
index 23ab78b..e202a79 100644
--- a/hpb_generator/gen_enums.h
+++ b/hpb_generator/gen_enums.h
@@ -5,15 +5,15 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_ENUMS_H_
-#define UPB_PROTOS_GENERATOR_ENUMS_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_ENUMS_H_
+#define PROTOBUF_COMPILER_HBP_GEN_ENUMS_H_
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
std::string EnumTypeName(const protobuf::EnumDescriptor* enum_descriptor);
std::string EnumValueSymbolInNameSpace(
@@ -26,4 +26,4 @@
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_ENUMS_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_ENUMS_H_
diff --git a/hpb_generator/gen_extensions.cc b/hpb_generator/gen_extensions.cc
index 71257d9..8e416c2 100644
--- a/hpb_generator/gen_extensions.cc
+++ b/hpb_generator/gen_extensions.cc
@@ -5,15 +5,15 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/gen_extensions.h"
+#include "google/protobuf/compiler/hpb/gen_extensions.h"
#include "absl/strings/str_cat.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/names.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/names.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
std::string ExtensionIdentifierBase(const protobuf::FieldDescriptor* ext) {
assert(ext->is_extension());
diff --git a/hpb_generator/gen_extensions.h b/hpb_generator/gen_extensions.h
index a23115e..45eba61 100644
--- a/hpb_generator/gen_extensions.h
+++ b/hpb_generator/gen_extensions.h
@@ -5,15 +5,15 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_GEN_EXTENSIONS_H_
-#define UPB_PROTOS_GENERATOR_GEN_EXTENSIONS_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_EXTENSIONS_H_
+#define PROTOBUF_COMPILER_HBP_GEN_EXTENSIONS_H_
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
void WriteExtensionIdentifiersHeader(
const std::vector<const protobuf::FieldDescriptor*>& extensions,
@@ -28,4 +28,4 @@
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_GEN_EXTENSIONS_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_EXTENSIONS_H_
diff --git a/hpb_generator/gen_messages.cc b/hpb_generator/gen_messages.cc
index c1ad7ba..5b85c1c 100644
--- a/hpb_generator/gen_messages.cc
+++ b/hpb_generator/gen_messages.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/gen_messages.h"
+#include "google/protobuf/compiler/hpb/gen_messages.h"
#include <cstddef>
#include <string>
@@ -16,18 +16,18 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/gen_accessors.h"
-#include "hpb_generator/gen_enums.h"
-#include "hpb_generator/gen_extensions.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/names.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/gen_accessors.h"
+#include "google/protobuf/compiler/hpb/gen_enums.h"
+#include "google/protobuf/compiler/hpb/gen_extensions.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/names.h"
+#include "google/protobuf/compiler/hpb/output.h"
#include "upb_generator/common.h"
#include "upb_generator/file_layout.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
void WriteModelAccessDeclaration(const protobuf::Descriptor* descriptor,
Output& output);
diff --git a/hpb_generator/gen_messages.h b/hpb_generator/gen_messages.h
index 3e6b652..e9285c6 100644
--- a/hpb_generator/gen_messages.h
+++ b/hpb_generator/gen_messages.h
@@ -5,14 +5,14 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_GEN_MESSAGES_H_
-#define UPB_PROTOS_GENERATOR_GEN_MESSAGES_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_MESSAGES_H_
+#define PROTOBUF_COMPILER_HBP_GEN_MESSAGES_H_
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
void WriteMessageClassDeclarations(
const protobuf::Descriptor* descriptor,
@@ -25,4 +25,4 @@
Output& output);
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_GEN_MESSAGES_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_MESSAGES_H_
diff --git a/hpb_generator/gen_repeated_fields.cc b/hpb_generator/gen_repeated_fields.cc
index 9bf2e32..66d9efa 100644
--- a/hpb_generator/gen_repeated_fields.cc
+++ b/hpb_generator/gen_repeated_fields.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/gen_repeated_fields.h"
+#include "google/protobuf/compiler/hpb/gen_repeated_fields.h"
#include <string>
#include <vector>
@@ -13,18 +13,18 @@
#include "google/protobuf/descriptor.pb.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/gen_accessors.h"
-#include "hpb_generator/gen_enums.h"
-#include "hpb_generator/gen_extensions.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/names.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/gen_accessors.h"
+#include "google/protobuf/compiler/hpb/gen_enums.h"
+#include "google/protobuf/compiler/hpb/gen_extensions.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/names.h"
+#include "google/protobuf/compiler/hpb/output.h"
#include "upb_generator/common.h"
#include "upb_generator/file_layout.h"
#include "upb_generator/names.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
// Adds using accessors to reuse base Access class members from a Proxy/CProxy.
void WriteRepeatedFieldUsingAccessors(const protobuf::FieldDescriptor* field,
diff --git a/hpb_generator/gen_repeated_fields.h b/hpb_generator/gen_repeated_fields.h
index 9b4b7c8..9e7169f 100644
--- a/hpb_generator/gen_repeated_fields.h
+++ b/hpb_generator/gen_repeated_fields.h
@@ -5,15 +5,15 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef THIRD_PARTY_UPB_PROTOS_GENERATOR_GEN_REPEATED_FIELDS_H_
-#define THIRD_PARTY_UPB_PROTOS_GENERATOR_GEN_REPEATED_FIELDS_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_REPEATED_FIELDS_H_
+#define PROTOBUF_COMPILER_HBP_GEN_REPEATED_FIELDS_H_
#include "absl/strings/string_view.h"
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
void WriteRepeatedFieldUsingAccessors(const protobuf::FieldDescriptor* field,
absl::string_view class_name,
@@ -43,4 +43,4 @@
} // namespace protos_generator
-#endif // THIRD_PARTY_UPB_PROTOS_GENERATOR_GEN_REPEATED_FIELDS_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_REPEATED_FIELDS_H_
diff --git a/hpb_generator/gen_utils.cc b/hpb_generator/gen_utils.cc
index 331365c..ae45491 100644
--- a/hpb_generator/gen_utils.cc
+++ b/hpb_generator/gen_utils.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/gen_utils.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
#include <algorithm>
#include <string>
@@ -15,7 +15,7 @@
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
void AddEnums(const protobuf::Descriptor* message,
std::vector<const protobuf::EnumDescriptor*>* enums) {
diff --git a/hpb_generator/gen_utils.h b/hpb_generator/gen_utils.h
index 6cd5f7d..bb79db4 100644
--- a/hpb_generator/gen_utils.h
+++ b/hpb_generator/gen_utils.h
@@ -5,8 +5,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_GEN_UTILS_H_
-#define UPB_PROTOS_GENERATOR_GEN_UTILS_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_UTILS_H_
+#define PROTOBUF_COMPILER_HBP_GEN_UTILS_H_
#include <string>
#include <vector>
@@ -17,7 +17,7 @@
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
enum class MessageClassType {
kMessage,
@@ -42,4 +42,4 @@
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_GEN_UTILS_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_UTILS_H_
diff --git a/hpb_generator/names.cc b/hpb_generator/names.cc
index 00d280b..75c2063 100644
--- a/hpb_generator/names.cc
+++ b/hpb_generator/names.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/names.h"
+#include "google/protobuf/compiler/hpb/names.h"
#include <string>
@@ -13,7 +13,7 @@
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
namespace {
diff --git a/hpb_generator/names.h b/hpb_generator/names.h
index 47d7c10..9ac6b50 100644
--- a/hpb_generator/names.h
+++ b/hpb_generator/names.h
@@ -5,17 +5,17 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_NAMES_H_
-#define UPB_PROTOS_GENERATOR_NAMES_H_
+#ifndef PROTOBUF_COMPILER_HBP_GEN_NAMES_H_
+#define PROTOBUF_COMPILER_HBP_GEN_NAMES_H_
#include <string>
#include "google/protobuf/descriptor.pb.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
inline constexpr absl::string_view kNoPackageNamePrefix = "protos_";
@@ -47,4 +47,4 @@
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_NAMES_H_
+#endif // PROTOBUF_COMPILER_HBP_GEN_NAMES_H_
diff --git a/hpb_generator/output.cc b/hpb_generator/output.cc
index e29fed2..3938444 100644
--- a/hpb_generator/output.cc
+++ b/hpb_generator/output.cc
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/output.h"
#include <string>
@@ -14,7 +14,7 @@
namespace protos_generator {
namespace {
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
} // namespace
diff --git a/hpb_generator/output.h b/hpb_generator/output.h
index 828a423..6244d3f 100644
--- a/hpb_generator/output.h
+++ b/hpb_generator/output.h
@@ -5,8 +5,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
-#ifndef UPB_PROTOS_GENERATOR_OUTPUT_H
-#define UPB_PROTOS_GENERATOR_OUTPUT_H
+#ifndef PROTOBUF_COMPILER_HBP_OUTPUT_H_
+#define PROTOBUF_COMPILER_HBP_OUTPUT_H_
#include <vector>
@@ -148,4 +148,4 @@
} // namespace protos_generator
-#endif // UPB_PROTOS_GENERATOR_OUTPUT_H
+#endif // PROTOBUF_COMPILER_HBP_OUTPUT_H_
diff --git a/hpb_generator/protoc-gen-upb-protos.cc b/hpb_generator/protoc-gen-upb-protos.cc
index 272175e..b96a708 100644
--- a/hpb_generator/protoc-gen-upb-protos.cc
+++ b/hpb_generator/protoc-gen-upb-protos.cc
@@ -15,18 +15,18 @@
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/compiler/plugin.h"
#include "google/protobuf/descriptor.h"
-#include "hpb_generator/gen_enums.h"
-#include "hpb_generator/gen_extensions.h"
-#include "hpb_generator/gen_messages.h"
-#include "hpb_generator/gen_utils.h"
-#include "hpb_generator/names.h"
-#include "hpb_generator/output.h"
+#include "google/protobuf/compiler/hpb/gen_enums.h"
+#include "google/protobuf/compiler/hpb/gen_extensions.h"
+#include "google/protobuf/compiler/hpb/gen_messages.h"
+#include "google/protobuf/compiler/hpb/gen_utils.h"
+#include "google/protobuf/compiler/hpb/names.h"
+#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace {
namespace protoc = ::google::protobuf::compiler;
-namespace protobuf = ::google::protobuf;
+namespace protobuf = ::proto2;
using FileDescriptor = ::google::protobuf::FileDescriptor;
using google::protobuf::Edition;
diff --git a/hpb_generator/tests/BUILD b/hpb_generator/tests/BUILD
index 086b0ff..f6a93b1 100644
--- a/hpb_generator/tests/BUILD
+++ b/hpb_generator/tests/BUILD
@@ -12,12 +12,12 @@
# "cc_proto_library",
# )
# load(
-# "//bazel:upb_proto_library.bzl",
-# "upb_c_proto_library",
+# "//hpb/bazel:upb_cc_proto_library.bzl",
+# "upb_cc_proto_library",
# )
# load(
-# "//protos/bazel:upb_cc_proto_library.bzl",
-# "upb_cc_proto_library",
+# "//bazel:upb_proto_library.bzl",
+# "upb_c_proto_library",
# )
# load(
# "//upb/bazel:build_defs.bzl",
diff --git a/hpb_generator/tests/child_model.proto b/hpb_generator/tests/child_model.proto
index fe8f586..889e3e9 100644
--- a/hpb_generator/tests/child_model.proto
+++ b/hpb_generator/tests/child_model.proto
@@ -9,7 +9,7 @@
package protos_generator.test;
-import public "hpb_generator/tests/test_enum.proto";
+import public "google/protobuf/compiler/hpb/tests/test_enum.proto";
message ChildModel1 {
optional bool child_b1 = 44;
diff --git a/hpb_generator/tests/no_package_enum_user.proto b/hpb_generator/tests/no_package_enum_user.proto
index 4fbd913..35d4a99 100644
--- a/hpb_generator/tests/no_package_enum_user.proto
+++ b/hpb_generator/tests/no_package_enum_user.proto
@@ -9,7 +9,7 @@
package protos_generator.tests;
-import "hpb_generator/tests/no_package.proto";
+import "google/protobuf/compiler/hpb/tests/no_package.proto";
// option java_multiple_files = true;
diff --git a/hpb_generator/tests/test_extension.proto b/hpb_generator/tests/test_extension.proto
index 8eb4297..c3cd68b 100644
--- a/hpb_generator/tests/test_extension.proto
+++ b/hpb_generator/tests/test_extension.proto
@@ -9,7 +9,7 @@
package protos_generator.test.someotherpackage;
-import "hpb_generator/tests/test_model.proto";
+import "google/protobuf/compiler/hpb/tests/test_model.proto";
// Define extension that is extending proto outside this package with a type
// defined in different file.
diff --git a/hpb_generator/tests/test_generated.cc b/hpb_generator/tests/test_generated.cc
index 20e6161..40636c2 100644
--- a/hpb_generator/tests/test_generated.cc
+++ b/hpb_generator/tests/test_generated.cc
@@ -18,9 +18,9 @@
#include <gtest/gtest.h>
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
-#include "hpb_generator/tests/child_model.upb.proto.h"
-#include "hpb_generator/tests/no_package.upb.proto.h"
-#include "hpb_generator/tests/test_model.upb.proto.h"
+#include "google/protobuf/compiler/hpb/tests/child_model.upb.proto.h"
+#include "google/protobuf/compiler/hpb/tests/no_package.upb.proto.h"
+#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h"
#include "protos/protos.h"
#include "protos/repeated_field.h"
#include "protos/repeated_field_iterator.h"
diff --git a/hpb_generator/tests/test_model.proto b/hpb_generator/tests/test_model.proto
index 5051c5c..6d051b2 100644
--- a/hpb_generator/tests/test_model.proto
+++ b/hpb_generator/tests/test_model.proto
@@ -9,7 +9,7 @@
package protos_generator.test;
-import "hpb_generator/tests/child_model.proto";
+import "google/protobuf/compiler/hpb/tests/child_model.proto";
message TestModelContainer {
repeated TestModel models = 1;
diff --git a/protos/bazel/upb_cc_proto_library.bzl b/protos/bazel/upb_cc_proto_library.bzl
index f1e0690..828258c 100644
--- a/protos/bazel/upb_cc_proto_library.bzl
+++ b/protos/bazel/upb_cc_proto_library.bzl
@@ -240,7 +240,7 @@
"_gen_upbprotos": attr.label(
executable = True,
cfg = "exec",
- default = "//hpb_generator:protoc-gen-upb-protos",
+ default = "//src/google/protobuf/compiler/hpb:protoc-gen-upb-protos",
),
"_protoc": attr.label(
executable = True,
diff --git a/upb_generator/BUILD b/upb_generator/BUILD
index e61b622..c9ce196 100644
--- a/upb_generator/BUILD
+++ b/upb_generator/BUILD
@@ -143,7 +143,7 @@
"keywords.h",
],
copts = UPB_DEFAULT_CPPOPTS,
- visibility = ["//hpb_generator:__pkg__"],
+ visibility = ["//src/google/protobuf/compiler/hpb:__pkg__"],
)
bootstrap_cc_library(