blob: 3d1bb878f22dae642f475429d52611744771cf66 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/protobuf/proto_library.gni")
import("$cobalt_root/metrics_registry.gni")
visibility = [ "$cobalt_root/*" ]
metrics_registry("internal_metrics_config") {
# This must match the IDs of our Cobalt project as specified in:
# third_party/cobalt_config/projects.yaml
customer_id = 2147483647
project_id = 205836624
namespace = "cobalt.logger"
features = [ "generate-config-base64" ]
generate_cc = true
}
source_set("status") {
sources = [ "status.h" ]
}
source_set("event_record") {
sources = [ "event_record.h" ]
public_configs = [
"$cobalt_root:cobalt_config",
"$cobalt_root/src/registry:proto_config",
]
public_deps = [
":project_context",
"$cobalt_root/src/pb",
"$cobalt_root/src/registry:cobalt_registry_proto",
]
}
source_set("project_context") {
sources = [
"project_context.cc",
"project_context.h",
]
public_configs = [
"$cobalt_root:cobalt_config",
"$cobalt_root/src/registry:proto_config",
]
public_deps = [
":status",
"$cobalt_root/src:logging",
"$cobalt_root/src/lib/statusor",
"$cobalt_root/src/registry:cobalt_registry_proto",
"$cobalt_root/src/registry:project_configs",
]
}
source_set("project_context_factory") {
sources = [
"project_context_factory.cc",
"project_context_factory.h",
]
public_configs = [
"$cobalt_root:cobalt_config",
"$cobalt_root/src/registry:proto_config",
]
deps = [
"$cobalt_root/src/registry:cobalt_registry_proto",
# This is for base64 decoding.
"//third_party/abseil-cpp/absl/strings",
]
public_deps = [ ":project_context" ]
}
source_set("encoder") {
sources = [
"encoder.cc",
"encoder.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
deps = [
"$cobalt_root/src:tracing",
"$cobalt_root/src/algorithms/rappor:rappor_encoder",
"$cobalt_root/src/lib/util:datetime_util",
"$cobalt_root/src/pb:metadata_builder",
]
public_deps = [
":logger_interface",
":project_context",
":status",
"$cobalt_root/src:logging",
"$cobalt_root/src/algorithms/rappor:rappor_config_helper",
"$cobalt_root/src/lib/crypto_util",
"$cobalt_root/src/pb:metadata_builder",
"$cobalt_root/src/registry:buckets_config",
"$cobalt_root/src/registry:cobalt_registry_proto",
"$cobalt_root/src/registry:packed_event_codes",
"$cobalt_root/src/system_data:client_secret",
"$cobalt_root/src/system_data:system_data",
"//third_party/abseil-cpp",
]
}
source_set("observation_writer") {
sources = [
"observation_writer.cc",
"observation_writer.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
public_deps = [
":status",
"$cobalt_root/src:logging",
"$cobalt_root/src:tracing",
"$cobalt_root/src/lib/util:encrypted_message_util",
"$cobalt_root/src/observation_store",
"$cobalt_root/src/observation_store:observation_store_update_recipient",
"$cobalt_root/src/pb",
]
}
source_set("logger_interface") {
sources = [
"logger_interface.h",
"types.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
public_deps = [
":internal_metrics_config_cc",
":status",
"$cobalt_root/src/pb",
"$cobalt_root/src/registry:cobalt_registry_proto",
"$cobalt_root/src/registry:packed_event_codes",
]
}
source_set("internal_metrics") {
sources = [
"internal_metrics.cc",
"internal_metrics.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
public_deps = [
":internal_metrics_config_cc",
":logger_interface",
"$cobalt_root/src:logging",
"//third_party/abseil-cpp",
]
}
source_set("event_loggers") {
visibility = []
visibility = [
":event_loggers_test",
":logger",
":undated_event_manager",
]
sources = [
"event_loggers.cc",
"event_loggers.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
public_deps = [
":encoder",
":event_record",
":observation_writer",
":status",
"$cobalt_root/src:tracing",
"$cobalt_root/src/local_aggregation:event_aggregator",
"$cobalt_root/src/local_aggregation_1.1:local_aggregation",
]
}
source_set("logger") {
sources = [
"logger.cc",
"logger.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
public_deps = [
":encoder",
":event_loggers",
":event_record",
":event_vector_index",
":internal_metrics",
":logger_interface",
":observation_writer",
":status",
":undated_event_manager",
"$cobalt_root/src/lib/util:clock",
"$cobalt_root/src/local_aggregation:event_aggregator",
"$cobalt_root/src/local_aggregation_1.1:local_aggregation",
]
visibility += [ "//src/cobalt/bin/app:lib" ]
}
source_set("undated_event_manager") {
sources = [
"undated_event_manager.cc",
"undated_event_manager.h",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
public_deps = [
":encoder",
":event_loggers",
":event_record",
":internal_metrics",
":logger_interface",
":observation_writer",
":status",
"$cobalt_root/src/lib/util:clock",
"$cobalt_root/src/local_aggregation:event_aggregator_mgr",
"//third_party/protobuf:protobuf_lite",
]
}
source_set("testing_constants") {
testonly = true
sources = [ "testing_constants.h" ]
deps = [ "$cobalt_root/src/logger:logger_test_utils" ]
public_deps = [
"test_registries:all_report_types_test_registry",
"test_registries:cobalt1.1_test_registry",
"test_registries:mixed_time_zone_test_registry",
"test_registries:per_device_histogram_test_registry",
"test_registries:per_device_numeric_stats_test_registry",
"test_registries:unique_actives_noise_free_test_registry",
"test_registries:unique_actives_test_registry",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
}
source_set("fake_logger") {
testonly = true
sources = [
"fake_logger.cc",
"fake_logger.h",
]
deps = [
":project_context_factory",
"$cobalt_root/src/lib/util:consistent_proto_store",
"$cobalt_root/src/lib/util:posix_file_system",
"$cobalt_root/src/lib/util:status",
"$cobalt_root/src/local_aggregation:cobalt_local_aggregation_proto",
"$cobalt_root/src/logger:logger_interface",
"$cobalt_root/src/registry:project_configs",
"//third_party/googletest:gtest",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
visibility += [ "//src/cobalt/bin/*" ]
}
source_set("logger_test_utils") {
testonly = true
sources = [
"logger_test_utils.cc",
"logger_test_utils.h",
]
deps = [
":encoder",
":fake_logger",
":project_context_factory",
"$cobalt_root/src/lib/util:consistent_proto_store",
"$cobalt_root/src/lib/util:encrypted_message_util",
"$cobalt_root/src/lib/util:posix_file_system",
"$cobalt_root/src/local_aggregation:aggregation_utils",
"$cobalt_root/src/local_aggregation:cobalt_local_aggregation_proto",
"$cobalt_root/src/observation_store",
"$cobalt_root/src/observation_store:observation_store_update_recipient",
"$cobalt_root/src/registry:project_configs",
"$cobalt_root/src/system_data:client_secret",
"//third_party/googletest:gtest",
]
public_configs = [ "$cobalt_root:cobalt_config" ]
visibility += [ "//src/cobalt/bin/*" ]
}
source_set("event_loggers_test") {
testonly = true
sources = [ "event_loggers_test.cc" ]
deps = [ "$cobalt_root/src/system_data:client_secret" ]
public_deps = [
":event_loggers",
":logger_test_utils",
":testing_constants",
"$cobalt_root/src/lib/util/testing:test_with_files",
"$cobalt_root/src/local_aggregation:event_aggregator_mgr",
"$cobalt_root/src/local_aggregation_1.1:local_aggregation",
"$cobalt_root/src/pb:metadata_builder",
"//third_party/googletest:gtest",
"//third_party/protobuf:protobuf_lite",
]
}
source_set("logger_test") {
testonly = true
sources = [ "logger_test.cc" ]
deps = [
"$cobalt_root/src/logger:fake_logger",
"$cobalt_root/src/system_data:client_secret",
]
public_deps = [
":logger",
":logger_test_utils",
":testing_constants",
"$cobalt_root/src/lib/util/testing:test_with_files",
"$cobalt_root/src/local_aggregation:event_aggregator_mgr",
"$cobalt_root/src/pb:metadata_builder",
"//third_party/googletest:gtest",
]
}
source_set("undated_event_manager_test") {
testonly = true
sources = [ "undated_event_manager_test.cc" ]
deps = [
"$cobalt_root/src/logger:fake_logger",
"$cobalt_root/src/system_data:client_secret",
]
public_deps = [
":internal_metrics_config_cc",
":logger_test_utils",
":testing_constants",
":undated_event_manager",
"$cobalt_root/src/lib/util/testing:test_with_files",
"$cobalt_root/src/pb:metadata_builder",
"//third_party/googletest:gtest",
]
}
source_set("encoder_test") {
testonly = true
sources = [ "encoder_test.cc" ]
deps = [ "$cobalt_root/src/logger:project_context_factory" ]
public_deps = [
":encoder",
"$cobalt_root/src/lib/util/testing:test_with_files",
"$cobalt_root/src/local_aggregation:aggregation_utils",
"$cobalt_root/src/system_data:fake_system_data",
"test_registries:encoder_test_registry",
"//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
"//third_party/protobuf:protobuf_lite",
]
}
source_set("project_context_test") {
testonly = true
sources = [ "project_context_test.cc" ]
public_deps = [
":project_context",
"$cobalt_root/src/pb",
"test_registries:empty_test_registry",
"test_registries:multiple_project_context_test_registry_directories",
"test_registries:project_context_test_registry",
"//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
]
}
source_set("project_context_factory_test") {
testonly = true
sources = [ "project_context_factory_test.cc" ]
public_deps = [
":project_context_factory",
"test_registries/project_context_factory_test_registry:a",
"test_registries/project_context_factory_test_registry:b",
"test_registries/project_context_factory_test_registry:c",
"//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
]
}
source_set("internal_metrics_test") {
testonly = true
sources = [ "internal_metrics_test.cc" ]
deps = [ ":fake_logger" ]
public_deps = [
":internal_metrics",
":logger_test_utils",
"$cobalt_root/src/local_aggregation:cobalt_local_aggregation_proto",
"//third_party/abseil-cpp",
"//third_party/googletest:gtest",
"//third_party/tink/cc/util:status",
]
}
source_set("event_vector_index") {
sources = [
"event_vector_index.cc",
"event_vector_index.h",
]
public_deps = [
"$cobalt_root/src/lib/statusor",
"$cobalt_root/src/registry:cobalt_registry_proto",
]
}
source_set("event_vector_index_test") {
testonly = true
sources = [ "event_vector_index_test.cc" ]
public_deps = [
":event_vector_index",
"$cobalt_root/src/registry:cobalt_registry_proto",
"//third_party/googletest:gtest",
]
}
source_set("privacy_encoder") {
sources = [
"privacy_encoder.cc",
"privacy_encoder.h",
]
public_deps = [
":event_vector_index",
"$cobalt_root/src/algorithms/privacy:numeric_encoding",
"$cobalt_root/src/algorithms/privacy:rappor",
"$cobalt_root/src/algorithms/random:random",
"$cobalt_root/src/lib/statusor",
"$cobalt_root/src/pb",
"$cobalt_root/src/registry:buckets_config",
"$cobalt_root/src/registry:cobalt_registry_proto",
]
}
source_set("privacy_encoder_test") {
testonly = true
sources = [ "privacy_encoder_test.cc" ]
deps = [
":privacy_encoder",
"$cobalt_root/src/algorithms/random:test_secure_random",
"$cobalt_root/src/registry:cobalt_registry_proto",
"//third_party/googletest:gtest",
]
}
group("tests") {
testonly = true
deps = [
":encoder_test",
":event_loggers_test",
":event_vector_index_test",
":internal_metrics_test",
":logger_test",
":privacy_encoder_test",
":project_context_factory_test",
":project_context_test",
":undated_event_manager_test",
]
}