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 15package(features = ["-parse_headers"]) 16 17licenses(["notice"]) 18 19filegroup( 20 name = "zoneinfo", 21 srcs = glob(["testdata/zoneinfo/**"]), 22) 23 24config_setting( 25 name = "osx", 26 constraint_values = [ 27 "@platforms//os:osx", 28 ], 29) 30 31config_setting( 32 name = "ios", 33 constraint_values = [ 34 "@platforms//os:ios", 35 ], 36) 37 38### libraries 39 40cc_library( 41 name = "civil_time", 42 srcs = ["src/civil_time_detail.cc"], 43 hdrs = [ 44 "include/cctz/civil_time.h", 45 ], 46 textual_hdrs = ["include/cctz/civil_time_detail.h"], 47 visibility = ["//visibility:public"], 48 deps = ["//absl/base:config"], 49) 50 51cc_library( 52 name = "time_zone", 53 srcs = [ 54 "src/time_zone_fixed.cc", 55 "src/time_zone_fixed.h", 56 "src/time_zone_format.cc", 57 "src/time_zone_if.cc", 58 "src/time_zone_if.h", 59 "src/time_zone_impl.cc", 60 "src/time_zone_impl.h", 61 "src/time_zone_info.cc", 62 "src/time_zone_info.h", 63 "src/time_zone_libc.cc", 64 "src/time_zone_libc.h", 65 "src/time_zone_lookup.cc", 66 "src/time_zone_posix.cc", 67 "src/time_zone_posix.h", 68 "src/tzfile.h", 69 "src/zone_info_source.cc", 70 ], 71 hdrs = [ 72 "include/cctz/time_zone.h", 73 "include/cctz/zone_info_source.h", 74 ], 75 linkopts = select({ 76 ":osx": [ 77 "-framework Foundation", 78 ], 79 ":ios": [ 80 "-framework Foundation", 81 ], 82 "//conditions:default": [], 83 }), 84 visibility = ["//visibility:public"], 85 deps = [ 86 ":civil_time", 87 "//absl/base:config", 88 ], 89) 90 91### tests 92 93test_suite( 94 name = "all_tests", 95 visibility = ["//visibility:public"], 96) 97 98cc_test( 99 name = "civil_time_test", 100 size = "small", 101 srcs = ["src/civil_time_test.cc"], 102 deps = [ 103 ":civil_time", 104 "//absl/base:config", 105 "@com_google_googletest//:gtest_main", 106 ], 107) 108 109cc_test( 110 name = "time_zone_format_test", 111 size = "small", 112 srcs = ["src/time_zone_format_test.cc"], 113 data = [":zoneinfo"], 114 tags = [ 115 "no_test_android_arm", 116 "no_test_android_arm64", 117 "no_test_android_x86", 118 ], 119 deps = [ 120 ":civil_time", 121 ":time_zone", 122 "//absl/base:config", 123 "@com_google_googletest//:gtest_main", 124 ], 125) 126 127cc_test( 128 name = "time_zone_lookup_test", 129 size = "small", 130 timeout = "moderate", 131 srcs = ["src/time_zone_lookup_test.cc"], 132 data = [":zoneinfo"], 133 tags = [ 134 "no_test_android_arm", 135 "no_test_android_arm64", 136 "no_test_android_x86", 137 ], 138 deps = [ 139 ":civil_time", 140 ":time_zone", 141 "//absl/base:config", 142 "@com_google_googletest//:gtest_main", 143 ], 144) 145 146### benchmarks 147 148cc_test( 149 name = "cctz_benchmark", 150 srcs = [ 151 "src/cctz_benchmark.cc", 152 "src/time_zone_if.h", 153 "src/time_zone_impl.h", 154 "src/time_zone_info.h", 155 "src/tzfile.h", 156 ], 157 linkstatic = 1, 158 tags = ["benchmark"], 159 deps = [ 160 ":civil_time", 161 ":time_zone", 162 "//absl/base:config", 163 "@com_github_google_benchmark//:benchmark_main", 164 ], 165) 166 167### examples 168 169### binaries 170