• 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
15load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
16
17package(features = ["-parse_headers"])
18
19licenses(["notice"])
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
95test_suite(
96    name = "all_tests",
97    visibility = ["//visibility:public"],
98)
99
100cc_test(
101    name = "civil_time_test",
102    size = "small",
103    srcs = ["src/civil_time_test.cc"],
104    deps = [
105        ":civil_time",
106        "//absl/base:config",
107        "@com_google_googletest//:gtest_main",
108    ],
109)
110
111cc_test(
112    name = "time_zone_format_test",
113    size = "small",
114    srcs = ["src/time_zone_format_test.cc"],
115    data = [":zoneinfo"],
116    tags = [
117        "no_test_android_arm",
118        "no_test_android_arm64",
119        "no_test_android_x86",
120    ],
121    deps = [
122        ":civil_time",
123        ":time_zone",
124        "//absl/base:config",
125        "@com_google_googletest//:gtest_main",
126    ],
127)
128
129cc_test(
130    name = "time_zone_lookup_test",
131    size = "small",
132    timeout = "moderate",
133    srcs = ["src/time_zone_lookup_test.cc"],
134    data = [":zoneinfo"],
135    tags = [
136        "no_test_android_arm",
137        "no_test_android_arm64",
138        "no_test_android_x86",
139    ],
140    deps = [
141        ":civil_time",
142        ":time_zone",
143        "//absl/base:config",
144        "@com_google_googletest//:gtest_main",
145    ],
146)
147
148### benchmarks
149
150cc_test(
151    name = "cctz_benchmark",
152    srcs = [
153        "src/cctz_benchmark.cc",
154        "src/time_zone_if.h",
155        "src/time_zone_impl.h",
156        "src/time_zone_info.h",
157        "src/tzfile.h",
158    ],
159    linkstatic = 1,
160    tags = ["benchmark"],
161    deps = [
162        ":civil_time",
163        ":time_zone",
164        "//absl/base:config",
165        "@com_github_google_benchmark//:benchmark_main",
166    ],
167)
168
169### examples
170
171### binaries
172