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