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