• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    ] + select(
89        {
90            "//conditions:default": [],
91        },
92    ),
93)
94
95### tests
96
97test_suite(
98    name = "all_tests",
99    visibility = ["//visibility:public"],
100)
101
102cc_test(
103    name = "civil_time_test",
104    size = "small",
105    srcs = ["src/civil_time_test.cc"],
106    deps = [
107        ":civil_time",
108        "//absl/base:config",
109        "@com_google_googletest//:gtest_main",
110    ],
111)
112
113cc_test(
114    name = "time_zone_format_test",
115    size = "small",
116    srcs = ["src/time_zone_format_test.cc"],
117    data = [":zoneinfo"],
118    tags = [
119        "no_test_android_arm",
120        "no_test_android_arm64",
121        "no_test_android_x86",
122        "no_test_wasm",
123    ],
124    deps = [
125        ":civil_time",
126        ":time_zone",
127        "//absl/base:config",
128        "@com_google_googletest//:gtest_main",
129    ],
130)
131
132cc_test(
133    name = "time_zone_lookup_test",
134    size = "small",
135    timeout = "moderate",
136    srcs = ["src/time_zone_lookup_test.cc"],
137    data = [":zoneinfo"],
138    tags = [
139        "no_test_android_arm",
140        "no_test_android_arm64",
141        "no_test_android_x86",
142        "no_test_wasm",
143    ],
144    deps = [
145        ":civil_time",
146        ":time_zone",
147        "//absl/base:config",
148        "@com_google_googletest//:gtest_main",
149    ],
150)
151
152### benchmarks
153
154cc_test(
155    name = "cctz_benchmark",
156    srcs = [
157        "src/cctz_benchmark.cc",
158        "src/time_zone_if.h",
159        "src/time_zone_impl.h",
160        "src/time_zone_info.h",
161        "src/tzfile.h",
162    ],
163    linkstatic = 1,
164    tags = ["benchmark"],
165    deps = [
166        ":civil_time",
167        ":time_zone",
168        "//absl/base:config",
169        "@com_github_google_benchmark//:benchmark_main",
170    ],
171)
172
173### examples
174
175### binaries
176