chromium/chrome/browser/test_dummy/internal/BUILD.gn

# Copyright 2019 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/buildflag_header.gni")
import("//build/config/android/rules.gni")
import("//chrome/android/modules/buildflags.gni")
import("//third_party/jni_zero/jni_zero.gni")
import("//tools/grit/grit_rule.gni")

android_resources("java_resources") {
  sources = [ "android/java/res/raw/dummy_resource" ]
}

android_library("java") {
  deps = [
    ":base_module_java",
    ":java_resources",
    "//base:base_java",
    "//build/android:build_java",
    "//chrome/browser/test_dummy:java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_appcompat_appcompat_java",
  ]
  srcjar_deps = [ ":jni_headers" ]
  sources = [ "android/java/src/org/chromium/chrome/browser/test_dummy/TestDummyImpl.java" ]

  deps += [ "//third_party/jni_zero:jni_zero_java" ]
  resources_package = "org.chromium.chrome.browser.test_dummy"
}

source_set("native") {
  sources = [ "android/test_dummy_impl.cc" ]

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

# Java code that should go into the base module. If this were a normal feature,
# this target would reside in the client code using the module. Since this is a
# test dummy module, it has no pre-existing client, and hence the target is
# squatting here for convenience. The same is true for the corresponding native
# target.
android_library("base_module_java") {
  deps = [
    "//base:base_java",
    "//chrome/android/modules/test_dummy/provider:java",
    "//chrome/android/modules/test_dummy/public:java",
    "//chrome/browser/test_dummy:java",
    "//components/module_installer/android:module_installer_java",
    "//third_party/androidx:androidx_appcompat_appcompat_java",
  ]
  sources = [ "android/java/src/org/chromium/chrome/browser/test_dummy/TestDummyActivity.java" ]
}

generate_jni("jni_headers") {
  sources = [ "android/java/src/org/chromium/chrome/browser/test_dummy/TestDummyImpl.java" ]
}

# Cannot call this just "resources" since all targets with that name in
# //chrome/android need a build_config, which grit targets don't have.
grit("resources_native") {
  source = "android/resources/resources.grd"
  outputs = [
    "grit/test_dummy_resources.h",
    "test_dummy_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}