chromium/chrome/browser/policy/android/BUILD.gn

# Copyright 2020 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("//third_party/jni_zero/jni_zero.gni")

generate_jni("util_jni") {
  sources = [ "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferences.java" ]
}

android_library("util_java") {
  srcjar_deps = [ ":util_jni" ]
  sources = [ "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferences.java" ]

  deps = [
    "//chrome/browser/preferences:java",
    "//components/policy/android:policy_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
}

android_library("java") {
  srcjar_deps = [ ":jni_headers" ]
  sources = [
    "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnection.java",
    "java/src/org/chromium/chrome/browser/policy/PolicyServiceFactory.java",
  ]

  deps = [
    "//base:base_java",
    "//build/android:build_java",
    "//chrome/browser/profiles/android:java",
    "//components/policy/android:policy_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
  ]

  public_deps = [
    ":delegate_java",
    ":util_java",
  ]
}

android_library("delegate_java") {
  sources = [
    "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionDelegate.java",
    "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionDelegateImpl.java",
  ]

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

android_library("delegate_public_impl_java") {
  sources = [ "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionDelegateImpl.java" ]

  deps = [
    ":delegate_java",
    ":util_java",
  ]
}

generate_jni("jni_headers") {
  sources = [
    "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnection.java",
    "java/src/org/chromium/chrome/browser/policy/PolicyServiceFactory.java",
  ]
  public_deps = [ ":util_jni" ]
}

robolectric_library("junit") {
  sources = [
    "java/src/org/chromium/chrome/browser/policy/CloudManagementAndroidConnectionTest.java",
    "java/src/org/chromium/chrome/browser/policy/CloudManagementSharedPreferencesTest.java",
  ]

  deps = [
    ":delegate_java",
    ":java",
    ":util_java",
    "//base:base_junit_test_support",
    "//chrome/browser/preferences:java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
  ]
}

static_library("android") {
  sources = [
    "cloud_management_android_connection.cc",
    "cloud_management_android_connection.h",
  ]

  deps = [
    ":jni_headers",
    "//base",
  ]
}