2020-01-17 21:05:03 +08:00
|
|
|
# Copyright 2019 Google LLC
|
2019-03-19 00:21:48 +08:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
package(default_visibility = ["//sandboxed_api:__subpackages__"])
|
|
|
|
|
2019-09-25 22:13:33 +08:00
|
|
|
licenses(["notice"])
|
2019-03-19 00:21:48 +08:00
|
|
|
|
|
|
|
load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library")
|
2019-05-09 20:21:11 +08:00
|
|
|
load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
|
2019-03-19 00:21:48 +08:00
|
|
|
|
|
|
|
sapi_proto_library(
|
|
|
|
name = "status_proto",
|
|
|
|
srcs = ["status.proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
# A custom fork of util/task/status.h. This will become obsolete and will be
|
|
|
|
# replaced once Abseil releases absl::Status.
|
|
|
|
cc_library(
|
|
|
|
name = "status",
|
2020-02-20 20:26:01 +08:00
|
|
|
srcs = ["status.cc"],
|
2019-03-19 00:21:48 +08:00
|
|
|
hdrs = [
|
|
|
|
"status.h",
|
|
|
|
"status_internal.h",
|
|
|
|
"status_macros.h",
|
|
|
|
],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-07-02 18:20:02 +08:00
|
|
|
visibility = ["//visibility:public"],
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
2019-09-25 22:13:33 +08:00
|
|
|
":status_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/meta:type_traits",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "statusor",
|
|
|
|
hdrs = ["statusor.h"],
|
2019-11-25 23:02:59 +08:00
|
|
|
copts = sapi_platform_copts([
|
|
|
|
# Disable ABI warning about passing long double unions
|
|
|
|
"-Wno-psabi",
|
|
|
|
]),
|
2019-07-02 18:20:02 +08:00
|
|
|
visibility = ["//visibility:public"],
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":raw_logging",
|
|
|
|
":status",
|
|
|
|
"@com_google_absl//absl/base",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2019-07-23 15:31:28 +08:00
|
|
|
"@com_google_absl//absl/base:log_severity",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/types:variant",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# gMock matchers for sapi::Status and sapi::StatusOr<T> and a gUnit printer
|
|
|
|
# extension for sapi::StatusOr<T>.
|
|
|
|
cc_library(
|
|
|
|
name = "status_matchers",
|
|
|
|
testonly = 1,
|
|
|
|
hdrs = ["status_matchers.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-07-02 18:20:02 +08:00
|
|
|
visibility = ["//visibility:public"],
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":status",
|
|
|
|
":statusor",
|
|
|
|
"@com_google_absl//absl/types:optional",
|
|
|
|
"@com_google_googletest//:gtest",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Tests for the Status utility.
|
|
|
|
cc_test(
|
|
|
|
name = "status_test",
|
|
|
|
srcs = ["status_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
2019-04-26 21:21:11 +08:00
|
|
|
":status",
|
2019-03-19 00:21:48 +08:00
|
|
|
":status_matchers",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Tests for the StatusOr template class.
|
|
|
|
cc_test(
|
|
|
|
name = "statusor_test",
|
|
|
|
srcs = ["statusor_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":status",
|
|
|
|
":status_matchers",
|
|
|
|
":statusor",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Tests for the Status macros.
|
|
|
|
cc_test(
|
|
|
|
name = "status_macros_test",
|
|
|
|
srcs = ["status_macros_test.cc"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
":status",
|
|
|
|
":status_matchers",
|
|
|
|
":statusor",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_googletest//:gtest_main",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-06-05 15:25:50 +08:00
|
|
|
# Compatibility layer for Abseil's flags vs. gFlags
|
|
|
|
cc_library(
|
|
|
|
name = "flags",
|
|
|
|
hdrs = ["flag.h"],
|
|
|
|
copts = sapi_platform_copts(),
|
|
|
|
deps = ["@com_github_gflags_gflags//:gflags"],
|
|
|
|
)
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
# Small support library emulating verbose logging using Abseil's raw logging
|
|
|
|
# facility.
|
|
|
|
cc_library(
|
|
|
|
name = "raw_logging",
|
|
|
|
srcs = ["raw_logging.cc"],
|
|
|
|
hdrs = ["raw_logging.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
|
|
|
"//sandboxed_api/sandbox2/util:strerror",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
],
|
|
|
|
)
|