chromium/components/component_updater/android/BUILD.gn

# Copyright 2021 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")

android_library("background_task_update_scheduler_java") {
  srcjar_deps = [ ":background_task_update_scheduler_jni_headers" ]
  sources = [
    "java/src/org/chromium/components/component_updater/UpdateScheduler.java",
    "java/src/org/chromium/components/component_updater/UpdateTask.java",
  ]
  deps = [
    ":background_task_update_scheduler_jni_headers",
    "//base:base_java",
    "//build/android:build_java",
    "//components/background_task_scheduler:background_task_scheduler_java",
    "//components/background_task_scheduler:background_task_scheduler_task_ids_java",
    "//third_party/android_deps:chromium_play_services_availability_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
}

generate_jni("background_task_update_scheduler_jni_headers") {
  sources = [
    "java/src/org/chromium/components/component_updater/UpdateScheduler.java",
  ]
}

static_library("native_background_task_update_scheduler") {
  sources = [
    "background_task_update_scheduler.cc",
    "background_task_update_scheduler.h",
  ]
  deps = [
    ":background_task_update_scheduler_jni_headers",
    "//base",
    "//components/component_updater",
  ]
}

android_aidl("component_provider_service_aidl") {
  import_include = [ "java/src" ]
  sources = [ "java/src/org/chromium/components/component_updater/IComponentsProviderService.aidl" ]
}

android_library("component_provider_service_aidl_java") {
  srcjar_deps = [ ":component_provider_service_aidl" ]
}

android_library("embedded_component_loader_java") {
  sources = [
    "java/src/org/chromium/components/component_updater/ComponentLoaderPolicyBridge.java",
    "java/src/org/chromium/components/component_updater/EmbeddedComponentLoader.java",
  ]
  deps = [
    ":component_provider_service_aidl_java",
    ":embedded_component_loader_jni_headers",
    "//base:base_java",
    "//build/android:build_java",
    "//content/public/android:content_main_dex_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
  srcjar_deps = [
    ":component_loader_policy_enum_srcjar",
    ":embedded_component_loader_jni_headers",
  ]
}

java_cpp_enum("component_loader_policy_enum_srcjar") {
  # External code should depend on ":embedded_component_loader_java" instead.
  visibility = [ ":*" ]
  sources = [ "component_loader_policy.h" ]
}

generate_jni("embedded_component_loader_jni_headers") {
  sources = [ "java/src/org/chromium/components/component_updater/ComponentLoaderPolicyBridge.java" ]
}

static_library("embedded_component_loader") {
  sources = [
    "component_loader_policy.cc",
    "component_loader_policy.h",
    "component_loader_policy_forward.h",
    "components_info_holder.cc",
    "components_info_holder.h",
  ]
  deps = [
    ":embedded_component_loader_jni_headers",
    "//base",
    "//components/component_updater",
    "//components/crash/core/common:crash_key",
    "//components/metrics:component_metrics",
    "//components/update_client",
    "//third_party/metrics_proto",
  ]
}

source_set("embedded_component_loader_unittests") {
  testonly = true
  sources = [ "component_loader_policy_unittests.cc" ]
  deps = [
    ":embedded_component_loader",
    "//base",
    "//base/test:test_support",
    "//components/crash/core/common:crash_key",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

static_library("loader_policies") {
  sources = [
    "loader_policies/first_party_sets_component_loader_policy.cc",
    "loader_policies/first_party_sets_component_loader_policy.h",
    "loader_policies/masked_domain_list_component_loader_policy.cc",
    "loader_policies/masked_domain_list_component_loader_policy.h",
    "loader_policies/tpcd_metadata_component_loader_policy.cc",
    "loader_policies/tpcd_metadata_component_loader_policy.h",
    "loader_policies/trust_token_key_commitments_component_loader_policy.cc",
    "loader_policies/trust_token_key_commitments_component_loader_policy.h",
  ]

  deps = [
    ":embedded_component_loader",
    "//base",
    "//components/component_updater",
    "//components/component_updater/installer_policies",
    "//mojo/public/cpp/base:protobuf_support",
  ]
}