# 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/config.gni")
import("//build/config/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")
assert(is_android, "This component can only be depended on for android builds")
# Intended for content embedders such as WebView & WebLayer.
static_library("metrics") {
sources = [
"android_metrics_log_uploader.cc",
"android_metrics_log_uploader.h",
"android_metrics_service_client.cc",
"android_metrics_service_client.h",
"features.cc",
"features.h",
"memory_metrics_logger.cc",
"memory_metrics_logger.h",
]
deps = [
":jni",
"//base",
"//cc/base",
"//components/metrics",
"//components/metrics:content",
"//components/metrics:net",
"//components/metrics:ui",
"//components/prefs",
"//components/ukm",
"//components/variations:variations",
"//components/version_info",
"//components/version_info/android:channel_getter",
"//content/public/browser",
"//services/resource_coordinator/public/cpp/memory_instrumentation:browser",
]
}
java_cpp_enum("java_enum_srcjar") {
# External code should depend on ":java" instead.
visibility = [ ":*" ]
sources = [ "android_metrics_service_client.h" ]
}
java_cpp_features("java_features_srcjar") {
# External code should depend on ":java" instead.
visibility = [ ":*" ]
sources = [ "features.cc" ]
template = "java_templates/AndroidMetricsFeatures.java.tmpl"
}
android_library("java") {
sources = [
"java/src/org/chromium/components/metrics/AndroidMetricsLogConsumer.java",
"java/src/org/chromium/components/metrics/AndroidMetricsLogUploader.java",
"java/src/org/chromium/components/metrics/AndroidMetricsServiceClient.java",
]
deps = [
"//base:base_java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//third_party/jni_zero:jni_zero_java",
]
srcjar_deps = [
":java_enum_srcjar",
":java_features_srcjar",
":jni",
]
}
generate_jni("jni") {
sources = [
"java/src/org/chromium/components/metrics/AndroidMetricsLogUploader.java",
"java/src/org/chromium/components/metrics/AndroidMetricsServiceClient.java",
]
}
source_set("unit_tests") {
testonly = true
sources = [ "android_metrics_service_client_unittest.cc" ]
deps = [
":metrics",
"//base/test:test_support",
"//components/metrics",
"//components/metrics:content",
"//components/prefs:test_support",
"//content/test:test_support",
"//testing/gtest",
]
}
# Runtime dependencies of the unit_tests target, accessed over JNI. This cannot
# be pulled in via unit_tests deps, but should be pulled into the top-level test
# target.
java_group("test_support_java") {
testonly = true
deps = [
":java",
"//base/version_info/android:version_constants_java",
]
}