BUILD.bazel 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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(default_visibility = ["//visibility:public"])
  23. licenses(["notice"])
  24. cc_library(
  25. name = "time",
  26. srcs = [
  27. "civil_time.cc",
  28. "clock.cc",
  29. "duration.cc",
  30. "format.cc",
  31. "internal/get_current_time_chrono.inc",
  32. "internal/get_current_time_posix.inc",
  33. "time.cc",
  34. ],
  35. hdrs = [
  36. "civil_time.h",
  37. "clock.h",
  38. "time.h",
  39. ],
  40. copts = ABSL_DEFAULT_COPTS,
  41. linkopts = ABSL_DEFAULT_LINKOPTS,
  42. deps = [
  43. "//absl/base",
  44. "//absl/base:core_headers",
  45. "//absl/base:raw_logging_internal",
  46. "//absl/numeric:int128",
  47. "//absl/strings",
  48. "//absl/time/internal/cctz:civil_time",
  49. "//absl/time/internal/cctz:time_zone",
  50. ],
  51. )
  52. cc_library(
  53. name = "test_util",
  54. testonly = 1,
  55. srcs = [
  56. "internal/test_util.cc",
  57. "internal/zoneinfo.inc",
  58. ],
  59. hdrs = ["internal/test_util.h"],
  60. copts = ABSL_DEFAULT_COPTS,
  61. linkopts = ABSL_DEFAULT_LINKOPTS,
  62. visibility = [
  63. "//absl/time:__pkg__",
  64. ],
  65. deps = [
  66. ":time",
  67. "//absl/base:config",
  68. "//absl/base:raw_logging_internal",
  69. "//absl/time/internal/cctz:time_zone",
  70. "@com_google_googletest//:gtest",
  71. ],
  72. )
  73. cc_test(
  74. name = "time_test",
  75. srcs = [
  76. "civil_time_test.cc",
  77. "clock_test.cc",
  78. "duration_test.cc",
  79. "format_test.cc",
  80. "time_test.cc",
  81. "time_zone_test.cc",
  82. ],
  83. copts = ABSL_TEST_COPTS,
  84. linkopts = ABSL_DEFAULT_LINKOPTS,
  85. deps = [
  86. ":test_util",
  87. ":time",
  88. "//absl/base:config",
  89. "//absl/base:core_headers",
  90. "//absl/numeric:int128",
  91. "//absl/time/internal/cctz:time_zone",
  92. "@com_google_googletest//:gtest_main",
  93. ],
  94. )
  95. cc_test(
  96. name = "time_benchmark",
  97. srcs = [
  98. "civil_time_benchmark.cc",
  99. "clock_benchmark.cc",
  100. "duration_benchmark.cc",
  101. "format_benchmark.cc",
  102. "time_benchmark.cc",
  103. ],
  104. copts = ABSL_TEST_COPTS,
  105. linkopts = ABSL_DEFAULT_LINKOPTS,
  106. tags = [
  107. "benchmark",
  108. ],
  109. deps = [
  110. ":test_util",
  111. ":time",
  112. "//absl/base",
  113. "//absl/base:core_headers",
  114. "//absl/flags:flag",
  115. "//absl/hash",
  116. "@com_github_google_benchmark//:benchmark_main",
  117. ],
  118. )