chromium/chrome/browser/ui/android/hats/internal/BUILD.gn

# Copyright 2023 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/rules.gni")
import("//chrome/android/features/android_library_factory_tmpl.gni")
import("//third_party/jni_zero/jni_zero.gni")

android_library("java") {
  srcjar_deps = [ ":jni_headers" ]
  visibility = [
    ":*",
    "//chrome/android:chrome_all_java",
    "//chrome/browser/ui/android/hats/test:test_support_java",
  ]
  sources = [
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyClientBridge.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyClientFactory.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyClientImpl.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyMetadata.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyThrottler.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyUiDelegateBridge.java",
  ]
  deps = [
    ":controller_java",
    "//base:base_java",
    "//chrome/browser/android/lifecycle:java",
    "//chrome/browser/first_run/android:java",
    "//chrome/browser/flags:java",
    "//chrome/browser/preferences:java",
    "//chrome/browser/profiles/android:java",
    "//chrome/browser/tabmodel:java",
    "//chrome/browser/ui/android/hats:java",
    "//chrome/browser/ui/android/hats:message_ui_delegate_java",
    "//chrome/browser/ui/android/signin:java_resources",
    "//components/browser_ui/util/android:java",
    "//components/messages/android:java",
    "//components/prefs/android:java",
    "//components/user_prefs/android:java",
    "//content/public/android:content_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
    "//ui/android:ui_no_recycler_view_java",
  ]
  resources_package = "org.chromium.chrome.browser.ui.hats"
}

robolectric_library("junit") {
  testonly = true
  sources = [
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyClientBridgeUnitTest.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyClientUnitTest.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyThrottlerUnitTest.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyUiDelegateBridgeUnitTest.java",
  ]
  deps = [
    ":controller_java",
    ":java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_junit_test_support",
    "//chrome/browser/android/lifecycle:java",
    "//chrome/browser/first_run/android:java",
    "//chrome/browser/flags:java",
    "//chrome/browser/preferences:java",
    "//chrome/browser/profiles/android:java",
    "//chrome/browser/tabmodel:java",
    "//chrome/browser/ui/android/hats:java",
    "//chrome/browser/ui/android/hats:message_ui_delegate_java",
    "//chrome/browser/ui/android/hats/test:test_support_java",
    "//components/messages/android:factory_java",
    "//components/messages/android:java",
    "//components/messages/android:manager_java",
    "//components/prefs/android:java",
    "//components/user_prefs/android:java",
    "//content/public/android:content_java",
    "//content/public/test/android:content_java_test_support",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
    "//ui/android:ui_no_recycler_view_java",
  ]
}

android_library("controller_java") {
  sources = [
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyController.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyControllerProvider.java",
  ]

  deps = [
    "//base:base_java",
    "//chrome/browser/android/lifecycle:java",
    "//chrome/browser/preferences:java",
    "//chrome/browser/profiles/android:java",
    "//components/prefs/android:java",
    "//components/user_prefs/android:java",
    "//content/public/android:content_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//ui/android:ui_java",
  ]

  # Add the actual implementation where necessary so that downstream targets
  # can provide their own implementations.
  jar_excluded_patterns = [ "*/SurveyControllerProvider*.class" ]
}

android_library("provider_public_impl_java") {
  sources = [ "java/src/org/chromium/chrome/browser/ui/hats/SurveyControllerProvider.java" ]

  deps = [
    ":controller_java",
    "//chrome/browser/profiles/android:java",
  ]
}

generate_jni("jni_headers") {
  sources = [
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyClientBridge.java",
    "java/src/org/chromium/chrome/browser/ui/hats/SurveyUiDelegateBridge.java",
  ]
}