BUILD.bazel 3.7 KB

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