Extend absl bazel->gn converter to cctz Bug: 524565513 Change-Id: I9f49d6a86efaad90b028db06fe33db45deefaf57 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8159646 Commit-Queue: Danil Chapovalov <danilchap@chromium.org> Reviewed-by: Mirko Bonadei <mbonadei@chromium.org> Commit-Queue: Mirko Bonadei <mbonadei@chromium.org> Auto-Submit: Danil Chapovalov <danilchap@chromium.org> Cr-Commit-Position: refs/heads/main@{#1670421} NOKEYCHECK=True GitOrigin-RevId: d21f56dab9f3df262757d0db2192d9a0dfc8a377
diff --git a/BUILD.gn b/BUILD.gn index 58d375f..67bf24f 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -467,6 +467,10 @@ "absl/time:flag_test", "absl/time:simulated_clock_test", "absl/time:time_test", + "absl/time/internal/cctz:civil_time_test", + "absl/time/internal/cctz:time_zone_format_test", + "absl/time/internal/cctz:time_zone_lookup_test", + "absl/time/internal/cctz:time_zone_name_win_test", "absl/types:compare_test", "absl/types:optional_ref_test", "absl/types:source_location_test",
diff --git a/absl/time/internal/cctz/BUILD.gn b/absl/time/internal/cctz/BUILD.gn index 592c835..f095576 100644 --- a/absl/time/internal/cctz/BUILD.gn +++ b/absl/time/internal/cctz/BUILD.gn
@@ -1,6 +1,8 @@ # Copyright 2018 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# +# Generated file. DO NOT EDIT. import("//third_party/abseil-cpp/absl.gni") @@ -32,16 +34,19 @@ "src/tzfile.h", "src/zone_info_source.cc", ] - if (is_win) { - sources += [ - "src/time_zone_name_win.cc", - "src/time_zone_name_win.h", - ] - } public = [ "include/cctz/time_zone.h", "include/cctz/zone_info_source.h", ] + deps = [ + ":civil_time", + "//third_party/abseil-cpp/absl/base:config", + ] + + if (is_win) { + sources += [ "src/time_zone_name_win.cc" ] + public += [ "src/time_zone_name_win.h" ] + } defines = [] if (is_apple) { frameworks = [ "Foundation.framework" ] @@ -49,10 +54,6 @@ # Work-around for https://github.com/llvm/llvm-project/issues/117630 defines += [ "_XOPEN_SOURCE=700" ] } - deps = [ - ":civil_time", - "//third_party/abseil-cpp/absl/base:config", - ] if (is_fuchsia) { deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.intl:fuchsia.intl_hlcpp", @@ -63,3 +64,48 @@ ] } } + +absl_source_set("test_time_zone_names") { + testonly = true + sources = [ "src/test_time_zone_names.cc" ] + public = [ "src/test_time_zone_names.h" ] + visibility = [ ":*" ] + deps = [ "//third_party/abseil-cpp/absl/base:config" ] +} + +absl_test("civil_time_test") { + sources = [ "src/civil_time_test.cc" ] + deps = [ + ":civil_time", + "//third_party/abseil-cpp/absl/base:config", + ] +} + +absl_test("time_zone_format_test") { + sources = [ "src/time_zone_format_test.cc" ] + deps = [ + ":civil_time", + ":time_zone", + "//third_party/abseil-cpp/absl/base:config", + ] +} + +absl_test("time_zone_lookup_test") { + sources = [ "src/time_zone_lookup_test.cc" ] + deps = [ + ":civil_time", + ":test_time_zone_names", + ":time_zone", + "//third_party/abseil-cpp/absl/base:config", + ] +} + +absl_test("time_zone_name_win_test") { + deps = [ + ":time_zone", + "//third_party/abseil-cpp/absl/base:config", + ] + if (is_win) { + sources = [ "src/time_zone_name_win_test.cc" ] + } +}
diff --git a/convert_bazel_to_gn.py b/convert_bazel_to_gn.py index ec53675..65192c7 100755 --- a/convert_bazel_to_gn.py +++ b/convert_bazel_to_gn.py
@@ -70,27 +70,60 @@ _ADD_CONTENT = { 'cleanup:cleanup_internal': 'visibility = [ "//third_party/abseil-cpp/absl/*" ]', - 'container:hashtablez_sampler_test': 'if (is_win) { sources = [] }', + 'container:hashtablez_sampler_test': + 'if (is_win) { sources = [] }', 'container:test_allocator': 'deps = [ "//third_party/abseil-cpp/absl/base:config", "//third_party/googletest:gtest" ]', - 'flags:config': 'public_configs = [ ":absl_flags_config" ]', - 'flags:parse_test': 'if (is_ios) { sources = [] }', - 'log:absl_check_test': 'if (is_ios) { sources = [] }', - 'log:log_sink_test': 'if (is_ios) { sources = [] }', - 'log:scoped_mock_log_test': 'if (is_ios) { sources = [] }', - 'log/internal:log_sink_set': 'if (is_android) { libs = [ "log" ] }', + 'flags:config': + 'public_configs = [ ":absl_flags_config" ]', + 'flags:parse_test': + 'if (is_ios) { sources = [] }', + 'log:absl_check_test': + 'if (is_ios) { sources = [] }', + 'log:log_sink_test': + 'if (is_ios) { sources = [] }', + 'log:scoped_mock_log_test': + 'if (is_ios) { sources = [] }', + 'log/internal:log_sink_set': + 'if (is_android) { libs = [ "log" ] }', 'log/internal:stderr_log_sink_test': 'if (is_apple || is_android) { sources = [] }', - 'random:uniform_real_distribution_test': 'if (is_ios) { sources = [] }', - 'random/internal:seed_material': 'if (is_win) { libs = [ "bcrypt.lib" ]}', - 'strings:strings': '''public_deps = [ + 'random:uniform_real_distribution_test': + 'if (is_ios) { sources = [] }', + 'random/internal:seed_material': + 'if (is_win) { libs = [ "bcrypt.lib" ]}', + 'strings:strings': + '''public_deps = [ # string_view.h was once part of :strings, so string_view.h is # re-exported for backwards compatibility. # New code should directly depend on :string_view. # TODO(crbug.com/40276308): Remove once all targets are migrated to # :string_view. ":string_view" ]''', - 'strings:str_format_convert_test': 'if (is_fuchsia) { sources = [] }', + 'strings:str_format_convert_test': + 'if (is_fuchsia) { sources = [] }', + # Instead of parsing 'select', add platform-specific rules manually while there are few of those. + 'time/internal/cctz:time_zone': + ''' +if (is_win) { sources += [ "src/time_zone_name_win.cc" ] + public += [ "src/time_zone_name_win.h" ] } +defines = [] +if (is_apple) { + frameworks = [ "Foundation.framework" ] + # Work-around for https://github.com/llvm/llvm-project/issues/117630 + defines += [ "_XOPEN_SOURCE=700" ] +} +if (is_fuchsia) { + deps += [ + "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.intl:fuchsia.intl_hlcpp", + "//third_party/fuchsia-sdk/sdk/pkg/async", + "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp", + "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", + "//third_party/fuchsia-sdk/sdk/pkg/zx", + ] +}''', + 'time/internal/cctz:time_zone_name_win_test': + 'if (is_win) { sources = [ "src/time_zone_name_win_test.cc" ] }', } @@ -395,6 +428,7 @@ 'strings', 'synchronization', 'time', + 'time/internal/cctz', 'types', 'utility', ]: