260 lines
5.7 KiB
Plaintext
260 lines
5.7 KiB
Plaintext
|
|
# 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/config/python.gni")
|
||
|
|
import("//testing/test.gni")
|
||
|
|
import("//third_party/protobuf/proto_library.gni")
|
||
|
|
|
||
|
|
# Structured metrics is subcomponent of UMA that gathers and reports structured
|
||
|
|
# events with several attached metrics.
|
||
|
|
static_library("structured") {
|
||
|
|
sources = [
|
||
|
|
"external_metrics.cc",
|
||
|
|
"external_metrics.h",
|
||
|
|
"key_data.cc",
|
||
|
|
"key_data.h",
|
||
|
|
"persistent_proto.cc",
|
||
|
|
"persistent_proto.h",
|
||
|
|
"structured_metrics_provider.cc",
|
||
|
|
"structured_metrics_provider.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
public_deps = [
|
||
|
|
":common",
|
||
|
|
":events",
|
||
|
|
"//third_party/metrics_proto",
|
||
|
|
]
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":storage",
|
||
|
|
":structured_events",
|
||
|
|
":structured_metrics_validator",
|
||
|
|
"//base",
|
||
|
|
"//components/metrics",
|
||
|
|
"//components/metrics/structured/mojom",
|
||
|
|
"//components/prefs",
|
||
|
|
"//crypto",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("events") {
|
||
|
|
sources = [
|
||
|
|
"delegating_events_processor.cc",
|
||
|
|
"delegating_events_processor.h",
|
||
|
|
"enums.h",
|
||
|
|
"event.cc",
|
||
|
|
"event.h",
|
||
|
|
"events_processor_interface.h",
|
||
|
|
"structured_metrics_client.cc",
|
||
|
|
"structured_metrics_client.h",
|
||
|
|
]
|
||
|
|
deps = [
|
||
|
|
"//base",
|
||
|
|
"//third_party/metrics_proto",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
proto_library("storage") {
|
||
|
|
# These protos are only used internally, so make them visible only to
|
||
|
|
# subdirectories.
|
||
|
|
visibility = [ "./*" ]
|
||
|
|
proto_in_dir = "//"
|
||
|
|
generate_python = false
|
||
|
|
sources = [ "storage.proto" ]
|
||
|
|
|
||
|
|
# This is required because metrics_proto/BUILD.gn sets proto_in_dir as ".",
|
||
|
|
# which means protos can't be referred to by absolute paths from within other
|
||
|
|
# protos.
|
||
|
|
import_dirs = [ "//third_party/metrics_proto" ]
|
||
|
|
proto_deps = [ "//third_party/metrics_proto" ]
|
||
|
|
link_deps = [ "//third_party/metrics_proto" ]
|
||
|
|
}
|
||
|
|
|
||
|
|
# Sources used by all static libraries in this BUILD file.
|
||
|
|
source_set("common") {
|
||
|
|
sources = [
|
||
|
|
"histogram_util.cc",
|
||
|
|
"histogram_util.h",
|
||
|
|
"recorder.cc",
|
||
|
|
"recorder.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
public_deps = [
|
||
|
|
":events",
|
||
|
|
":structured_metrics_features",
|
||
|
|
]
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":storage",
|
||
|
|
":structured_metrics_validator",
|
||
|
|
"//components/prefs",
|
||
|
|
"//third_party/metrics_proto",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("structured_metrics_features") {
|
||
|
|
sources = [
|
||
|
|
"structured_metrics_features.cc",
|
||
|
|
"structured_metrics_features.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
public_deps = [ "//base" ]
|
||
|
|
}
|
||
|
|
|
||
|
|
action("gen_structured_events") {
|
||
|
|
script = "//tools/metrics/structured/gen_events.py"
|
||
|
|
|
||
|
|
# Re-generate the outputs if the codegen code changes:
|
||
|
|
inputs = [
|
||
|
|
"//tools/metrics/structured/codegen.py",
|
||
|
|
"//tools/metrics/structured/gen_events.py",
|
||
|
|
"//tools/metrics/structured/model.py",
|
||
|
|
"//tools/metrics/structured/model_util.py",
|
||
|
|
"//tools/metrics/structured/templates_events.py",
|
||
|
|
]
|
||
|
|
sources = [ "//tools/metrics/structured/structured.xml" ]
|
||
|
|
|
||
|
|
outdir = "$target_gen_dir"
|
||
|
|
|
||
|
|
outputs = [
|
||
|
|
outdir + "/structured_events.cc",
|
||
|
|
outdir + "/structured_events.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
args = [
|
||
|
|
"--input",
|
||
|
|
rebase_path(sources[0], root_build_dir),
|
||
|
|
"--output",
|
||
|
|
rebase_path(outdir, root_build_dir),
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("structured_events") {
|
||
|
|
sources = get_target_outputs(":gen_structured_events")
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":common",
|
||
|
|
":gen_structured_events",
|
||
|
|
"//base",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
action("gen_structured_metrics_validator") {
|
||
|
|
script = "//tools/metrics/structured/gen_validator.py"
|
||
|
|
|
||
|
|
# Re-generate the outputs if the codegen code changes:
|
||
|
|
inputs = [
|
||
|
|
"//tools/metrics/structured/codegen.py",
|
||
|
|
"//tools/metrics/structured/gen_validator.py",
|
||
|
|
"//tools/metrics/structured/model.py",
|
||
|
|
"//tools/metrics/structured/model_util.py",
|
||
|
|
"//tools/metrics/structured/templates_validator.py",
|
||
|
|
]
|
||
|
|
sources = [ "//tools/metrics/structured/structured.xml" ]
|
||
|
|
|
||
|
|
outdir = "$target_gen_dir"
|
||
|
|
|
||
|
|
outputs = [
|
||
|
|
outdir + "/structured_metrics_validator.cc",
|
||
|
|
outdir + "/structured_metrics_validator.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
args = [
|
||
|
|
"--input",
|
||
|
|
rebase_path(sources[0], root_build_dir),
|
||
|
|
"--output",
|
||
|
|
rebase_path(outdir, root_build_dir),
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("structured_metrics_validator") {
|
||
|
|
sources = get_target_outputs(":gen_structured_metrics_validator") + [
|
||
|
|
"event_validator.cc",
|
||
|
|
"event_validator.h",
|
||
|
|
"project_validator.cc",
|
||
|
|
"project_validator.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":events",
|
||
|
|
":gen_structured_metrics_validator",
|
||
|
|
"//base",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("neutrino_logging") {
|
||
|
|
sources = [
|
||
|
|
"neutrino_logging.cc",
|
||
|
|
"neutrino_logging.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":common",
|
||
|
|
":structured_events",
|
||
|
|
"//base",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("neutrino_logging_util") {
|
||
|
|
sources = [
|
||
|
|
"neutrino_logging_util.cc",
|
||
|
|
"neutrino_logging_util.h",
|
||
|
|
]
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":neutrino_logging",
|
||
|
|
":structured_events",
|
||
|
|
"//base",
|
||
|
|
"//components/metrics",
|
||
|
|
"//components/prefs",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
static_library("test_support") {
|
||
|
|
testonly = true
|
||
|
|
sources = [
|
||
|
|
"test/test_structured_metrics_provider.cc",
|
||
|
|
"test/test_structured_metrics_provider.h",
|
||
|
|
]
|
||
|
|
deps = [
|
||
|
|
":structured",
|
||
|
|
"//base",
|
||
|
|
"//base/test:test_support",
|
||
|
|
"//components/metrics:metrics",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
source_set("unit_tests") {
|
||
|
|
testonly = true
|
||
|
|
sources = [
|
||
|
|
"external_metrics_unittest.cc",
|
||
|
|
"key_data_unittest.cc",
|
||
|
|
"persistent_proto_unittest.cc",
|
||
|
|
"structured_metrics_provider_unittest.cc",
|
||
|
|
]
|
||
|
|
|
||
|
|
deps = [
|
||
|
|
":events",
|
||
|
|
":storage",
|
||
|
|
":structured",
|
||
|
|
":structured_events",
|
||
|
|
":structured_metrics_validator",
|
||
|
|
"//base",
|
||
|
|
"//base/test:test_support",
|
||
|
|
"//components/prefs",
|
||
|
|
"//testing/gtest",
|
||
|
|
]
|
||
|
|
}
|
||
|
|
|
||
|
|
# Convenience testing target
|
||
|
|
test("structured_metrics_unittests") {
|
||
|
|
deps = [
|
||
|
|
":unit_tests",
|
||
|
|
"//base",
|
||
|
|
"//base/test:test_support",
|
||
|
|
"//components/metrics/structured/mojom:unit_tests",
|
||
|
|
"//components/test:run_all_unittests",
|
||
|
|
]
|
||
|
|
}
|