Skip to content

Commit

Permalink
Add rules_java load statements.
Browse files Browse the repository at this point in the history
Partial commit for third_party/*, see #9092.

Signed-off-by: iirina <elenairina@google.com>
  • Loading branch information
iirina committed Aug 6, 2019
1 parent 084afff commit a835361
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 30 deletions.
2 changes: 2 additions & 0 deletions third_party/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import", "java_library", "java_plugin")

package(default_visibility = ["//visibility:public"])

load("@rules_pkg//:pkg.bzl", "pkg_tar")
Expand Down
2 changes: 2 additions & 0 deletions third_party/allocation_instrumenter/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0
Expand Down
2 changes: 2 additions & 0 deletions third_party/aws-sdk-auth-lite/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_library")

licenses(["notice"]) # Apache-2 license

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions third_party/checker_framework_dataflow/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

package(default_visibility = ["//visibility:public"])

licenses(["restricted"]) # GNU GPL v2 with Classpath exception
Expand Down
2 changes: 2 additions & 0 deletions third_party/checker_framework_javacutil/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

package(default_visibility = ["//visibility:public"])

licenses(["restricted"]) # GNU GPL v2 with Classpath exception
Expand Down
7 changes: 5 additions & 2 deletions third_party/googleapis/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_proto_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])
Expand Down Expand Up @@ -254,6 +256,7 @@ proto_library(
name = "google_api_auth_proto",
srcs = ["google/api/auth.proto"],
deps = [
":google_api_annotations_proto",
"@com_google_protobuf//:descriptor_proto"],
":google_api_annotations_proto",
"@com_google_protobuf//:descriptor_proto",
],
)
2 changes: 2 additions & 0 deletions third_party/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_java//java:defs.bzl", "java_import")

licenses(["notice"]) # Apache v2

package(
Expand Down
4 changes: 3 additions & 1 deletion third_party/grpc/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ You need to load the rules in your BUILD file for use, like:
load("//third_party/grpc:build_defs.bzl", "java_grpc_library")
"""

load("@rules_java//java:defs.bzl", "java_library")

def _path_ignoring_repository(f):
if (len(f.owner.workspace_root) == 0):
return f.short_path
Expand Down Expand Up @@ -102,7 +104,7 @@ def java_grpc_library(name, srcs, deps, enable_deprecated = None, visibility = N
],
**kwargs
)
native.java_library(
java_library(
name = name,
srcs = [gensource_name],
visibility = visibility,
Expand Down
2 changes: 2 additions & 0 deletions third_party/ijar/test/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_test")

package(default_visibility = ["//visibility:__pkg__"])

licenses(["notice"]) # Apache License 2.0
Expand Down
2 changes: 2 additions & 0 deletions third_party/jarjar/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_binary", "java_import")

package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0
Expand Down
2 changes: 2 additions & 0 deletions third_party/java/android_databinding/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_java//java:defs.bzl", "java_import")

licenses(["notice"]) # Apache License 2.0

exports_files(["LICENSE"])
Expand Down
2 changes: 2 additions & 0 deletions third_party/java/aosp_gradle_core/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0
Expand Down
2 changes: 2 additions & 0 deletions third_party/java/apkbuilder/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_binary")

licenses(["notice"]) # Apache 2.0

filegroup(
Expand Down
2 changes: 2 additions & 0 deletions third_party/java/dd_plist/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # MIT
Expand Down
2 changes: 2 additions & 0 deletions third_party/java/jacoco/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# http://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.3/jacoco-0.8.3.zip

load("@rules_java//java:defs.bzl", "java_import")

licenses(["reciprocal"]) # EPL 1.0 (Eclipse Public License)

exports_files(["LICENSE"])
Expand Down
3 changes: 2 additions & 1 deletion third_party/java/javapoet/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

licenses(["notice"]) # Apache License 2.0

exports_files(["LICENSE"])
Expand All @@ -15,4 +17,3 @@ java_import(
name = "javapoet",
jars = ["javapoet-1.8.0.jar"],
)

2 changes: 2 additions & 0 deletions third_party/java/jcommander/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])
Expand Down
2 changes: 2 additions & 0 deletions third_party/java/jdk/langtools/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

package(default_visibility = ["//visibility:public"])

licenses(["restricted"]) # GNU GPL v2 with Classpath exception
Expand Down
2 changes: 2 additions & 0 deletions third_party/jaxb/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_import")

licenses(["reciprocal"]) # CDDL License

package(default_visibility = ["//visibility:public"])
Expand Down
2 changes: 2 additions & 0 deletions third_party/jformatstring/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

licenses(["restricted"]) # GNU GPL v2 with Classpath exception
Expand Down
2 changes: 2 additions & 0 deletions third_party/pprof/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_proto_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0
Expand Down
68 changes: 46 additions & 22 deletions third_party/protobuf/3.6.1/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Bazel (http://bazel.io/) BUILD file for Protobuf.

load("@rules_java//java:defs.bzl", "java_import")

licenses(["notice"])

exports_files(["LICENSE"])
Expand All @@ -21,6 +23,7 @@ config_setting(

load(":protobuf.bzl", "py_proto_library")
load(":compiler_config_setting.bzl", "create_compiler_config_setting")

# Needed for #9006. Hopefully a future upstream version will include this line.
load("@rules_python//python:defs.bzl", "py_library")

Expand Down Expand Up @@ -81,12 +84,12 @@ create_compiler_config_setting(

MSVC_COPTS = [
"/DHAVE_PTHREAD",
"/wd4018", # -Wno-sign-compare
"/wd4514", # -Wno-unused-function
"/wd4018", # -Wno-sign-compare
"/wd4514", # -Wno-unused-function
]

COPTS = select({
":msvc" : MSVC_COPTS,
":msvc": MSVC_COPTS,
"//conditions:default": [
"-DHAVE_PTHREAD",
"-Wall",
Expand All @@ -110,16 +113,19 @@ config_setting(
LINK_OPTS = select({
":android": [],
":msvc": [],
"//conditions:default": ["-lpthread", "-lm"],
"//conditions:default": [
"-lpthread",
"-lm",
],
})

load(
":protobuf.bzl",
"cc_proto_library",
"py_proto_library",
"internal_copied_filegroup",
"internal_gen_well_known_protos_java",
"internal_protobuf_py_tests",
"py_proto_library",
)

cc_library(
Expand Down Expand Up @@ -247,18 +253,33 @@ objc_library(
# Map of all well known protos.
# name => (include path, imports)
WELL_KNOWN_PROTO_MAP = {
"any" : ("src/google/protobuf/any.proto", []),
"api" : ("src/google/protobuf/api.proto", ["source_context", "type"]),
"compiler_plugin" : ("src/google/protobuf/compiler/plugin.proto", ["descriptor"]),
"descriptor" : ("src/google/protobuf/descriptor.proto", []),
"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", []),
"any": ("src/google/protobuf/any.proto", []),
"api": (
"src/google/protobuf/api.proto",
[
"source_context",
"type",
],
),
"compiler_plugin": (
"src/google/protobuf/compiler/plugin.proto",
["descriptor"],
),
"descriptor": ("src/google/protobuf/descriptor.proto", []),
"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", []),
}

WELL_KNOWN_PROTOS = [value[0] for value in WELL_KNOWN_PROTO_MAP.values()]
Expand Down Expand Up @@ -295,9 +316,9 @@ cc_proto_library(
name = proto[0] + "_proto",
srcs = [proto[1][0]],
strip_import_prefix = "src",
deps = [dep + "_proto" for dep in proto[1][1]],
visibility = ["//visibility:public"],
) for proto in WELL_KNOWN_PROTO_MAP.items()]
deps = [dep + "_proto" for dep in proto[1][1]],
) for proto in WELL_KNOWN_PROTO_MAP.items()]

################################################################################
# Protocol Buffers Compiler
Expand Down Expand Up @@ -508,11 +529,14 @@ cc_binary(
cc_test(
name = "win32_test",
srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"],
tags = [
"manual",
"windows",
],
deps = [
":protobuf_lite",
"//external:gtest_main",
],
tags = ["manual", "windows"],
)

cc_test(
Expand Down Expand Up @@ -722,11 +746,11 @@ py_proto_library(
}),
default_runtime = "",
protoc = ":protoc",
py_extra_srcs = glob(["python/**/__init__.py"]),
py_libs = [
":python_srcs",
"//external:six",
],
py_extra_srcs = glob(["python/**/__init__.py"]),
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
Expand Down Expand Up @@ -817,10 +841,10 @@ internal_protobuf_py_tests(

proto_lang_toolchain(
name = "cc_toolchain",
blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
command_line = "--cpp_out=$(OUT)",
runtime = ":protobuf",
visibility = ["//visibility:public"],
blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
)

proto_lang_toolchain(
Expand Down
2 changes: 2 additions & 0 deletions third_party/protobuf/3.6.1/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# the WORKSPACE file in the same directory with this BUILD file for an
# example.

load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")

# For each .proto file, a proto_library target should be defined. This target
# is not bound to any particular language. Instead, it defines the dependency
# graph of the .proto files (i.e., proto imports) and serves as the provider
Expand Down
11 changes: 7 additions & 4 deletions third_party/remoteapis/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_java//java:defs.bzl", "java_proto_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])
Expand All @@ -14,8 +16,8 @@ filegroup(
)

JAVA_LIBRARY_PROTOS = [
"build_bazel_semver_semver",
"build_bazel_remote_execution_v2_remote_execution",
"build_bazel_semver_semver",
"build_bazel_remote_execution_v2_remote_execution",
]

[java_library_srcs(
Expand All @@ -26,8 +28,9 @@ JAVA_LIBRARY_PROTOS = [
# for bootstrapping
filegroup(
name = "dist_jars",
srcs = [":" + proto + "_java_proto_srcs" for proto in JAVA_LIBRARY_PROTOS]
+ [":build_bazel_remote_execution_v2_remote_execution_java_grpc_srcs"],
srcs = [":" + proto + "_java_proto_srcs" for proto in JAVA_LIBRARY_PROTOS] + [
":build_bazel_remote_execution_v2_remote_execution_java_grpc_srcs",
],
visibility = ["@//src:__pkg__"],
)

Expand Down

0 comments on commit a835361

Please sign in to comment.