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
19### libraries
20
21cc_library(
22    name = "civil_time",
23    srcs = ["src/civil_time_detail.cc"],
24    hdrs = [
25        "include/cctz/civil_time.h",
26    ],
27    textual_hdrs = ["include/cctz/civil_time_detail.h"],
28    visibility = ["//visibility:public"],
29    deps = ["//absl/base:config"],
30)
31
32cc_library(
33    name = "time_zone",
34    srcs = [
35        "src/time_zone_fixed.cc",
36        "src/time_zone_fixed.h",
37        "src/time_zone_format.cc",
38        "src/time_zone_if.cc",
39        "src/time_zone_if.h",
40        "src/time_zone_impl.cc",
41        "src/time_zone_impl.h",
42        "src/time_zone_info.cc",
43        "src/time_zone_info.h",
44        "src/time_zone_libc.cc",
45        "src/time_zone_libc.h",
46        "src/time_zone_lookup.cc",
47        "src/time_zone_posix.cc",
48        "src/time_zone_posix.h",
49        "src/tzfile.h",
50        "src/zone_info_source.cc",
51    ],
52    hdrs = [
53        "include/cctz/time_zone.h",
54        "include/cctz/zone_info_source.h",
55    ],
56    # OS X and iOS no longer use `linkopts = ["-framework CoreFoundation"]`
57    # as (1) bazel adds it automatically, and (2) it caused problems when
58    # cross-compiling for Android.
59    # See https://github.com/abseil/abseil-cpp/issues/326 for details.
60    visibility = ["//visibility:public"],
61    deps = [
62        ":civil_time",
63        "//absl/base:config",
64    ] + select(
65        {
66            "//conditions:default": [],
67        },
68    ),
69)
70
71### tests
72
73test_suite(
74    name = "all_tests",
75    visibility = ["//visibility:public"],
76)
77
78cc_test(
79    name = "civil_time_test",
80    size = "small",
81    srcs = ["src/civil_time_test.cc"],
82    deps = [
83        ":civil_time",
84        "//absl/base:config",
85        "@com_google_googletest//:gtest_main",
86    ],
87)
88
89cc_test(
90    name = "time_zone_format_test",
91    size = "small",
92    srcs = ["src/time_zone_format_test.cc"],
93    data = [":zoneinfo"],
94    env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"},
95    tags = [
96        "no_test_android_arm",
97        "no_test_android_arm64",
98        "no_test_android_x86",
99        "no_test_wasm",
100    ],
101    deps = [
102        ":civil_time",
103        ":time_zone",
104        "//absl/base:config",
105        "@com_google_googletest//:gtest_main",
106    ],
107)
108
109cc_test(
110    name = "time_zone_lookup_test",
111    size = "small",
112    timeout = "moderate",
113    srcs = ["src/time_zone_lookup_test.cc"],
114    data = [":zoneinfo"],
115    env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"},
116    tags = [
117        "no_test_android_arm",
118        "no_test_android_arm64",
119        "no_test_android_x86",
120        "no_test_wasm",
121    ],
122    deps = [
123        ":civil_time",
124        ":time_zone",
125        "//absl/base:config",
126        "@com_google_googletest//:gtest_main",
127    ],
128)
129
130### benchmarks
131
132cc_test(
133    name = "cctz_benchmark",
134    srcs = [
135        "src/cctz_benchmark.cc",
136        "src/time_zone_if.h",
137        "src/time_zone_impl.h",
138        "src/time_zone_info.h",
139        "src/tzfile.h",
140    ],
141    linkstatic = 1,
142    tags = ["benchmark"],
143    deps = [
144        ":civil_time",
145        ":time_zone",
146        "//absl/base:config",
147        "@com_github_google_benchmark//:benchmark_main",
148    ],
149)
150
151filegroup(
152    name = "zoneinfo",
153    srcs = glob(["testdata/zoneinfo/**"]),
154    visibility = ["//absl/time:__subpackages__"],
155)
156
157### examples
158
159### binaries
160