Changing BUILD files and adding pom templates

pull/8752/head
Deanna Garcia 3 years ago
parent 4644980d81
commit 89a9f459e9
  1. 35
      BUILD
  2. 19
      WORKSPACE
  3. 17
      java/core/BUILD
  4. 18
      java/core/pom_template.xml
  5. 1
      java/lite/BUILD
  6. 19
      java/lite/pom_template.xml
  7. 9
      java/util/BUILD
  8. 18
      java/util/pom_template.xml
  9. 1
      version.bzl

35
BUILD

@ -293,12 +293,45 @@ WELL_KNOWN_PROTO_MAP = {
WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()]
LITE_WELL_KNOWN_PROTO_MAP = {
"any": ("src/google/protobuf/any.proto", []),
"api": (
"src/google/protobuf/api.proto",
[
"source_context",
"type",
],
),
"duration": ("src/google/protobuf/duration.proto", []),
"empty": ("src/google/protobuf/empty.proto", []),
"field_mask": ("src/google/protobuf/field_mask.proto", []),
"source_context": ("src/google/protobuf/source_context.proto", []),
"struct": ("src/google/protobuf/struct.proto", []),
"timestamp": ("src/google/protobuf/timestamp.proto", []),
"type": (
"src/google/protobuf/type.proto",
[
"any",
"source_context",
],
),
"wrappers": ("src/google/protobuf/wrappers.proto", []),
}
LITE_WELL_KNOWN_PROTOS = [value[0] for value in LITE_WELL_KNOWN_PROTO_MAP.values()]
filegroup(
name = "well_known_protos",
srcs = WELL_KNOWN_PROTOS,
visibility = ["//visibility:public"],
)
filegroup(
name = "lite_well_known_protos",
srcs = LITE_WELL_KNOWN_PROTOS,
visibility = ["//visibility:public"],
)
adapt_proto_library(
name = "cc_wkt_protos_genproto",
deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
@ -747,7 +780,7 @@ internal_gen_well_known_protos_java(
internal_gen_well_known_protos_java(
name = "gen_well_known_protos_javalite",
deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
deps = [proto + "_proto" for proto in LITE_WELL_KNOWN_PROTO_MAP.keys()],
javalite = True,
visibility = [
"//java:__subpackages__",

@ -26,6 +26,13 @@ http_archive(
],
)
http_archive(
name = "bazel_common",
sha256 = "d8c9586b24ce4a5513d972668f94b62eb7d705b92405d4bc102131f294751f1d",
strip_prefix = "bazel-common-413b433b91f26dbe39cdbc20f742ad6555dd1e27",
url = "https://github.com/google/bazel-common/archive/413b433b91f26dbe39cdbc20f742ad6555dd1e27.zip",
)
# Load common dependencies.
load("//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
@ -35,16 +42,24 @@ bind(
actual = "//util/python:python_headers",
)
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
rules_jvm_external_deps()
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
rules_jvm_external_setup()
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = [
"com.google.guava:guava:30.1.1-jre",
"com.google.code.gson:gson:2.8.6",
"com.google.errorprone:error_prone_annotations:2.3.2",
"com.google.guava:guava:30.1.1-jre",
"com.google.truth:truth:1.1.2",
"junit:junit:4.12",
"org.easymock:easymock:3.2",
"org.easymock:easymockclassextension:3.2",
"com.google.truth:truth:1.1.2",
],
repositories = [
"https://repo1.maven.org/maven2",

@ -1,7 +1,9 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library", "java_proto_library", "java_lite_proto_library")
load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("//:internal.bzl", "conformance_test")
load("//:version.bzl", "VERSION")
load("//java/internal:testing.bzl", "junit_tests")
LITE_SRCS = [
@ -96,14 +98,19 @@ LITE_SRCS = [
]
# Should be used as `//java/lite`.
java_library(
java_export(
name = "lite",
maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % VERSION,
pom_template = "//java/lite:pom_template.xml",
srcs = LITE_SRCS + [
"//:gen_well_known_protos_javalite"
],
visibility = [
"//java/lite:__pkg__",
],
resources = [
"//:lite_well_known_protos",
],
)
java_library(
@ -111,8 +118,10 @@ java_library(
srcs = LITE_SRCS,
)
java_library(
java_export(
name = "core",
maven_coordinates = "com.google.protobuf:protobuf-java:%s" % VERSION,
pom_template = "pom_template.xml",
srcs = glob(
[
"src/main/java/com/google/protobuf/*.java",
@ -128,6 +137,9 @@ java_library(
deps = [
":lite_runtime_only",
],
resources = [
"//:well_known_protos",
],
)
proto_lang_toolchain(
@ -324,3 +336,4 @@ junit_tests(
"//external:truth",
]
)

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{groupId}</groupId>
<artifactId>protobuf-parent</artifactId>
<version>{version}</version>
</parent>
<artifactId>{artifactId}</artifactId>
<packaging>{type}</packaging>
<name>Protocol Buffers [Core]</name>
<description>
Core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an
efficient yet extensible format.
</description>
</project>

@ -4,6 +4,7 @@ load("//:internal.bzl", "conformance_test")
load("//java/internal:testing.bzl", "junit_tests")
exports_files(["lite.awk"], visibility = ["//java/core:__pkg__"])
exports_files(["pom_template.xml"], visibility = ["//java/core:__pkg__"])
alias(
name = "lite",

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{groupId}</groupId>
<artifactId>protobuf-parent</artifactId>
<version>{version}</version>
</parent>
<artifactId>{artifactId}</artifactId>
<packaging>{type}</packaging>
<name>Protocol Buffers [Lite]</name>
<description>
Lite version of Protocol Buffers library. This version is optimized for code size, but does
not guarantee API/ABI stability.
</description>
</project>

@ -1,9 +1,13 @@
load("@rules_java//java:defs.bzl", "java_library", "java_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:version.bzl", "VERSION")
load("//java/internal:testing.bzl", "junit_tests")
java_library(
java_export(
name = "util",
maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % VERSION,
pom_template = "pom_template.xml",
srcs = glob([
"src/main/java/com/google/protobuf/util/*.java",
]),
@ -13,7 +17,6 @@ java_library(
"//external:gson",
"//external:guava",
"//java/core",
"//java/lite",
],
)

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>{groupId}</groupId>
<artifactId>protobuf-parent</artifactId>
<version>{version}</version>
</parent>
<artifactId>{artifactId}</artifactId>
<packaging>{type}</packaging>
<name>Protocol Buffers [Util]</name>
<description>Utilities for Protocol Buffers</description>
{dependencies}
</project>

@ -0,0 +1 @@
VERSION = '3.17.3'
Loading…
Cancel
Save