1# 2# Copyright 2017 The Abseil Authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# https://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17load( 18 "//absl:copts/configure_copts.bzl", 19 "ABSL_DEFAULT_COPTS", 20 "ABSL_DEFAULT_LINKOPTS", 21 "ABSL_TEST_COPTS", 22) 23 24package(default_visibility = ["//visibility:public"]) 25 26licenses(["notice"]) 27 28cc_library( 29 name = "time", 30 srcs = [ 31 "civil_time.cc", 32 "clock.cc", 33 "duration.cc", 34 "format.cc", 35 "internal/get_current_time_chrono.inc", 36 "internal/get_current_time_posix.inc", 37 "time.cc", 38 ], 39 hdrs = [ 40 "civil_time.h", 41 "clock.h", 42 "time.h", 43 ], 44 copts = ABSL_DEFAULT_COPTS, 45 linkopts = ABSL_DEFAULT_LINKOPTS, 46 deps = [ 47 "//absl/base", 48 "//absl/base:config", 49 "//absl/base:core_headers", 50 "//absl/base:raw_logging_internal", 51 "//absl/numeric:int128", 52 "//absl/strings", 53 "//absl/time/internal/cctz:civil_time", 54 "//absl/time/internal/cctz:time_zone", 55 "//absl/types:optional", 56 ], 57) 58 59cc_library( 60 name = "test_util", 61 testonly = 1, 62 srcs = [ 63 "internal/test_util.cc", 64 "internal/zoneinfo.inc", 65 ], 66 hdrs = ["internal/test_util.h"], 67 copts = ABSL_DEFAULT_COPTS, 68 linkopts = ABSL_DEFAULT_LINKOPTS, 69 visibility = ["//visibility:private"], 70 deps = [ 71 ":time", 72 "//absl/base:config", 73 "//absl/base:raw_logging_internal", 74 "//absl/time/internal/cctz:time_zone", 75 "@com_google_googletest//:gtest", 76 ], 77) 78 79cc_test( 80 name = "time_test", 81 srcs = [ 82 "civil_time_test.cc", 83 "clock_test.cc", 84 "duration_test.cc", 85 "format_test.cc", 86 "time_test.cc", 87 "time_zone_test.cc", 88 ], 89 copts = ABSL_TEST_COPTS, 90 linkopts = ABSL_DEFAULT_LINKOPTS, 91 deps = [ 92 ":test_util", 93 ":time", 94 "//absl/base:config", 95 "//absl/base:core_headers", 96 "//absl/numeric:int128", 97 "//absl/time/internal/cctz:time_zone", 98 "@com_google_googletest//:gtest_main", 99 ], 100) 101 102cc_test( 103 name = "flag_test", 104 srcs = [ 105 "flag_test.cc", 106 ], 107 copts = ABSL_TEST_COPTS, 108 linkopts = ABSL_DEFAULT_LINKOPTS, 109 tags = [ 110 "no_test_android_arm", 111 "no_test_android_arm64", 112 "no_test_android_x86", 113 "no_test_ios_x86_64", 114 "no_test_loonix", 115 "no_test_msvc_x64", 116 "no_test_wasm", 117 ], 118 deps = [ 119 ":time", 120 "//absl/flags:flag", 121 "//absl/flags:reflection", 122 "@com_google_googletest//:gtest_main", 123 ], 124) 125 126cc_test( 127 name = "time_benchmark", 128 srcs = [ 129 "civil_time_benchmark.cc", 130 "clock_benchmark.cc", 131 "duration_benchmark.cc", 132 "format_benchmark.cc", 133 "time_benchmark.cc", 134 ], 135 copts = ABSL_TEST_COPTS, 136 linkopts = ABSL_DEFAULT_LINKOPTS, 137 tags = [ 138 "benchmark", 139 ], 140 deps = [ 141 ":test_util", 142 ":time", 143 "//absl/base", 144 "//absl/base:core_headers", 145 "//absl/flags:flag", 146 "//absl/hash", 147 "@com_github_google_benchmark//:benchmark_main", 148 ], 149) 150