Refactor editions infrastructure to a top-level directory.
The only public target here is the edition defaults helper macro, which can be used by external runtimes and plugins. None of this code is C++-specific though, and should be organized higher up. Appropriate aliases are also placed at the top level for public targets PiperOrigin-RevId: 625392504pull/16517/head
parent
57772cdae7
commit
ea81024ddf
18
BUILD.bazel
18
BUILD.bazel
|
@ -168,12 +168,6 @@ alias(
|
|||
# Built-in runtime protos: these are part of protobuf's internal
|
||||
# implementation, but are not Well-Known Types.
|
||||
|
||||
alias(
|
||||
name = "cpp_features_proto",
|
||||
actual = "//src/google/protobuf:cpp_features_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "descriptor_proto",
|
||||
actual = "//src/google/protobuf:descriptor_proto", # proto_library
|
||||
|
@ -334,6 +328,12 @@ alias(
|
|||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "cpp_features_proto",
|
||||
actual = "//src/google/protobuf:cpp_features_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Java support
|
||||
################################################################################
|
||||
|
@ -368,6 +368,12 @@ alias(
|
|||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "java_features_proto",
|
||||
actual = "//java/core:java_features_proto", # proto_library
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Python support
|
||||
################################################################################
|
||||
|
|
|
@ -30,6 +30,24 @@ add_custom_command(
|
|||
--cpp_out=${protobuf_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto3_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto3_editions.pb.cc
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto2_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto2_editions.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE}
|
||||
${protobuf_SOURCE_DIR}/editions/golden/test_messages_proto3_editions.proto
|
||||
${protobuf_SOURCE_DIR}/editions/golden/test_messages_proto2_editions.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE}
|
||||
${protobuf_SOURCE_DIR}/editions/golden/test_messages_proto3_editions.proto
|
||||
${protobuf_SOURCE_DIR}/editions/golden/test_messages_proto2_editions.proto
|
||||
--proto_path=${protobuf_SOURCE_DIR}
|
||||
--proto_path=${protobuf_SOURCE_DIR}/src
|
||||
--cpp_out=${protobuf_BINARY_DIR}
|
||||
)
|
||||
|
||||
file(MAKE_DIRECTORY ${protobuf_BINARY_DIR}/src)
|
||||
|
||||
add_custom_command(
|
||||
|
@ -38,20 +56,12 @@ add_custom_command(
|
|||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto2.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.proto
|
||||
--proto_path=${protobuf_SOURCE_DIR}/src
|
||||
--cpp_out=${protobuf_BINARY_DIR}/src
|
||||
)
|
||||
|
@ -61,14 +71,14 @@ add_library(libconformance_common STATIC
|
|||
${protobuf_BINARY_DIR}/conformance/conformance.pb.cc
|
||||
${protobuf_BINARY_DIR}/conformance/test_protos/test_messages_edition2023.pb.h
|
||||
${protobuf_BINARY_DIR}/conformance/test_protos/test_messages_edition2023.pb.cc
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto3_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto3_editions.pb.cc
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto2_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/editions/golden/test_messages_proto2_editions.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto2.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto3.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.pb.cc
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.pb.h
|
||||
${protobuf_BINARY_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.pb.cc
|
||||
)
|
||||
target_link_libraries(libconformance_common
|
||||
${protobuf_LIB_PROTOBUF}
|
||||
|
|
|
@ -8,7 +8,7 @@ load(
|
|||
"strip_prefix",
|
||||
)
|
||||
load("@rules_ruby//ruby:defs.bzl", "ruby_binary")
|
||||
load("//:protobuf.bzl", "internal_csharp_proto_library", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library")
|
||||
load("//:protobuf.bzl", "internal_csharp_proto_library", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library", "internal_ruby_proto_library")
|
||||
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
|
||||
load("//build_defs:internal_shell.bzl", "inline_sh_binary")
|
||||
load("//ruby:defs.bzl", "internal_ruby_proto_library")
|
||||
|
@ -167,10 +167,10 @@ cc_library(
|
|||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
"//conformance/test_protos:test_messages_edition2023_cc_proto",
|
||||
"//editions:test_messages_proto2_editions_cc_proto",
|
||||
"//editions:test_messages_proto3_editions_cc_proto",
|
||||
"//src/google/protobuf",
|
||||
"//src/google/protobuf:protobuf_lite",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_cc_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_cc_proto",
|
||||
"//src/google/protobuf/json",
|
||||
"//src/google/protobuf/util:type_resolver",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
|
@ -192,9 +192,9 @@ cc_library(
|
|||
":test_messages_proto2_proto_cc",
|
||||
":test_messages_proto3_proto_cc",
|
||||
"//conformance/test_protos:test_messages_edition2023_cc_proto",
|
||||
"//editions:test_messages_proto2_editions_cc_proto",
|
||||
"//editions:test_messages_proto3_editions_cc_proto",
|
||||
"//src/google/protobuf",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_cc_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_cc_proto",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/log:die_if_null",
|
||||
"@com_google_absl//absl/strings",
|
||||
|
@ -226,11 +226,11 @@ cc_binary(
|
|||
"//:test_messages_proto2_cc_proto",
|
||||
"//:test_messages_proto3_cc_proto",
|
||||
"//conformance/test_protos:test_messages_edition2023_cc_proto",
|
||||
"//editions:test_messages_proto2_editions_cc_proto",
|
||||
"//editions:test_messages_proto3_editions_cc_proto",
|
||||
"//src/google/protobuf",
|
||||
"//src/google/protobuf:port",
|
||||
"//src/google/protobuf:protobuf_lite",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_cc_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_cc_proto",
|
||||
"//src/google/protobuf/stubs",
|
||||
"//src/google/protobuf/util:json_util",
|
||||
"//src/google/protobuf/util:type_resolver",
|
||||
|
@ -257,8 +257,8 @@ java_binary(
|
|||
"//:test_messages_proto2_java_proto",
|
||||
"//:test_messages_proto3_java_proto",
|
||||
"//conformance/test_protos:test_messages_edition2023_java_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_java_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_java_proto",
|
||||
"//editions:test_messages_proto2_editions_java_proto",
|
||||
"//editions:test_messages_proto3_editions_java_proto",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -277,8 +277,8 @@ java_binary(
|
|||
"//:test_messages_proto2_java_proto_lite",
|
||||
"//:test_messages_proto3_java_proto_lite",
|
||||
"//conformance/test_protos:test_messages_edition2023_java_proto_lite",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_java_proto_lite",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_java_proto_lite",
|
||||
"//editions:test_messages_proto2_editions_java_proto_lite",
|
||||
"//editions:test_messages_proto3_editions_java_proto_lite",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -296,6 +296,8 @@ py_binary(
|
|||
":conformance_py_proto",
|
||||
"//:protobuf_python",
|
||||
"//conformance/test_protos:test_messages_edition2023_py_proto",
|
||||
"//editions:test_messages_proto2_editions_py_pb2",
|
||||
"//editions:test_messages_proto3_editions_py_pb2",
|
||||
"//python:_message", # Make upb visible if we need it.
|
||||
"//python:conformance_test_py_proto",
|
||||
],
|
||||
|
@ -363,8 +365,8 @@ objc_library(
|
|||
"//:test_messages_proto2_objc_proto",
|
||||
"//:test_messages_proto3_objc_proto",
|
||||
"//conformance/test_protos:test_messages_edition2023_objc_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_objc_proto",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_objc_proto",
|
||||
"//editions:test_messages_proto2_editions_objc_proto",
|
||||
"//editions:test_messages_proto3_editions_objc_proto",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -385,6 +387,7 @@ ruby_binary(
|
|||
deps = [
|
||||
":conformance_ruby_proto",
|
||||
"//conformance/test_protos:test_messages_edition2023_ruby_proto",
|
||||
"//ruby:conformance_editions_test_ruby_proto",
|
||||
"//ruby:conformance_test_ruby_proto",
|
||||
"//ruby:protobuf",
|
||||
],
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "conformance/conformance.pb.h"
|
||||
#include "conformance_test.h"
|
||||
#include "conformance/test_protos/test_messages_edition2023.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "google/protobuf/endian.h"
|
||||
#include "google/protobuf/json/json.h"
|
||||
#include "google/protobuf/test_messages_proto2.pb.h"
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "conformance/conformance.pb.h"
|
||||
#include "conformance/conformance.pb.h"
|
||||
#include "conformance/test_protos/test_messages_edition2023.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "google/protobuf/endian.h"
|
||||
#include "google/protobuf/message.h"
|
||||
#include "google/protobuf/test_messages_proto2.pb.h"
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "Conformance.pbobjc.h"
|
||||
#import "editions/golden/TestMessagesProto2Editions.pbobjc.h"
|
||||
#import "editions/golden/TestMessagesProto3Editions.pbobjc.h"
|
||||
#import "google/protobuf/TestMessagesProto2.pbobjc.h"
|
||||
#import "google/protobuf/TestMessagesProto3.pbobjc.h"
|
||||
#import "google/protobuf/editions/golden/TestMessagesProto2Editions.pbobjc.h"
|
||||
#import "google/protobuf/editions/golden/TestMessagesProto3Editions.pbobjc.h"
|
||||
#import "test_protos/TestMessagesEdition2023.pbobjc.h"
|
||||
|
||||
static void Die(NSString *format, ...) __dead2;
|
||||
|
|
|
@ -20,8 +20,8 @@ from google.protobuf import test_messages_proto2_pb2
|
|||
from google.protobuf import test_messages_proto3_pb2
|
||||
from conformance import conformance_pb2
|
||||
from conformance.test_protos import test_messages_edition2023_pb2
|
||||
from google.protobuf.editions.golden import test_messages_proto2_editions_pb2
|
||||
from google.protobuf.editions.golden import test_messages_proto3_editions_pb2
|
||||
from editions.golden import test_messages_proto2_editions_pb2
|
||||
from editions.golden import test_messages_proto3_editions_pb2
|
||||
|
||||
test_count = 0
|
||||
verbose = False
|
||||
|
|
|
@ -12,8 +12,8 @@ require 'conformance/test_protos/test_messages_edition2023_pb'
|
|||
require 'google/protobuf'
|
||||
require 'google/protobuf/test_messages_proto3_pb'
|
||||
require 'google/protobuf/test_messages_proto2_pb'
|
||||
require 'google/protobuf/editions/golden/test_messages_proto2_editions_pb'
|
||||
require 'google/protobuf/editions/golden/test_messages_proto3_editions_pb'
|
||||
require 'test_messages_proto2_editions_pb'
|
||||
require 'test_messages_proto3_editions_pb'
|
||||
|
||||
$test_count = 0
|
||||
$verbose = false
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "absl/strings/str_format.h"
|
||||
#include "conformance_test.h"
|
||||
#include "conformance/test_protos/test_messages_edition2023.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "google/protobuf/test_messages_proto2.pb.h"
|
||||
#include "google/protobuf/test_messages_proto3.pb.h"
|
||||
#include "google/protobuf/text_format.h"
|
||||
|
|
|
@ -72,8 +72,8 @@ $PROTOC -Isrc -I. \
|
|||
csharp/protos/unittest_issue6936_b.proto \
|
||||
csharp/protos/unittest_issue6936_c.proto \
|
||||
csharp/protos/unittest_selfreferential_options.proto \
|
||||
src/google/protobuf/editions/golden/test_messages_proto3_editions.proto \
|
||||
src/google/protobuf/editions/golden/test_messages_proto2_editions.proto \
|
||||
editions/golden/test_messages_proto3_editions.proto \
|
||||
editions/golden/test_messages_proto2_editions.proto \
|
||||
src/google/protobuf/unittest_well_known_types.proto \
|
||||
src/google/protobuf/test_messages_proto3.proto \
|
||||
src/google/protobuf/test_messages_proto2.proto \
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("@rules_python//python:proto.bzl", "py_proto_library")
|
||||
load("//:protobuf.bzl", "internal_objc_proto_library")
|
||||
load("//:protobuf.bzl", "internal_objc_proto_library", "internal_py_proto_library")
|
||||
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
|
||||
load("//bazel:upb_proto_library.bzl", "upb_c_proto_library", "upb_proto_reflection_library")
|
||||
load(":defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
|
||||
|
@ -74,7 +73,6 @@ cc_library(
|
|||
"defaults_test_embedded.h",
|
||||
"defaults_test_embedded_base64.h",
|
||||
],
|
||||
strip_include_prefix = "/src",
|
||||
)
|
||||
|
||||
cc_test(
|
||||
|
@ -108,7 +106,6 @@ proto_library(
|
|||
name = "test_messages_proto2_editions_proto",
|
||||
testonly = True,
|
||||
srcs = ["golden/test_messages_proto2_editions.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
|
@ -139,11 +136,14 @@ java_lite_proto_library(
|
|||
deps = [":test_messages_proto2_editions_proto"],
|
||||
)
|
||||
|
||||
py_proto_library(
|
||||
internal_py_proto_library(
|
||||
name = "test_messages_proto2_editions_py_pb2",
|
||||
testonly = True,
|
||||
visibility = ["//conformance:__pkg__"],
|
||||
deps = [":test_messages_proto2_editions_proto"],
|
||||
srcs = ["golden/test_messages_proto2_editions.proto"],
|
||||
srcs_version = "PY2AND3",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
],
|
||||
)
|
||||
|
||||
upb_c_proto_library(
|
||||
|
@ -163,7 +163,6 @@ proto_library(
|
|||
name = "test_messages_proto3_editions_proto",
|
||||
testonly = True,
|
||||
srcs = ["golden/test_messages_proto3_editions.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
deps = [
|
||||
"//:any_proto",
|
||||
"//:duration_proto",
|
||||
|
@ -207,11 +206,15 @@ java_lite_proto_library(
|
|||
deps = [":test_messages_proto3_editions_proto"],
|
||||
)
|
||||
|
||||
py_proto_library(
|
||||
internal_py_proto_library(
|
||||
name = "test_messages_proto3_editions_py_pb2",
|
||||
testonly = True,
|
||||
visibility = ["//conformance:__pkg__"],
|
||||
deps = [":test_messages_proto3_editions_proto"],
|
||||
srcs = ["golden/test_messages_proto3_editions.proto"],
|
||||
srcs_version = "PY2AND3",
|
||||
visibility = [
|
||||
"//conformance:__pkg__",
|
||||
],
|
||||
deps = ["//python:well_known_types_py_pb2"],
|
||||
)
|
||||
|
||||
upb_c_proto_library(
|
||||
|
@ -227,14 +230,13 @@ upb_proto_reflection_library(
|
|||
deps = ["test_messages_proto3_editions_proto"],
|
||||
)
|
||||
|
||||
# Export these for conformance tests until we support py_proto_library.
|
||||
# Export these for conformance tests for ruby codegen.
|
||||
exports_files(
|
||||
[
|
||||
"golden/test_messages_proto2_editions.proto",
|
||||
"golden/test_messages_proto3_editions.proto",
|
||||
],
|
||||
visibility = [
|
||||
"//python:__pkg__",
|
||||
"//ruby:__pkg__",
|
||||
],
|
||||
)
|
||||
|
@ -243,7 +245,6 @@ proto_library(
|
|||
name = "test_editions_default_features_proto",
|
||||
testonly = True,
|
||||
srcs = ["proto/test_editions_default_features.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
|
@ -275,3 +276,6 @@ cc_test(
|
|||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
# Define a test suite to allow us to trigger these tests from //src expansions.
|
||||
test_suite(name = "all_tests")
|
|
@ -3,105 +3,89 @@ load("//bazel:cc_proto_library.bzl", "cc_proto_library")
|
|||
exports_files(
|
||||
glob(["*.proto"]) + ["rust_bazel_crate_mapping.txt"],
|
||||
visibility = [
|
||||
"//src/google/protobuf/editions:__pkg__",
|
||||
"//editions:__pkg__",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_inline_comments_proto",
|
||||
srcs = ["proto2_inline_comments.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_multiline_comments_proto",
|
||||
srcs = ["proto2_multiline_comments.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_required_proto",
|
||||
srcs = ["proto2_required.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_optional_proto",
|
||||
srcs = ["proto3_optional.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_implicit_proto",
|
||||
srcs = ["proto3_implicit.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_optional_proto",
|
||||
srcs = ["proto2_optional.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_enum_proto",
|
||||
srcs = ["proto2_enum.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_enum_proto",
|
||||
srcs = ["proto3_enum.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_packed_proto",
|
||||
srcs = ["proto2_packed.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_packed_proto",
|
||||
srcs = ["proto3_packed.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_group_proto",
|
||||
srcs = ["proto2_group.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_unpacked_proto",
|
||||
srcs = ["proto2_unpacked.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_unpacked_proto",
|
||||
srcs = ["proto3_unpacked.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_utf8_verify_proto",
|
||||
srcs = ["proto2_utf8_verify.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_import_proto",
|
||||
srcs = ["proto2_import.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
deps = [":proto2_optional_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto2_utf8_disabled_proto",
|
||||
srcs = ["proto2_utf8_disabled.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
|
@ -112,7 +96,6 @@ cc_proto_library(
|
|||
proto_library(
|
||||
name = "proto2_utf8_lite_proto",
|
||||
srcs = ["proto2_utf8_lite.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
|
@ -123,20 +106,17 @@ cc_proto_library(
|
|||
proto_library(
|
||||
name = "proto2_proto3_enum_proto",
|
||||
srcs = ["proto2_proto3_enum.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
deps = [":proto3_enum_proto"],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_utf8_strict_proto",
|
||||
srcs = ["proto3_utf8_strict.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "proto3_import_proto",
|
||||
srcs = ["proto3_import.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
deps = [":proto3_implicit_proto"],
|
||||
)
|
||||
|
|
@ -120,7 +120,7 @@ embed_edition_defaults = rule(
|
|||
doc = "The encoding format to use for the binary data (octal or base64)",
|
||||
),
|
||||
"_escape": attr.label(
|
||||
default = "//src/google/protobuf/editions:internal_defaults_escape",
|
||||
default = "//editions:internal_defaults_escape",
|
||||
executable = True,
|
||||
cfg = "exec",
|
||||
),
|
|
@ -12,8 +12,8 @@
|
|||
#include "absl/strings/escaping.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "google/protobuf/editions/defaults_test_embedded.h"
|
||||
#include "google/protobuf/editions/defaults_test_embedded_base64.h"
|
||||
#include "editions/defaults_test_embedded.h"
|
||||
#include "editions/defaults_test_embedded_base64.h"
|
||||
#include "google/protobuf/unittest_features.pb.h"
|
||||
#include "google/protobuf/stubs/status_macros.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace {
|
|||
absl::StatusOr<FeatureSetDefaults> ReadDefaults(absl::string_view name) {
|
||||
auto runfiles = absl::WrapUnique(bazel::tools::cpp::runfiles::Runfiles::CreateForTest());
|
||||
std::string file = runfiles->Rlocation(absl::StrCat(
|
||||
"com_google_protobuf/src/google/protobuf/editions/",
|
||||
"com_google_protobuf/editions/",
|
||||
name, ".binpb"));
|
||||
std::string data;
|
||||
RETURN_IF_ERROR(File::GetContents(file, &data, true));
|
|
@ -9,9 +9,9 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "google/protobuf/descriptor.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "google/protobuf/editions/proto/test_editions_default_features.pb.h"
|
||||
#include "editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto3_editions.pb.h"
|
||||
#include "editions/proto/test_editions_default_features.pb.h"
|
||||
#include "google/protobuf/test_textproto.h"
|
||||
|
||||
// These tests provide some basic minimal coverage that protos work as expected.
|
|
@ -6,7 +6,7 @@
|
|||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "google/protobuf/editions/golden/test_messages_proto2_editions.pb.h"
|
||||
#include "editions/golden/test_messages_proto2_editions.pb.h"
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
|
@ -8,8 +8,8 @@ load("//bazel:proto_library.bzl", "proto_library")
|
|||
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
|
||||
load("//build_defs:java_opts.bzl", "protobuf_java_export", "protobuf_java_library", "protobuf_versioned_java_library")
|
||||
load("//conformance:defs.bzl", "conformance_test")
|
||||
load("//editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
|
||||
load("//java/internal:testing.bzl", "junit_tests")
|
||||
load("//src/google/protobuf/editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
|
||||
load("//upb/cmake:build_defs.bzl", "staleness_test")
|
||||
|
||||
LITE_SRCS = [
|
||||
|
@ -120,13 +120,13 @@ internal_gen_well_known_protos_java(
|
|||
name = "gen_well_known_protos_javalite",
|
||||
javalite = True,
|
||||
deps = [
|
||||
":java_features_proto",
|
||||
"//:any_proto",
|
||||
"//:api_proto",
|
||||
"//:descriptor_proto",
|
||||
"//:duration_proto",
|
||||
"//:empty_proto",
|
||||
"//:field_mask_proto",
|
||||
"//:java_features_proto",
|
||||
"//:source_context_proto",
|
||||
"//:struct_proto",
|
||||
"//:timestamp_proto",
|
||||
|
@ -168,7 +168,7 @@ protobuf_java_export(
|
|||
maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_JAVA_VERSION,
|
||||
pom_template = "//java/lite:pom_template.xml",
|
||||
resources = [
|
||||
":java_features_proto",
|
||||
"//:java_features_proto",
|
||||
"//:lite_well_known_protos",
|
||||
"//src/google/protobuf:descriptor_proto_srcs",
|
||||
],
|
||||
|
@ -186,9 +186,8 @@ proto_library(
|
|||
srcs = ["src/main/resources/google/protobuf/java_features.proto"],
|
||||
strip_import_prefix = "/java/core/src/main/resources",
|
||||
visibility = [
|
||||
"//java/kotlin:__pkg__",
|
||||
"//java/kotlin-lite:__pkg__",
|
||||
"//java/lite:__pkg__",
|
||||
"//:__pkg__",
|
||||
"//java/__subpackages__",
|
||||
"//pkg:__pkg__",
|
||||
],
|
||||
deps = ["//:descriptor_proto"],
|
||||
|
@ -204,7 +203,7 @@ compile_edition_defaults(
|
|||
name = "java_edition_defaults",
|
||||
srcs = [
|
||||
"//:descriptor_proto",
|
||||
"//java/core:java_features_proto",
|
||||
"//:java_features_proto",
|
||||
],
|
||||
maximum_edition = "2023",
|
||||
minimum_edition = "PROTO2",
|
||||
|
@ -229,7 +228,6 @@ staleness_test(
|
|||
internal_gen_well_known_protos_java(
|
||||
name = "gen_well_known_protos_java",
|
||||
deps = [
|
||||
":java_features_proto",
|
||||
"//:any_proto",
|
||||
"//:api_proto",
|
||||
"//:compiler_plugin_proto",
|
||||
|
@ -237,6 +235,7 @@ internal_gen_well_known_protos_java(
|
|||
"//:duration_proto",
|
||||
"//:empty_proto",
|
||||
"//:field_mask_proto",
|
||||
"//:java_features_proto",
|
||||
"//:source_context_proto",
|
||||
"//:struct_proto",
|
||||
"//:timestamp_proto",
|
||||
|
@ -308,7 +307,7 @@ proto_lang_toolchain(
|
|||
name = "toolchain",
|
||||
# keep this in sync w/ WELL_KNOWN_PROTO_MAP in //:BUILD
|
||||
blacklisted_protos = [
|
||||
":java_features_proto",
|
||||
"//:java_features_proto",
|
||||
"//:any_proto",
|
||||
"//:api_proto",
|
||||
"//:compiler_plugin_proto",
|
||||
|
|
|
@ -26,12 +26,12 @@ internal_gen_kt_protos(
|
|||
"//:duration_proto",
|
||||
"//:empty_proto",
|
||||
"//:field_mask_proto",
|
||||
"//:java_features_proto",
|
||||
"//:source_context_proto",
|
||||
"//:struct_proto",
|
||||
"//:timestamp_proto",
|
||||
"//:type_proto",
|
||||
"//:wrappers_proto",
|
||||
"//java/core:java_features_proto",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -56,8 +56,8 @@ kt_jvm_export(
|
|||
maven_coordinates = "com.google.protobuf:protobuf-kotlin-lite:%s" % PROTOBUF_JAVA_VERSION,
|
||||
pom_template = "//java/kotlin-lite:pom_template.xml",
|
||||
resources = [
|
||||
"//:java_features_proto",
|
||||
"//:well_known_type_protos",
|
||||
"//java/core:java_features_proto",
|
||||
"//src/google/protobuf:descriptor_proto_srcs",
|
||||
],
|
||||
tags = ["manual"],
|
||||
|
|
|
@ -59,8 +59,8 @@ kt_jvm_export(
|
|||
maven_coordinates = "com.google.protobuf:protobuf-kotlin:%s" % PROTOBUF_JAVA_VERSION,
|
||||
pom_template = "//java/kotlin:pom_template.xml",
|
||||
resources = [
|
||||
"//:java_features_proto",
|
||||
"//:well_known_type_protos",
|
||||
"//java/core:java_features_proto",
|
||||
"//src/google/protobuf:descriptor_proto_srcs",
|
||||
],
|
||||
tags = ["manual"],
|
||||
|
@ -315,12 +315,12 @@ internal_gen_kt_protos(
|
|||
"//:duration_proto",
|
||||
"//:empty_proto",
|
||||
"//:field_mask_proto",
|
||||
"//:java_features_proto",
|
||||
"//:source_context_proto",
|
||||
"//:struct_proto",
|
||||
"//:timestamp_proto",
|
||||
"//:type_proto",
|
||||
"//:wrappers_proto",
|
||||
"//java/core:java_features_proto",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ proto_lang_toolchain(
|
|||
name = "toolchain",
|
||||
# keep this in sync w/ LITE_WELL_KNOWN_PROTO_MAP in //:BUILD
|
||||
blacklisted_protos = [
|
||||
"//java/core:java_features_proto",
|
||||
"//:java_features_proto",
|
||||
"//:any_proto",
|
||||
"//:api_proto",
|
||||
"//:duration_proto",
|
||||
|
|
|
@ -13,7 +13,7 @@ load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
|
|||
load("//build_defs:arch_tests.bzl", "aarch64_test", "x86_64_test")
|
||||
load("//build_defs:cpp_opts.bzl", "COPTS")
|
||||
load("//conformance:defs.bzl", "conformance_test")
|
||||
load("//src/google/protobuf/editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
|
||||
load("//editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
|
||||
load(":internal.bzl", "internal_copy_files", "internal_py_test")
|
||||
|
||||
def build_targets(name):
|
||||
|
@ -55,6 +55,7 @@ def build_targets(name):
|
|||
srcs_version = "PY2AND3",
|
||||
visibility = [
|
||||
"//:__pkg__",
|
||||
"//editions:__pkg__",
|
||||
"//upb:__subpackages__",
|
||||
],
|
||||
)
|
||||
|
@ -234,8 +235,6 @@ def build_targets(name):
|
|||
srcs = [
|
||||
"//src/google/protobuf:test_messages_proto2.proto",
|
||||
"//src/google/protobuf:test_messages_proto3.proto",
|
||||
"//src/google/protobuf/editions:golden/test_messages_proto2_editions.proto",
|
||||
"//src/google/protobuf/editions:golden/test_messages_proto3_editions.proto",
|
||||
],
|
||||
strip_prefix = "src",
|
||||
)
|
||||
|
|
|
@ -113,8 +113,6 @@ internal_copy_files(
|
|||
srcs = [
|
||||
"//src/google/protobuf:test_messages_proto2.proto",
|
||||
"//src/google/protobuf:test_messages_proto3.proto",
|
||||
"//src/google/protobuf/editions:golden/test_messages_proto2_editions.proto",
|
||||
"//src/google/protobuf/editions:golden/test_messages_proto3_editions.proto",
|
||||
],
|
||||
strip_prefix = "src",
|
||||
)
|
||||
|
@ -131,6 +129,25 @@ internal_ruby_proto_library(
|
|||
deps = [":well_known_ruby_protos"],
|
||||
)
|
||||
|
||||
internal_copy_files(
|
||||
name = "copied_conformance_editions_test_files",
|
||||
testonly = 1,
|
||||
srcs = [
|
||||
"//editions:golden/test_messages_proto2_editions.proto",
|
||||
"//editions:golden/test_messages_proto3_editions.proto",
|
||||
],
|
||||
strip_prefix = "editions/golden/",
|
||||
)
|
||||
|
||||
internal_ruby_proto_library(
|
||||
name = "conformance_editions_test_ruby_proto",
|
||||
testonly = 1,
|
||||
srcs = [":copied_conformance_editions_test_files"],
|
||||
includes = ["."],
|
||||
visibility = ["//conformance:__pkg__"],
|
||||
deps = [":well_known_ruby_protos"],
|
||||
)
|
||||
|
||||
ruby_library(
|
||||
name = "protobuf",
|
||||
visibility = [
|
||||
|
|
|
@ -64,3 +64,8 @@ staleness_test(
|
|||
# test.
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
test_suite(
|
||||
name = "editions_tests",
|
||||
tests = ["//editions:all_tests"],
|
||||
)
|
||||
|
|
|
@ -895,7 +895,7 @@ proto_library(
|
|||
name = "unittest_features_proto",
|
||||
srcs = ["unittest_features.proto"],
|
||||
strip_import_prefix = "/src",
|
||||
visibility = ["//src/google/protobuf:__subpackages__"],
|
||||
visibility = ["//editions:__subpackages__"],
|
||||
deps = [
|
||||
":descriptor_proto",
|
||||
],
|
||||
|
@ -903,7 +903,7 @@ proto_library(
|
|||
|
||||
cc_proto_library(
|
||||
name = "unittest_features_cc_proto",
|
||||
visibility = ["//src/google/protobuf:__subpackages__"],
|
||||
visibility = ["//editions:__subpackages__"],
|
||||
deps = [":unittest_features_proto"],
|
||||
)
|
||||
|
||||
|
@ -1290,6 +1290,7 @@ cc_library(
|
|||
hdrs = ["test_textproto.h"],
|
||||
strip_include_prefix = "/src",
|
||||
visibility = [
|
||||
"//editions:__pkg__",
|
||||
"//pkg:__pkg__",
|
||||
"//src/google/protobuf:__subpackages__",
|
||||
],
|
||||
|
|
|
@ -69,8 +69,8 @@ cc_binary(
|
|||
":conformance_upb_proto_reflection",
|
||||
":test_messages_proto2_upbdefs",
|
||||
":test_messages_proto3_upbdefs",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_upbdefs",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_upbdefs",
|
||||
"//editions:test_messages_proto2_editions_upbdefs",
|
||||
"//editions:test_messages_proto3_editions_upbdefs",
|
||||
"//upb:base",
|
||||
"//upb:json",
|
||||
"//upb:port",
|
||||
|
@ -123,8 +123,8 @@ cc_binary(
|
|||
":conformance_upb_proto_reflection",
|
||||
":test_messages_proto2_upbdefs",
|
||||
":test_messages_proto3_upbdefs",
|
||||
"//src/google/protobuf/editions:test_messages_proto2_editions_upbdefs",
|
||||
"//src/google/protobuf/editions:test_messages_proto3_editions_upbdefs",
|
||||
"//editions:test_messages_proto2_editions_upbdefs",
|
||||
"//editions:test_messages_proto3_editions_upbdefs",
|
||||
"//upb:base",
|
||||
"//upb:json",
|
||||
"//upb:port",
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
#include "conformance/conformance.upb.h"
|
||||
#include "conformance/conformance.upbdefs.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto2_editions.upbdefs.h"
|
||||
#include "google/protobuf/editions/golden/test_messages_proto3_editions.upbdefs.h"
|
||||
#include "editions/golden/test_messages_proto2_editions.upbdefs.h"
|
||||
#include "editions/golden/test_messages_proto3_editions.upbdefs.h"
|
||||
#include "google/protobuf/test_messages_proto2.upbdefs.h"
|
||||
#include "google/protobuf/test_messages_proto3.upbdefs.h"
|
||||
#include "upb/base/upcast.h"
|
||||
|
@ -314,11 +314,11 @@ int main(void) {
|
|||
symtab, &google_protobuf_test_messages_proto3_proto_upbdefinit, true);
|
||||
_upb_DefPool_LoadDefInitEx(
|
||||
symtab,
|
||||
&google_protobuf_editions_golden_test_messages_proto2_editions_proto_upbdefinit,
|
||||
&editions_golden_test_messages_proto2_editions_proto_upbdefinit,
|
||||
true);
|
||||
_upb_DefPool_LoadDefInitEx(
|
||||
symtab,
|
||||
&google_protobuf_editions_golden_test_messages_proto3_editions_proto_upbdefinit,
|
||||
&editions_golden_test_messages_proto3_editions_proto_upbdefinit,
|
||||
true);
|
||||
#else
|
||||
protobuf_test_messages_proto2_TestAllTypesProto2_getmsgdef(symtab);
|
||||
|
|
|
@ -10,7 +10,7 @@ load("//bazel:upb_proto_library.bzl", "upb_proto_reflection_library")
|
|||
|
||||
# end:github_only
|
||||
load(
|
||||
"//src/google/protobuf/editions:defaults.bzl",
|
||||
"//editions:defaults.bzl",
|
||||
"compile_edition_defaults",
|
||||
"embed_edition_defaults",
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue