protobuf/java/core/BUILD
Yannic f0cb9cdb95
[bazel] Move Java runtime/toolchains into //java (#7190)
* [bazel] Move Java runtime/toolchains into //java

This change moves `java_library` targets from the top-level BUILD file
into `//java/{core,lite,util}` and declares `alias` targets to point to
their new locations (hence, this is not a breaking change).

This will allow users that don't use Java to stop depending on
`@rules_java` (e.g. as requested in
https://github.com/bazelbuild/rules_scala/pull/989#issuecomment-583405161).

Note that there is no intention to deprecate + remove the top-level
targets in the foreseeable future.

* Add BUILD files in //java to java_EXTRA_DIST
2020-02-13 13:04:14 -08:00

138 lines
6.2 KiB
Python

load("@rules_java//java:defs.bzl", "java_library")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
LITE_SRCS = [
# Keep in sync with `//java/lite:pom.xml`.
"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/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/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/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/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/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/NioByteString.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/ProtobufLists.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/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/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",
]
javacopts = select({
"//java:jdk9": ["--add-modules=jdk.unsupported"],
"//conditions:default": [
"-source 7",
"-target 7",
],
})
# Should be used as `//java/lite`.
java_library(
name = "lite",
srcs = LITE_SRCS,
javacopts = javacopts,
visibility = [
"//java/lite:__pkg__",
],
)
java_library(
name = "core",
srcs = glob(
[
"src/main/java/com/google/protobuf/*.java",
],
exclude = LITE_SRCS,
) + [
"//:gen_well_known_protos_java",
],
javacopts = javacopts,
visibility = ["//visibility:public"],
exports = [
"//java/lite",
],
deps = [
"//java/lite",
],
)
proto_lang_toolchain(
name = "toolchain",
command_line = "--java_out=$(OUT)",
runtime = ":core",
visibility = ["//visibility:public"],
)