BUILD.bazel 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #
  2. # Copyright 2017 The Abseil Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # https://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. load(
  17. "//absl:copts/configure_copts.bzl",
  18. "ABSL_DEFAULT_COPTS",
  19. "ABSL_DEFAULT_LINKOPTS",
  20. "ABSL_TEST_COPTS",
  21. )
  22. package(
  23. default_visibility = ["//visibility:public"],
  24. features = [
  25. "header_modules",
  26. "layering_check",
  27. "parse_headers",
  28. ],
  29. )
  30. licenses(["notice"])
  31. cc_library(
  32. name = "time",
  33. srcs = [
  34. "civil_time.cc",
  35. "clock.cc",
  36. "duration.cc",
  37. "format.cc",
  38. "internal/get_current_time_chrono.inc",
  39. "internal/get_current_time_posix.inc",
  40. "time.cc",
  41. ],
  42. hdrs = [
  43. "civil_time.h",
  44. "clock.h",
  45. "time.h",
  46. ],
  47. copts = ABSL_DEFAULT_COPTS,
  48. linkopts = ABSL_DEFAULT_LINKOPTS,
  49. deps = [
  50. "//absl/base",
  51. "//absl/base:config",
  52. "//absl/base:core_headers",
  53. "//absl/base:raw_logging_internal",
  54. "//absl/numeric:int128",
  55. "//absl/strings",
  56. "//absl/time/internal/cctz:civil_time",
  57. "//absl/time/internal/cctz:time_zone",
  58. "//absl/types:optional",
  59. ],
  60. )
  61. cc_library(
  62. name = "test_util",
  63. testonly = True,
  64. srcs = ["internal/test_util.cc"],
  65. hdrs = ["internal/test_util.h"],
  66. copts = ABSL_DEFAULT_COPTS,
  67. linkopts = ABSL_DEFAULT_LINKOPTS,
  68. visibility = ["//visibility:private"],
  69. deps = [
  70. ":time",
  71. "//absl/base:config",
  72. "//absl/base:raw_logging_internal",
  73. ],
  74. )
  75. cc_test(
  76. name = "time_test",
  77. srcs = [
  78. "civil_time_test.cc",
  79. "clock_test.cc",
  80. "duration_test.cc",
  81. "format_test.cc",
  82. "time_test.cc",
  83. "time_zone_test.cc",
  84. ],
  85. copts = ABSL_TEST_COPTS,
  86. data = ["//absl/time/internal/cctz:zoneinfo"],
  87. env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"},
  88. linkopts = ABSL_DEFAULT_LINKOPTS,
  89. deps = [
  90. ":test_util",
  91. ":time",
  92. "//absl/base:config",
  93. "//absl/base:core_headers",
  94. "//absl/numeric:int128",
  95. "//absl/strings:str_format",
  96. "//absl/time/internal/cctz:time_zone",
  97. "@com_google_googletest//:gtest",
  98. "@com_google_googletest//:gtest_main",
  99. ],
  100. )
  101. cc_test(
  102. name = "flag_test",
  103. srcs = [
  104. "flag_test.cc",
  105. ],
  106. copts = ABSL_TEST_COPTS,
  107. linkopts = ABSL_DEFAULT_LINKOPTS,
  108. tags = [
  109. "no_test_android_arm",
  110. "no_test_android_arm64",
  111. "no_test_android_x86",
  112. "no_test_ios_x86_64",
  113. "no_test_lexan",
  114. "no_test_loonix",
  115. "no_test_wasm",
  116. ],
  117. deps = [
  118. ":time",
  119. "//absl/flags:flag",
  120. "//absl/flags:reflection",
  121. "@com_google_googletest//:gtest",
  122. "@com_google_googletest//:gtest_main",
  123. ],
  124. )
  125. cc_test(
  126. name = "time_benchmark",
  127. srcs = [
  128. "civil_time_benchmark.cc",
  129. "clock_benchmark.cc",
  130. "duration_benchmark.cc",
  131. "format_benchmark.cc",
  132. "time_benchmark.cc",
  133. ],
  134. copts = ABSL_TEST_COPTS,
  135. data = ["//absl/time/internal/cctz:zoneinfo"],
  136. env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"},
  137. linkopts = ABSL_DEFAULT_LINKOPTS,
  138. tags = [
  139. "benchmark",
  140. ],
  141. deps = [
  142. ":test_util",
  143. ":time",
  144. "//absl/base",
  145. "//absl/base:core_headers",
  146. "//absl/flags:flag",
  147. "//absl/hash",
  148. "@com_github_google_benchmark//:benchmark_main",
  149. ],
  150. )