| # Copyright 2022 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("//build/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//third_party/cobalt/metrics_registry.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":cache_manager_tests" ] |
| } |
| |
| rustc_binary("bin") { |
| edition = "2024" |
| output_name = "cache_manager" |
| with_unit_tests = true |
| |
| deps = [ |
| ":cache_manager_config_lib", |
| ":component_framework_cache_metrics_registry_rustlib", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:log", |
| ] |
| |
| test_deps = [ |
| "//src/cobalt/bin/testing/fake_cobalt", |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:futures", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| metrics_registry("component_framework_cache_metrics_registry") { |
| # This must match the ID of our Cobalt project as specified in: |
| # //third_party/cobalt_config/projects.yaml |
| project_id = 21 |
| generate_rust = true # Generates a rust target with '_rustlib' appended |
| } |
| |
| fuchsia_component_manifest("cache_manager_component_manifest") { |
| component_name = "cache_manager" |
| manifest = "meta/cache_manager.cml" |
| } |
| |
| fuchsia_structured_config_rust_lib("cache_manager_config_lib") { |
| cm_label = ":cache_manager_component_manifest" |
| } |
| |
| fuchsia_component("cache_manager_component") { |
| cm_label = ":cache_manager_component_manifest" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_structured_config_values("cache_manager_config_values") { |
| cm_label = ":cache_manager_component_manifest" |
| values_source = "config.json5" |
| } |
| |
| fuchsia_package("cache_manager") { |
| deps = [ |
| ":cache_manager_component", |
| ":cache_manager_config_values", |
| ] |
| } |
| |
| fuchsia_structured_config_values("cache_manager_test_config_values") { |
| cm_label = ":cache_manager_component_manifest" |
| values = { |
| cache_clearing_threshold = 95 |
| storage_checking_frequency = 5000 |
| } |
| } |
| |
| fuchsia_unittest_package("cache_manager_tests") { |
| manifest = "meta/cache_manager_tests.cml" |
| deps = [ |
| ":bin_test", |
| ":cache_manager_test_config_values", |
| ] |
| } |