chromium/components/language/android/BUILD.gn

# 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.

import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")

generate_jni("jni_headers") {
  sources = [
    "java/src/org/chromium/components/language/AndroidLanguageMetricsBridge.java",
    "java/src/org/chromium/components/language/GeoLanguageProviderBridge.java",
  ]
}

source_set("language_bridge") {
  sources = [
    "android_language_metrics_bridge.cc",
    "geo_language_provider_bridge.cc",
  ]
  deps = [
    ":jni_headers",
    "//base",
    "//components/language/content/browser:browser",
  ]
}

android_library("java") {
  srcjar_deps = [ ":jni_headers" ]
  sources = [
    "java/src/org/chromium/components/language/AndroidLanguageMetricsBridge.java",
    "java/src/org/chromium/components/language/GeoLanguageProviderBridge.java",
    "java/src/org/chromium/components/language/LanguageProfileController.java",
    "java/src/org/chromium/components/language/LanguageProfileMetricsLogger.java",
  ]

  deps = [
    ":ulp_delegate_java",
    "//base:base_java",
    "//build/android:build_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
}

android_library("ulp_delegate_java") {
  sources = [
    "java/src/org/chromium/components/language/LanguageProfileDelegate.java",
    "java/src/org/chromium/components/language/LanguageProfileDelegateImpl.java",
    "java/src/org/chromium/components/language/LocaleManagerDelegate.java",
    "java/src/org/chromium/components/language/LocaleManagerDelegateImpl.java",
  ]

  # Allow downstream targets to provide their own implementations.
  jar_excluded_patterns = [
    "*/LanguageProfileDelegateImpl.class",
    "*/LocaleManagerDelegateImpl.class",
  ]
}

android_library("ulp_delegate_public_java") {
  sources = [
    "java/src/org/chromium/components/language/LanguageProfileDelegateImpl.java",
    "java/src/org/chromium/components/language/LocaleManagerDelegateImpl.java",
  ]

  deps = [ ":ulp_delegate_java" ]
}

robolectric_library("junit") {
  sources = [ "java/src/org/chromium/components/language/LanguageProfileControllerUnitTest.java" ]
  deps = [
    ":java",
    ":ulp_delegate_java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_junit_test_support",
    "//components/browser_ui/widget/android:java",
    "//content/public/android:content_java",
    "//content/public/test/android:content_java_test_support",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
    "//ui/android:ui_java",
  ]
}

android_library("javatests") {
  testonly = true

  sources = [ "java/src/org/chromium/components/language/AndroidLanguageMetricsBridgeTest.java" ]
  deps = [
    ":java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//chrome/browser/flags:java",
    "//chrome/test/android:chrome_java_integration_test_support",
    "//content/public/test/android:content_java_test_support",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
  ]
}