diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index c514b75ca8..de1c084f15 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -40,7 +40,7 @@ jobs: 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 @@ jobs: 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 @@ jobs: 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 @@ jobs: 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 9b55e7cde8..b9674c2fd5 100644 --- a/hpb/BUILD +++ b/hpb/BUILD @@ -138,8 +138,8 @@ cc_test( 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 @@ cc_test( 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 34c1b15222..f6561e456c 100644 --- a/hpb/bazel/upb_cc_proto_library.bzl +++ b/hpb/bazel/upb_cc_proto_library.bzl @@ -235,12 +235,12 @@ def _upb_cc_proto_library_aspect_impl(target, ctx): _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 0255437915..e01d1342f7 100644 --- a/hpb/protos.h +++ b/hpb/protos.h @@ -78,6 +78,10 @@ class Ptr final { Proxy p_; }; +// Suppress -Wctad-maybe-unsupported with our manual deduction guide +template +Ptr(T* m) -> Ptr; + 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 989b6c9ab1..e666573bca 100644 --- a/hpb/protos_extension_lock_test.cc +++ b/hpb/protos_extension_lock_test.cc @@ -16,7 +16,7 @@ #include #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 0d7be95ace..d3749a9f5b 100644 --- a/hpb/protos_internal_test.cc +++ b/hpb/protos_internal_test.cc @@ -9,8 +9,8 @@ #include #include -#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 88d38739e0..63cfe8b7a5 100644 --- a/hpb_generator/BUILD +++ b/hpb_generator/BUILD @@ -29,7 +29,9 @@ cc_binary( ":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 @@ cc_library( ":names", ":output", "//:protobuf", + "//src/google/protobuf", "//upb_generator:common", "//upb_generator:file_layout", "//upb_generator:keywords", @@ -85,6 +88,7 @@ cc_library( 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 05b64c060a..ce85bb11b9 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 cb873cf8cd..e70be76bf2 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 @@ -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; diff --git a/hpb_generator/gen_accessors.h b/hpb_generator/gen_accessors.h index 1136f58d96..cad3d2a634 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 @@ void WriteOneofAccessorsInHeader(const protobuf::Descriptor* desc, 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 5c894549eb..4ecedb42d8 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 #include @@ -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 23ab78b9e3..e202a7957b 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 @@ void WriteEnumDeclarations( } // 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 71257d99ae..8e416c2343 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 a23115e360..45eba614fc 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& extensions, @@ -28,4 +28,4 @@ void WriteExtensionIdentifier(const protobuf::FieldDescriptor* ext, } // 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 c1ad7bae75..5b85c1cec6 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 #include @@ -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 3e6b65221c..e9285c67d6 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 @@ void WriteMessageImplementation( 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 9bf2e32908..66d9efa8ad 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 #include @@ -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 9b4b7c8e7f..9e7169f73b 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 @@ void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message, } // 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 331365cece..ae45491cce 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 #include @@ -15,7 +15,7 @@ namespace protos_generator { -namespace protobuf = ::google::protobuf; +namespace protobuf = ::proto2; void AddEnums(const protobuf::Descriptor* message, std::vector* enums) { diff --git a/hpb_generator/gen_utils.h b/hpb_generator/gen_utils.h index 6cd5f7d3a0..bb79db4a75 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 #include @@ -17,7 +17,7 @@ namespace protos_generator { -namespace protobuf = ::google::protobuf; +namespace protobuf = ::proto2; enum class MessageClassType { kMessage, @@ -42,4 +42,4 @@ std::string ToCamelCase(const std::string& input, bool lower_first); } // 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 00d280be79..75c206381a 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 @@ -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 47d7c10664..9ac6b501a6 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 #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 @@ std::string MessageProxyType(const protobuf::FieldDescriptor* field, } // 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 e29fed251f..3938444dcd 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 @@ -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 828a4239c4..6244d3ff3b 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 @@ -148,4 +148,4 @@ std::string CSourceFilename(const google::protobuf::FileDescriptor* file); } // 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 272175e8bc..b96a708c32 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 086b0ff72e..f6a93b1d80 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 fe8f586335..889e3e9748 100644 --- a/hpb_generator/tests/child_model.proto +++ b/hpb_generator/tests/child_model.proto @@ -9,7 +9,7 @@ syntax = "proto3"; 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 4fbd913e92..35d4a99046 100644 --- a/hpb_generator/tests/no_package_enum_user.proto +++ b/hpb_generator/tests/no_package_enum_user.proto @@ -9,7 +9,7 @@ syntax = "proto2"; 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 8eb4297ec8..c3cd68b471 100644 --- a/hpb_generator/tests/test_extension.proto +++ b/hpb_generator/tests/test_extension.proto @@ -9,7 +9,7 @@ syntax = "proto2"; 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 20e61618f0..40636c2ee2 100644 --- a/hpb_generator/tests/test_generated.cc +++ b/hpb_generator/tests/test_generated.cc @@ -18,9 +18,9 @@ #include #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 5051c5c45e..6d051b231f 100644 --- a/hpb_generator/tests/test_model.proto +++ b/hpb_generator/tests/test_model.proto @@ -9,7 +9,7 @@ syntax = "proto2"; 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 f1e0690e84..828258c760 100644 --- a/protos/bazel/upb_cc_proto_library.bzl +++ b/protos/bazel/upb_cc_proto_library.bzl @@ -240,7 +240,7 @@ _upb_cc_proto_library_aspect = aspect( "_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 e61b6225fd..c9ce196467 100644 --- a/upb_generator/BUILD +++ b/upb_generator/BUILD @@ -143,7 +143,7 @@ cc_library( "keywords.h", ], copts = UPB_DEFAULT_CPPOPTS, - visibility = ["//hpb_generator:__pkg__"], + visibility = ["//src/google/protobuf/compiler/hpb:__pkg__"], ) bootstrap_cc_library(