BUILD.bazel (4385B)
1 # Copyright 2016 Google Inc. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # https://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 load("//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", "ABSL_DEFAULT_LINKOPTS", "ABSL_TEST_COPTS") 16 17 package(features = [ 18 "header_modules", 19 "layering_check", 20 "parse_headers", 21 ]) 22 23 licenses(["notice"]) 24 25 ### libraries 26 27 cc_library( 28 name = "civil_time", 29 srcs = ["src/civil_time_detail.cc"], 30 hdrs = [ 31 "include/cctz/civil_time.h", 32 ], 33 copts = ABSL_DEFAULT_COPTS, 34 linkopts = ABSL_DEFAULT_LINKOPTS, 35 textual_hdrs = ["include/cctz/civil_time_detail.h"], 36 visibility = ["//visibility:public"], 37 deps = ["//absl/base:config"], 38 ) 39 40 cc_library( 41 name = "time_zone", 42 srcs = [ 43 "src/time_zone_fixed.cc", 44 "src/time_zone_fixed.h", 45 "src/time_zone_format.cc", 46 "src/time_zone_if.cc", 47 "src/time_zone_if.h", 48 "src/time_zone_impl.cc", 49 "src/time_zone_impl.h", 50 "src/time_zone_info.cc", 51 "src/time_zone_info.h", 52 "src/time_zone_libc.cc", 53 "src/time_zone_libc.h", 54 "src/time_zone_lookup.cc", 55 "src/time_zone_posix.cc", 56 "src/time_zone_posix.h", 57 "src/tzfile.h", 58 "src/zone_info_source.cc", 59 ], 60 hdrs = [ 61 "include/cctz/time_zone.h", 62 "include/cctz/zone_info_source.h", 63 ], 64 copts = ABSL_DEFAULT_COPTS, 65 linkopts = ABSL_DEFAULT_LINKOPTS + select({ 66 "@platforms//os:osx": ["-Wl,-framework,CoreFoundation"], 67 "@platforms//os:ios": ["-Wl,-framework,CoreFoundation"], 68 "//conditions:default": [], 69 }), 70 visibility = ["//visibility:public"], 71 deps = [ 72 ":civil_time", 73 "//absl/base:config", 74 ] + select( 75 { 76 "//conditions:default": [], 77 }, 78 ), 79 ) 80 81 ### tests 82 83 test_suite( 84 name = "all_tests", 85 visibility = ["//visibility:public"], 86 ) 87 88 cc_test( 89 name = "civil_time_test", 90 size = "small", 91 srcs = ["src/civil_time_test.cc"], 92 copts = ABSL_TEST_COPTS, 93 linkopts = ABSL_DEFAULT_LINKOPTS, 94 deps = [ 95 ":civil_time", 96 "//absl/base:config", 97 "@googletest//:gtest", 98 "@googletest//:gtest_main", 99 ], 100 ) 101 102 cc_test( 103 name = "time_zone_format_test", 104 size = "small", 105 srcs = ["src/time_zone_format_test.cc"], 106 copts = ABSL_TEST_COPTS, 107 data = [":zoneinfo"], 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_wasm", 114 ], 115 deps = [ 116 ":civil_time", 117 ":time_zone", 118 "//absl/base:config", 119 "@googletest//:gtest", 120 "@googletest//:gtest_main", 121 ], 122 ) 123 124 cc_test( 125 name = "time_zone_lookup_test", 126 size = "small", 127 timeout = "moderate", 128 srcs = ["src/time_zone_lookup_test.cc"], 129 copts = ABSL_TEST_COPTS, 130 data = [":zoneinfo"], 131 linkopts = ABSL_DEFAULT_LINKOPTS, 132 tags = [ 133 "no_test_android_arm", 134 "no_test_android_arm64", 135 "no_test_android_x86", 136 "no_test_wasm", 137 ], 138 deps = [ 139 ":civil_time", 140 ":time_zone", 141 "//absl/base:config", 142 "@googletest//:gtest", 143 "@googletest//:gtest_main", 144 ], 145 ) 146 147 ### benchmarks 148 149 cc_test( 150 name = "cctz_benchmark", 151 srcs = [ 152 "src/cctz_benchmark.cc", 153 "src/time_zone_if.h", 154 "src/time_zone_impl.h", 155 "src/time_zone_info.h", 156 "src/tzfile.h", 157 ], 158 copts = ABSL_TEST_COPTS, 159 linkopts = ABSL_DEFAULT_LINKOPTS, 160 linkstatic = 1, 161 tags = ["benchmark"], 162 deps = [ 163 ":civil_time", 164 ":time_zone", 165 "//absl/base:config", 166 "@google_benchmark//:benchmark_main", 167 ], 168 ) 169 170 ### examples 171 172 ### binaries 173 174 filegroup( 175 name = "zoneinfo", 176 srcs = glob(["testdata/zoneinfo/**"]), 177 visibility = ["//absl/time:__subpackages__"], 178 )