Format with buildifier

This commit is contained in:
Liam Miller-Cushon 2019-07-01 12:21:04 -07:00 committed by Adam Cozzette
parent bedef1ede2
commit 2b857d0078

144
BUILD
View File

@ -27,25 +27,25 @@ ZLIB_DEPS = ["@zlib//:zlib"]
MSVC_COPTS = [ MSVC_COPTS = [
"/DHAVE_PTHREAD", "/DHAVE_PTHREAD",
"/wd4018", # -Wno-sign-compare "/wd4018", # -Wno-sign-compare
"/wd4065", # switch statement contains 'default' but no 'case' labels "/wd4065", # switch statement contains 'default' but no 'case' labels
"/wd4146", # unary minus operator applied to unsigned type, result still unsigned "/wd4146", # unary minus operator applied to unsigned type, result still unsigned
"/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data "/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data
"/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' "/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data
"/wd4305", # 'identifier' : truncation from 'type1' to 'type2' "/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
"/wd4307", # 'operator' : integral constant overflow "/wd4307", # 'operator' : integral constant overflow
"/wd4309", # 'conversion' : truncation of constant value "/wd4309", # 'conversion' : truncation of constant value
"/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
"/wd4355", # 'this' : used in base member initializer list "/wd4355", # 'this' : used in base member initializer list
"/wd4506", # no definition for inline function 'function' "/wd4506", # no definition for inline function 'function'
"/wd4514", # -Wno-unused-function "/wd4514", # -Wno-unused-function
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
"/wd4996", # The compiler encountered a deprecated declaration. "/wd4996", # The compiler encountered a deprecated declaration.
] ]
COPTS = select({ COPTS = select({
":msvc" : MSVC_COPTS, ":msvc": MSVC_COPTS,
"//conditions:default": [ "//conditions:default": [
"-DHAVE_PTHREAD", "-DHAVE_PTHREAD",
"-DHAVE_ZLIB", "-DHAVE_ZLIB",
@ -59,7 +59,10 @@ COPTS = select({
load(":compiler_config_setting.bzl", "create_compiler_config_setting") load(":compiler_config_setting.bzl", "create_compiler_config_setting")
create_compiler_config_setting(name = "msvc", value = "msvc-cl") create_compiler_config_setting(
name = "msvc",
value = "msvc-cl",
)
config_setting( config_setting(
name = "android", name = "android",
@ -91,7 +94,10 @@ LINK_OPTS = select({
# Suppress linker warnings about files with no symbols defined. # Suppress linker warnings about files with no symbols defined.
"-ignore:4221", "-ignore:4221",
], ],
"//conditions:default": ["-lpthread", "-lm"], "//conditions:default": [
"-lpthread",
"-lm",
],
}) })
load( load(
@ -135,7 +141,10 @@ cc_library(
"src/google/protobuf/stubs/time.cc", "src/google/protobuf/stubs/time.cc",
"src/google/protobuf/wire_format_lite.cc", "src/google/protobuf/wire_format_lite.cc",
], ],
hdrs = glob(["src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc"]), hdrs = glob([
"src/google/protobuf/**/*.h",
"src/google/protobuf/**/*.inc",
]),
copts = COPTS, copts = COPTS,
includes = ["src/"], includes = ["src/"],
linkopts = LINK_OPTS, linkopts = LINK_OPTS,
@ -205,7 +214,10 @@ cc_library(
"src/google/protobuf/wire_format.cc", "src/google/protobuf/wire_format.cc",
"src/google/protobuf/wrappers.pb.cc", "src/google/protobuf/wrappers.pb.cc",
], ],
hdrs = glob(["src/**/*.h", "src/**/*.inc"]), hdrs = glob([
"src/**/*.h",
"src/**/*.inc",
]),
copts = COPTS, copts = COPTS,
includes = ["src/"], includes = ["src/"],
linkopts = LINK_OPTS, linkopts = LINK_OPTS,
@ -219,7 +231,10 @@ cc_library(
# TODO(keveman): Remove this target once the support gets added to Bazel. # TODO(keveman): Remove this target once the support gets added to Bazel.
cc_library( cc_library(
name = "protobuf_headers", name = "protobuf_headers",
hdrs = glob(["src/**/*.h", "src/**/*.inc"]), hdrs = glob([
"src/**/*.h",
"src/**/*.inc",
]),
includes = ["src/"], includes = ["src/"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
@ -227,18 +242,33 @@ cc_library(
# Map of all well known protos. # Map of all well known protos.
# name => (include path, imports) # name => (include path, imports)
WELL_KNOWN_PROTO_MAP = { WELL_KNOWN_PROTO_MAP = {
"any" : ("google/protobuf/any.proto", []), "any": ("google/protobuf/any.proto", []),
"api" : ("google/protobuf/api.proto", ["source_context", "type"]), "api": (
"compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]), "google/protobuf/api.proto",
"descriptor" : ("google/protobuf/descriptor.proto", []), [
"duration" : ("google/protobuf/duration.proto", []), "source_context",
"empty" : ("google/protobuf/empty.proto", []), "type",
"field_mask" : ("google/protobuf/field_mask.proto", []), ],
"source_context" : ("google/protobuf/source_context.proto", []), ),
"struct" : ("google/protobuf/struct.proto", []), "compiler_plugin": (
"timestamp" : ("google/protobuf/timestamp.proto", []), "google/protobuf/compiler/plugin.proto",
"type" : ("google/protobuf/type.proto", ["any", "source_context"]), ["descriptor"],
"wrappers" : ("google/protobuf/wrappers.proto", []), ),
"descriptor": ("google/protobuf/descriptor.proto", []),
"duration": ("google/protobuf/duration.proto", []),
"empty": ("google/protobuf/empty.proto", []),
"field_mask": ("google/protobuf/field_mask.proto", []),
"source_context": ("google/protobuf/source_context.proto", []),
"struct": ("google/protobuf/struct.proto", []),
"timestamp": ("google/protobuf/timestamp.proto", []),
"type": (
"google/protobuf/type.proto",
[
"any",
"source_context",
],
),
"wrappers": ("google/protobuf/wrappers.proto", []),
} }
RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()] RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()]
@ -284,9 +314,9 @@ internal_copied_filegroup(
[proto_library( [proto_library(
name = proto[0] + "_proto", name = proto[0] + "_proto",
srcs = [proto[1][0]], srcs = [proto[1][0]],
deps = [dep + "_proto" for dep in proto[1][1]],
visibility = ["//visibility:public"], 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 # Protocol Buffers Compiler
@ -514,11 +544,14 @@ cc_binary(
cc_test( cc_test(
name = "win32_test", name = "win32_test",
srcs = ["src/google/protobuf/io/io_win32_unittest.cc"], srcs = ["src/google/protobuf/io/io_win32_unittest.cc"],
tags = [
"manual",
"windows",
],
deps = [ deps = [
":protobuf_lite", ":protobuf_lite",
"//external:gtest_main", "//external:gtest_main",
], ],
tags = ["manual", "windows"],
) )
cc_test( cc_test(
@ -598,11 +631,11 @@ cc_test(
"src/google/protobuf/well_known_types_unittest.cc", "src/google/protobuf/well_known_types_unittest.cc",
"src/google/protobuf/wire_format_unittest.cc", "src/google/protobuf/wire_format_unittest.cc",
] + select({ ] + select({
"//conditions:default" : [ "//conditions:default": [
# Doesn't pass on Windows with MSVC # Doesn't pass on Windows with MSVC
"src/google/protobuf/compiler/command_line_interface_unittest.cc", "src/google/protobuf/compiler/command_line_interface_unittest.cc",
], ],
":msvc": [] ":msvc": [],
}), }),
copts = COPTS, copts = COPTS,
data = [ data = [
@ -640,8 +673,11 @@ java_library(
":gen_well_known_protos_java", ":gen_well_known_protos_java",
], ],
javacopts = select({ javacopts = select({
"//:jdk9": ["--add-modules=jdk.unsupported"], "//:jdk9": ["--add-modules=jdk.unsupported"],
"//conditions:default": ["-source 7", "-target 7"], "//conditions:default": [
"-source 7",
"-target 7",
],
}), }),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
@ -752,7 +788,10 @@ java_library(
srcs = glob([ srcs = glob([
"java/util/src/main/java/com/google/protobuf/util/*.java", "java/util/src/main/java/com/google/protobuf/util/*.java",
]), ]),
javacopts = ["-source 7", "-target 7"], javacopts = [
"-source 7",
"-target 7",
],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"protobuf_java", "protobuf_java",
@ -869,11 +908,11 @@ py_proto_library(
}), }),
default_runtime = "", default_runtime = "",
protoc = ":protoc", protoc = ":protoc",
py_extra_srcs = glob(["python/**/__init__.py"]),
py_libs = [ py_libs = [
":python_srcs", ":python_srcs",
"//external:six", "//external:six",
], ],
py_extra_srcs = glob(["python/**/__init__.py"]),
srcs_version = "PY2AND3", srcs_version = "PY2AND3",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
@ -965,18 +1004,18 @@ internal_protobuf_py_tests(
cc_library( cc_library(
name = "proto_api", name = "proto_api",
hdrs = ["python/google/protobuf/proto_api.h"], hdrs = ["python/google/protobuf/proto_api.h"],
visibility = ["//visibility:public"],
deps = [ deps = [
"//external:python_headers", "//external:python_headers",
], ],
visibility = ["//visibility:public"],
) )
proto_lang_toolchain( proto_lang_toolchain(
name = "cc_toolchain", name = "cc_toolchain",
blacklisted_protos = [":_internal_wkt_protos_genrule"],
command_line = "--cpp_out=$(OUT)", command_line = "--cpp_out=$(OUT)",
runtime = ":protobuf", runtime = ":protobuf",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
blacklisted_protos = [":_internal_wkt_protos_genrule"],
) )
proto_lang_toolchain( proto_lang_toolchain(
@ -1079,22 +1118,22 @@ genrule(
name = "generated_protos", name = "generated_protos",
srcs = ["src/google/protobuf/unittest_import.proto"], srcs = ["src/google/protobuf/unittest_import.proto"],
outs = ["unittest_gen.proto"], outs = ["unittest_gen.proto"],
cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)" cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)",
) )
proto_library( proto_library(
name = "generated_protos_proto", name = "generated_protos_proto",
srcs = [ srcs = [
"unittest_gen.proto",
"src/google/protobuf/unittest_import_public.proto", "src/google/protobuf/unittest_import_public.proto",
"unittest_gen.proto",
], ],
) )
py_proto_library( py_proto_library(
name = "generated_protos_py", name = "generated_protos_py",
srcs = [ srcs = [
"unittest_gen.proto",
"src/google/protobuf/unittest_import_public.proto", "src/google/protobuf/unittest_import_public.proto",
"unittest_gen.proto",
], ],
default_runtime = "", default_runtime = "",
protoc = ":protoc", protoc = ":protoc",
@ -1113,6 +1152,7 @@ proto_library(
proto_library( proto_library(
name = "test_messages_proto3_proto", name = "test_messages_proto3_proto",
srcs = ["src/google/protobuf/test_messages_proto3.proto"], srcs = ["src/google/protobuf/test_messages_proto3.proto"],
visibility = ["//visibility:public"],
deps = [ deps = [
":any_proto", ":any_proto",
":duration_proto", ":duration_proto",
@ -1121,7 +1161,6 @@ proto_library(
":timestamp_proto", ":timestamp_proto",
":wrappers_proto", ":wrappers_proto",
], ],
visibility = ["//visibility:public"],
) )
cc_proto_library( cc_proto_library(
@ -1150,8 +1189,8 @@ cc_proto_library(
cc_library( cc_library(
name = "jsoncpp", name = "jsoncpp",
hdrs = ["conformance/third_party/jsoncpp/json.h"],
srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"], srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"],
hdrs = ["conformance/third_party/jsoncpp/json.h"],
includes = ["conformance"], includes = ["conformance"],
) )
@ -1164,8 +1203,11 @@ cc_library(
hdrs = [ hdrs = [
"conformance/conformance_test.h", "conformance/conformance_test.h",
], ],
includes = [
"conformance",
"src",
],
deps = [":conformance_proto_cc"], deps = [":conformance_proto_cc"],
includes = ["conformance", "src"],
) )
cc_library( cc_library(
@ -1194,10 +1236,10 @@ cc_library(
cc_binary( cc_binary(
name = "conformance_test_runner", name = "conformance_test_runner",
srcs = ["conformance/conformance_test_main.cc"], srcs = ["conformance/conformance_test_main.cc"],
visibility = ["//visibility:public"],
deps = [ deps = [
":binary_json_conformance_suite", ":binary_json_conformance_suite",
":conformance_test", ":conformance_test",
":text_format_conformance_suite", ":text_format_conformance_suite",
], ],
visibility = ["//visibility:public"],
) )