chromium/services/device/time_zone_monitor/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")

if (is_android) {
  import("//build/config/android/rules.gni")
  import("//third_party/jni_zero/jni_zero.gni")
}

source_set("time_zone_monitor") {
  visibility = [
    ":test_support",
    "//services/device:lib",
  ]

  sources = [
    "time_zone_monitor.cc",
    "time_zone_monitor.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [
    "//base",
    "//build:chromecast_buildflags",
    "//mojo/public/cpp/bindings",
    "//third_party/icu",
  ]

  public_deps = [ "//services/device/public/mojom" ]

  if (is_android) {
    sources += [
      "time_zone_monitor_android.cc",
      "time_zone_monitor_android.h",
    ]
    deps += [ ":time_zone_monitor_jni_headers" ]
  }

  if (is_win) {
    sources += [ "time_zone_monitor_win.cc" ]
    deps += [ "//ui/gfx" ]
  }

  if (is_linux) {
    sources += [ "time_zone_monitor_linux.cc" ]
    deps += [ "//build:chromeos_buildflags" ]
  }

  if (is_chromeos_ash) {
    sources += [ "time_zone_monitor_ash.cc" ]
    deps += [ "//chromeos/ash/components/settings" ]
  }

  if (is_chromeos_lacros) {
    sources += [
      "time_zone_monitor_lacros.cc",
      "time_zone_monitor_lacros.h",
    ]
    deps += [
      "//build:chromeos_buildflags",
      "//chromeos/crosapi/mojom",
      "//chromeos/lacros",
    ]
  }

  if (is_apple) {
    sources += [ "time_zone_monitor_mac.mm" ]
    frameworks = [ "Foundation.framework" ]
  }

  if (is_fuchsia) {
    sources += [ "time_zone_monitor_fuchsia.cc" ]
  }
}

source_set("test_support") {
  testonly = true

  sources = [ "fake_time_zone_monitor.h" ]

  public_deps = [ ":time_zone_monitor" ]
}

if (is_android) {
  generate_jni("time_zone_monitor_jni_headers") {
    visibility = [ ":*" ]
    sources = [ "android/java/src/org/chromium/device/time_zone_monitor/TimeZoneMonitor.java" ]
  }

  android_library("java") {
    # Conceptually, this should be visible only to //services/device:java.
    # However, various generated targets also need to see this target as a
    # result of //services/device:java depending on it.
    visibility = [ "//services/device:*" ]
    srcjar_deps = [ ":time_zone_monitor_jni_headers" ]
    sources = [ "android/java/src/org/chromium/device/time_zone_monitor/TimeZoneMonitor.java" ]
    deps = [
      "//base:base_java",
      "//build/android:build_java",
      "//third_party/jni_zero:jni_zero_java",
    ]
  }
}