blob: 939d353b16804c6c6778c2dbb694184a635382d8 [file] [log] [blame]
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:java_library.bzl", "java_library")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("//:protobuf.bzl", "internal_gen_well_known_protos_java")
load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION")
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
load("//bazel:java_proto_library.bzl", "java_proto_library")
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("//upb/cmake:build_defs.bzl", "staleness_test")
LITE_SRCS = [
"src/main/java/com/google/protobuf/AbstractMessageLite.java",
"src/main/java/com/google/protobuf/AbstractParser.java",
"src/main/java/com/google/protobuf/AbstractProtobufList.java",
"src/main/java/com/google/protobuf/AllocatedBuffer.java",
"src/main/java/com/google/protobuf/Android.java",
"src/main/java/com/google/protobuf/ArrayDecoders.java",
"src/main/java/com/google/protobuf/BinaryReader.java",
"src/main/java/com/google/protobuf/BinaryWriter.java",
"src/main/java/com/google/protobuf/BooleanArrayList.java",
"src/main/java/com/google/protobuf/BufferAllocator.java",
"src/main/java/com/google/protobuf/ByteBufferWriter.java",
"src/main/java/com/google/protobuf/ByteOutput.java",
"src/main/java/com/google/protobuf/ByteString.java",
"src/main/java/com/google/protobuf/CanIgnoreReturnValue.java",
"src/main/java/com/google/protobuf/CheckReturnValue.java",
"src/main/java/com/google/protobuf/CodedInputStream.java",
"src/main/java/com/google/protobuf/CodedInputStreamReader.java",
"src/main/java/com/google/protobuf/CodedOutputStream.java",
"src/main/java/com/google/protobuf/CodedOutputStreamWriter.java",
"src/main/java/com/google/protobuf/CompileTimeConstant.java",
"src/main/java/com/google/protobuf/DoubleArrayList.java",
"src/main/java/com/google/protobuf/ExperimentalApi.java",
"src/main/java/com/google/protobuf/ExtensionLite.java",
"src/main/java/com/google/protobuf/ExtensionRegistryFactory.java",
"src/main/java/com/google/protobuf/ExtensionRegistryLite.java",
"src/main/java/com/google/protobuf/ExtensionSchema.java",
"src/main/java/com/google/protobuf/ExtensionSchemaLite.java",
"src/main/java/com/google/protobuf/ExtensionSchemas.java",
"src/main/java/com/google/protobuf/FieldInfo.java",
"src/main/java/com/google/protobuf/FieldSet.java",
"src/main/java/com/google/protobuf/FieldType.java",
"src/main/java/com/google/protobuf/FloatArrayList.java",
"src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java",
"src/main/java/com/google/protobuf/GeneratedMessageLite.java",
"src/main/java/com/google/protobuf/InlineMe.java",
"src/main/java/com/google/protobuf/IntArrayList.java",
"src/main/java/com/google/protobuf/Internal.java",
"src/main/java/com/google/protobuf/InvalidProtocolBufferException.java",
"src/main/java/com/google/protobuf/IterableByteBufferInputStream.java",
"src/main/java/com/google/protobuf/Java8Compatibility.java",
"src/main/java/com/google/protobuf/JavaType.java",
"src/main/java/com/google/protobuf/LazyField.java",
"src/main/java/com/google/protobuf/LazyFieldLite.java",
"src/main/java/com/google/protobuf/LazyStringArrayList.java",
"src/main/java/com/google/protobuf/LazyStringList.java",
"src/main/java/com/google/protobuf/ListFieldSchema.java",
"src/main/java/com/google/protobuf/ListFieldSchemaLite.java",
"src/main/java/com/google/protobuf/ListFieldSchemas.java",
"src/main/java/com/google/protobuf/LongArrayList.java",
"src/main/java/com/google/protobuf/ManifestSchemaFactory.java",
"src/main/java/com/google/protobuf/MapEntryLite.java",
"src/main/java/com/google/protobuf/MapFieldLite.java",
"src/main/java/com/google/protobuf/MapFieldSchema.java",
"src/main/java/com/google/protobuf/MapFieldSchemaLite.java",
"src/main/java/com/google/protobuf/MapFieldSchemas.java",
"src/main/java/com/google/protobuf/MessageInfo.java",
"src/main/java/com/google/protobuf/MessageInfoFactory.java",
"src/main/java/com/google/protobuf/MessageLite.java",
"src/main/java/com/google/protobuf/MessageLiteOrBuilder.java",
"src/main/java/com/google/protobuf/MessageLiteToString.java",
"src/main/java/com/google/protobuf/MessageSchema.java",
"src/main/java/com/google/protobuf/MessageSetSchema.java",
"src/main/java/com/google/protobuf/MutabilityOracle.java",
"src/main/java/com/google/protobuf/NewInstanceSchema.java",
"src/main/java/com/google/protobuf/NewInstanceSchemaLite.java",
"src/main/java/com/google/protobuf/NewInstanceSchemas.java",
"src/main/java/com/google/protobuf/OneofInfo.java",
"src/main/java/com/google/protobuf/Parser.java",
"src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java",
"src/main/java/com/google/protobuf/ProtoSyntax.java",
"src/main/java/com/google/protobuf/Protobuf.java",
"src/main/java/com/google/protobuf/ProtobufArrayList.java",
"src/main/java/com/google/protobuf/ProtocolStringList.java",
"src/main/java/com/google/protobuf/RawMessageInfo.java",
"src/main/java/com/google/protobuf/Reader.java",
"src/main/java/com/google/protobuf/RopeByteString.java",
"src/main/java/com/google/protobuf/RuntimeVersion.java",
"src/main/java/com/google/protobuf/Schema.java",
"src/main/java/com/google/protobuf/SchemaFactory.java",
"src/main/java/com/google/protobuf/SchemaUtil.java",
"src/main/java/com/google/protobuf/SmallSortedMap.java",
"src/main/java/com/google/protobuf/StructuralMessageInfo.java",
"src/main/java/com/google/protobuf/TextFormatEscaper.java",
"src/main/java/com/google/protobuf/UninitializedMessageException.java",
"src/main/java/com/google/protobuf/UnknownFieldSchema.java",
"src/main/java/com/google/protobuf/UnknownFieldSetLite.java",
"src/main/java/com/google/protobuf/UnknownFieldSetLiteSchema.java",
"src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java",
"src/main/java/com/google/protobuf/UnsafeByteOperations.java",
"src/main/java/com/google/protobuf/UnsafeUtil.java",
"src/main/java/com/google/protobuf/Utf8.java",
"src/main/java/com/google/protobuf/WireFormat.java",
"src/main/java/com/google/protobuf/Writer.java",
]
FULL_SRCS = glob(
[
"src/main/java/com/google/protobuf/*.java",
],
exclude = LITE_SRCS,
) + [
":gen_well_known_protos_java",
]
internal_gen_well_known_protos_java(
name = "gen_well_known_protos_javalite",
javalite = True,
deps = [
"//:any_proto",
"//:api_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
"//:java_features_proto",
"//:source_context_proto",
"//:struct_proto",
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
],
)
# Should be used as `//java/lite`.
java_library(
name = "lite",
srcs = LITE_SRCS + [
":gen_well_known_protos_javalite",
],
visibility = [
"//java/lite:__pkg__",
],
)
protobuf_versioned_java_library(
name = "lite_bundle",
srcs = LITE_SRCS + [
":gen_well_known_protos_javalite",
],
automatic_module_name = "com.google.protobuf",
bundle_description = "Lite version of Protocol Buffers library. This " +
"version is optimized for code size, but does not " +
"guarantee API/ABI stability.",
bundle_name = "Protocol Buffers [Lite]",
bundle_symbolic_name = "com.google.protobuf",
visibility = [
"//java/lite:__pkg__",
],
)
# Bazel users, don't depend on this target, use //java/lite.
protobuf_java_export(
name = "lite_mvn",
maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "//java/lite:pom_template.xml",
resources = [
"//:java_features_proto",
"//:lite_well_known_protos",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [":lite_bundle"],
)
protobuf_java_library(
name = "lite_runtime_only",
srcs = LITE_SRCS,
)
proto_library(
name = "java_features_proto",
srcs = ["src/main/resources/google/protobuf/java_features.proto"],
strip_import_prefix = "/java/core/src/main/resources",
visibility = [
"//:__pkg__",
"//editions:__pkg__",
"//java/__subpackages__",
"//pkg:__pkg__",
],
deps = ["//:descriptor_proto"],
)
cc_proto_library(
name = "java_features_cc_proto",
visibility = [
"//editions:__pkg__",
"//src/google/protobuf/compiler/java:__pkg__", # For java/names.h
],
deps = [":java_features_proto"],
)
filegroup(
name = "java_features_proto_srcs",
srcs = ["src/main/resources/google/protobuf/java_features.proto"],
visibility = ["//pkg:__pkg__"],
)
compile_edition_defaults(
name = "java_edition_defaults",
srcs = [
"//:descriptor_proto",
"//:java_features_proto",
],
maximum_edition = "2023",
minimum_edition = "PROTO2",
)
embed_edition_defaults(
name = "embedded_java_edition_defaults_generate",
defaults = "java_edition_defaults",
output = "generated/src/main/java/com/google/protobuf/JavaEditionDefaults.java",
placeholder = "DEFAULTS_VALUE",
template = "src/main/java/com/google/protobuf/JavaEditionDefaults.java.template",
)
staleness_test(
name = "generated_java_defaults_staleness_test",
outs = ["src/main/java/com/google/protobuf/JavaEditionDefaults.java"],
generated_pattern = "generated/%s",
tags = ["manual"],
target_files = ["src/main/java/com/google/protobuf/JavaEditionDefaults.java"],
)
internal_gen_well_known_protos_java(
name = "gen_well_known_protos_java",
deps = [
"//:any_proto",
"//:api_proto",
"//:compiler_plugin_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
"//:java_features_proto",
"//:source_context_proto",
"//:struct_proto",
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
],
)
java_library(
name = "core",
srcs = FULL_SRCS,
visibility = ["//visibility:public"],
exports = [
":lite_runtime_only",
],
deps = [
":lite_runtime_only",
],
)
protobuf_versioned_java_library(
name = "core_bundle",
srcs = FULL_SRCS,
automatic_module_name = "com.google.protobuf",
bundle_description = "Core Protocol Buffers library. Protocol Buffers " +
"are a way of encoding structured data in an " +
"efficient yet extensible format.",
bundle_name = "Protocol Buffers [Core]",
bundle_symbolic_name = "com.google.protobuf",
visibility = ["//visibility:public"],
exports = [
":lite_runtime_only",
],
deps = [
":lite_runtime_only",
],
)
# Bazel users, don't depend on this target, use :core.
protobuf_java_export(
name = "core_mvn",
maven_coordinates = "com.google.protobuf:protobuf-java:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "pom_template.xml",
resources = [
":java_features_proto_srcs",
"//:well_known_type_protos",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [":core_bundle"],
)
filegroup(
name = "release",
srcs = [
":core_mvn-docs",
":core_mvn-maven-source",
":core_mvn-pom",
":core_mvn-project",
":lite_mvn-docs",
":lite_mvn-maven-source",
":lite_mvn-pom",
":lite_mvn-project",
],
visibility = ["//java:__pkg__"],
)
proto_lang_toolchain(
name = "toolchain",
# keep this in sync w/ WELL_KNOWN_PROTO_MAP in //:BUILD
blacklisted_protos = [
"//:java_features_proto",
"//:any_proto",
"//:api_proto",
"//:compiler_plugin_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
"//:source_context_proto",
"//:struct_proto",
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
],
command_line = "--java_out=$(OUT)",
runtime = ":core",
visibility = ["//visibility:public"],
)
proto_library(
name = "java_test_protos",
srcs = glob(["src/test/proto/**/*.proto"]),
strip_import_prefix = "src/test/proto",
deps = [
"//:any_proto",
"//:descriptor_proto",
"//:java_features_proto",
"//:lite_test_protos",
"//:wrappers_proto",
"//src/google/protobuf:generic_test_protos",
],
)
java_proto_library(
name = "generic_test_protos_java_proto",
visibility = [
"//java:__subpackages__",
],
deps = ["//src/google/protobuf:generic_test_protos"],
)
java_proto_library(
name = "generic_test_protos_editions_java_proto",
visibility = [
"//java:__subpackages__",
],
deps = ["//src/google/protobuf:generic_test_editions_protos"],
)
java_proto_library(
name = "lite_test_protos_java_proto",
visibility = [
"//java:__subpackages__",
],
deps = ["//:lite_test_protos"],
)
java_proto_library(
name = "java_test_protos_java_proto",
deps = [":java_test_protos"],
)
protobuf_java_library(
name = "test_util",
srcs = [
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
],
visibility = ["//java:__subpackages__"],
deps = [
":core",
":generic_test_protos_java_proto",
":java_test_protos_java_proto",
":lite_test_protos_java_proto",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:junit_junit",
],
)
test_suite(
name = "tests",
tests = [
"conformance_test",
"core_build_test",
"core_tests",
"utf8_tests",
],
)
build_test(
name = "core_build_test",
targets = [
":core",
],
)
conformance_test(
name = "conformance_test",
failure_list = "//conformance:failure_list_java.txt",
maximum_edition = "2023",
testee = "//conformance:conformance_java",
text_format_failure_list = "//conformance:text_format_failure_list_java.txt",
)
junit_tests(
name = "core_tests",
size = "small",
srcs = glob(
["src/test/java/**/*.java"],
exclude = [
"src/test/java/com/google/protobuf/DecodeUtf8Test.java",
"src/test/java/com/google/protobuf/IsValidUtf8Test.java",
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
"src/test/java/com/google/protobuf/RuntimeVersionTest.java",
],
),
data = ["//src/google/protobuf:testdata"],
deps = [
":core",
":generic_test_protos_editions_java_proto",
":generic_test_protos_java_proto",
":java_test_protos_java_proto",
":lite_test_protos_java_proto",
":test_util",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:com_google_truth_truth",
"@protobuf_maven//:junit_junit",
"@protobuf_maven//:org_mockito_mockito_core",
],
)
# The UTF-8 validation tests are much slower than the other tests, so they get
# their own test target with a longer timeout.
junit_tests(
name = "utf8_tests",
size = "large",
srcs = [
"src/test/java/com/google/protobuf/DecodeUtf8Test.java",
"src/test/java/com/google/protobuf/IsValidUtf8Test.java",
"src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java",
],
deps = [
":core",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:com_google_truth_truth",
"@protobuf_maven//:junit_junit",
],
)
java_lite_proto_library(
name = "generic_test_protos_java_proto_lite",
visibility = [
"//java/kotlin-lite:__pkg__",
"//java/lite:__pkg__",
],
deps = ["//src/google/protobuf:generic_test_protos"],
)
java_lite_proto_library(
name = "lite_test_protos_java_proto_lite",
visibility = [
"//java/kotlin-lite:__pkg__",
"//java/lite:__pkg__",
],
deps = ["//:lite_test_protos"],
)
java_lite_proto_library(
name = "java_test_protos_java_proto_lite",
visibility = [
"//java/lite:__pkg__",
],
deps = [":java_test_protos"],
)
genrule(
name = "rewrite_javalite_test_util",
srcs = [
"//java/lite:lite.awk",
"src/test/java/com/google/protobuf/TestUtil.java",
],
outs = ["TestUtil.java"],
cmd = "awk -f $(location //java/lite:lite.awk) $(location src/test/java/com/google/protobuf/TestUtil.java) > $@",
)
protobuf_java_library(
name = "test_util_lite",
srcs = [
"src/test/java/com/google/protobuf/TestUtilLite.java",
":rewrite_javalite_test_util",
],
visibility = [
"//java/kotlin-lite:__pkg__",
"//java/lite:__pkg__",
],
deps = [
":generic_test_protos_java_proto_lite",
":java_test_protos_java_proto_lite",
":lite_runtime_only",
":lite_test_protos_java_proto_lite",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:junit_junit",
],
)
LITE_TEST_EXCLUSIONS = [
"src/test/java/com/google/protobuf/AbstractMessageTest.java",
"src/test/java/com/google/protobuf/AbstractProto2SchemaTest.java",
"src/test/java/com/google/protobuf/AnyTest.java",
"src/test/java/com/google/protobuf/CodedInputStreamTest.java",
"src/test/java/com/google/protobuf/DeprecatedFieldTest.java",
"src/test/java/com/google/protobuf/DebugFormatTest.java",
"src/test/java/com/google/protobuf/DescriptorsTest.java",
"src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java",
"src/test/java/com/google/protobuf/DynamicMessageTest.java",
"src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java",
"src/test/java/com/google/protobuf/FieldPresenceTest.java",
"src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java",
"src/test/java/com/google/protobuf/GeneratedMessageTest.java",
"src/test/java/com/google/protobuf/LazilyParsedMessageSetTest.java",
"src/test/java/com/google/protobuf/LazyFieldTest.java",
"src/test/java/com/google/protobuf/LazyStringEndToEndTest.java",
"src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java",
"src/test/java/com/google/protobuf/MapForProto2Test.java",
"src/test/java/com/google/protobuf/MapTest.java",
"src/test/java/com/google/protobuf/MessageTest.java",
"src/test/java/com/google/protobuf/NestedBuildersTest.java",
"src/test/java/com/google/protobuf/PackedFieldTest.java",
"src/test/java/com/google/protobuf/ParserTest.java",
"src/test/java/com/google/protobuf/ParseExceptionsTest.java",
"src/test/java/com/google/protobuf/Proto2ExtensionLookupSchemaTest.java",
"src/test/java/com/google/protobuf/Proto2SchemaTest.java",
"src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java",
"src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java",
"src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java",
"src/test/java/com/google/protobuf/ServiceTest.java",
"src/test/java/com/google/protobuf/SingleFieldBuilderTest.java",
"src/test/java/com/google/protobuf/TestBadIdentifiers.java",
"src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java",
"src/test/java/com/google/protobuf/TextFormatParseLocationTest.java",
"src/test/java/com/google/protobuf/TextFormatPerformanceTest.java",
"src/test/java/com/google/protobuf/TextFormatTest.java",
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
"src/test/java/com/google/protobuf/TypeRegistryTest.java",
"src/test/java/com/google/protobuf/UnknownEnumValueTest.java",
"src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java",
"src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java",
"src/test/java/com/google/protobuf/UnknownFieldSetTest.java",
"src/test/java/com/google/protobuf/WellKnownTypesTest.java",
"src/test/java/com/google/protobuf/WireFormatTest.java",
]
junit_tests(
name = "lite_tests",
size = "large",
srcs = glob(
["src/test/java/**/*.java"],
exclude = LITE_TEST_EXCLUSIONS,
),
data = ["//src/google/protobuf:testdata"],
test_prefix = "Lite",
deps = [
":generic_test_protos_java_proto_lite",
":java_test_protos_java_proto_lite",
":lite",
":lite_test_protos_java_proto_lite",
":test_util_lite",
"@protobuf_maven//:com_google_truth_truth",
"@protobuf_maven//:junit_junit",
"@protobuf_maven//:org_mockito_mockito_core",
],
)
protobuf_java_library(
name = "v25_test_util_srcjar",
testonly = True,
srcs = [
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
],
deps = [
":core",
"//compatibility:v25_test_protos_srcjar",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:junit_junit",
],
)
# Tests source compatibility against v25 gencode jar compiled against current runtime
junit_tests(
name = "v25_core_tests_srcjar",
size = "small",
srcs = glob(
["src/test/java/**/*.java"],
exclude = [
# Depends on test protos or API changes added in v4.x.x (e.g. editions)
"src/test/java/com/google/protobuf/TextFormatTest.java",
"src/test/java/com/google/protobuf/DescriptorsTest.java",
"src/test/java/com/google/protobuf/DebugFormatTest.java",
"src/test/java/com/google/protobuf/CodedOutputStreamTest.java",
"src/test/java/com/google/protobuf/CodedInputStreamTest.java",
"src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java",
"src/test/java/com/google/protobuf/FieldPresenceTest.java",
# Excluded in core_tests
"src/test/java/com/google/protobuf/DecodeUtf8Test.java",
"src/test/java/com/google/protobuf/IsValidUtf8Test.java",
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
"src/test/java/com/google/protobuf/RuntimeVersionTest.java",
],
),
test_prefix = "v25SrcJar",
deps = [
":core",
":v25_test_util_srcjar",
"//compatibility:v25_test_protos_srcjar",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:com_google_truth_truth",
"@protobuf_maven//:junit_junit",
"@protobuf_maven//:org_mockito_mockito_core",
],
)
protobuf_java_library(
name = "v25_test_util_jar",
testonly = True,
srcs = [
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
],
deps = [
":core",
"//compatibility:v25_test_protos_jar",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:junit_junit",
],
)
# Tests binary compatibility against v25 gencode ja compiled against v25 runtime
junit_tests(
name = "v25_core_tests_jar",
size = "small",
srcs = glob(
["src/test/java/**/*.java"],
exclude = [
# Depends on test protos or API changes added in v4.x.x (e.g. editions)
"src/test/java/com/google/protobuf/TextFormatTest.java",
"src/test/java/com/google/protobuf/DescriptorsTest.java",
"src/test/java/com/google/protobuf/DebugFormatTest.java",
"src/test/java/com/google/protobuf/CodedOutputStreamTest.java",
"src/test/java/com/google/protobuf/CodedInputStreamTest.java",
"src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java",
"src/test/java/com/google/protobuf/FieldPresenceTest.java",
# Excluded in core_tests
"src/test/java/com/google/protobuf/DecodeUtf8Test.java",
"src/test/java/com/google/protobuf/IsValidUtf8Test.java",
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
"src/test/java/com/google/protobuf/RuntimeVersionTest.java",
],
),
test_prefix = "v25Jar",
deps = [
":core",
":v25_test_util_jar",
"//compatibility:v25_test_protos_jar",
"@protobuf_maven//:com_google_guava_guava",
"@protobuf_maven//:com_google_truth_truth",
"@protobuf_maven//:junit_junit",
"@protobuf_maven//:org_mockito_mockito_core",
],
)
pkg_files(
name = "dist_files",
srcs = glob([
"src/main/java/com/google/protobuf/*.java",
"src/main/resources/google/protobuf/*.proto",
"src/test/java/**/*.java",
"src/test/proto/**/*.proto",
]) + [
"BUILD.bazel",
"generate-sources-build.xml",
"generate-test-sources-build.xml",
"pom_template.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)