| # 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("//build/components.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/testing/environments.gni") |
| import("//src/sys/pkg/bin/grand-swd-binary/gsb.gni") |
| |
| rustc_library("lib") { |
| name = "pkg_cache" |
| with_unit_tests = true |
| edition = "2021" |
| |
| deps = [ |
| ":config_lib", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg_rust", |
| "//sdk/fidl/fuchsia.space:fuchsia.space_rust", |
| "//sdk/fidl/fuchsia.update:fuchsia.update_rust", |
| "//src/lib/cobalt/rust/builders", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fidl/rust/fidl-contrib", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/lib/fidl-fuchsia-pkg-ext", |
| "//src/sys/pkg/lib/blobfs", |
| "//src/sys/pkg/lib/fuchsia-hash", |
| "//src/sys/pkg/lib/fuchsia-merkle", |
| "//src/sys/pkg/lib/fuchsia-pkg", |
| "//src/sys/pkg/lib/metrics:cobalt_sw_delivery_registry_rustlib", |
| "//src/sys/pkg/lib/package-directory", |
| "//src/sys/pkg/lib/system-image", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-lock", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-url", |
| "//src/sys/pkg/lib/far/rust:fuchsia-archive", |
| "//src/sys/pkg/lib/fuchsia-pkg-testing", |
| "//src/sys/pkg/testing/blobfs-ramdisk", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:proptest", |
| "//third_party/rust_crates:proptest-derive", |
| ] |
| |
| source_root = "src/main.rs" |
| sources = [ |
| "src/base_packages.rs", |
| "src/cache_service.rs", |
| "src/cache_service/missing_blobs.rs", |
| "src/compat.rs", |
| "src/compat/pkgfs.rs", |
| "src/compat/pkgfs/packages.rs", |
| "src/compat/pkgfs/packages/variants.rs", |
| "src/compat/pkgfs/validation.rs", |
| "src/compat/pkgfs/versions.rs", |
| "src/gc_service.rs", |
| "src/index.rs", |
| "src/index/dynamic.rs", |
| "src/index/package.rs", |
| "src/index/retained.rs", |
| "src/main.rs", |
| "src/retained_packages_service.rs", |
| "src/test_utils.rs", |
| ] |
| |
| visibility = [ |
| ":*", |
| "//src/sys/pkg/bin/grand-swd-binary:*", |
| ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "pkg-cache" |
| manifest = "meta/pkg-cache.cml" |
| } |
| |
| fuchsia_structured_config_rust_lib("config_lib") { |
| cm_label = ":manifest" |
| name = "pkg_cache_config" |
| visibility = [ ":*" ] |
| } |
| |
| fuchsia_structured_config_values("config_values_from_gn") { |
| cm_label = ":manifest" |
| values = { |
| use_system_image = true |
| } |
| } |
| |
| fuchsia_structured_config_values("config_values_from_gn-ignore-system-image") { |
| cm_label = ":manifest" |
| values = { |
| use_system_image = false |
| } |
| } |
| |
| grand_swd_binary("bin") { |
| output_name = "pkg_cache" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| group("production-component-and-config") { |
| public_deps = [ |
| ":component", |
| ":config_values_from_gn", |
| ] |
| } |
| |
| group("ignore-system-image-component-and-config") { |
| public_deps = [ |
| ":component", |
| ":config_values_from_gn-ignore-system-image", |
| ] |
| } |
| |
| fuchsia_package("pkg-cache") { |
| deps = [ ":production-component-and-config" ] |
| } |
| |
| fuchsia_component("pkg-cache-test") { |
| testonly = true |
| manifest = "meta/pkg-cache-bin-test.cml" |
| deps = [ |
| ":lib_test", |
| "//src/sys/pkg/bin/pm:pm_bin", |
| ] |
| } |
| |
| fuchsia_test_package("pkg-cache-tests") { |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| test_components = [ ":pkg-cache-test" ] |
| deps = [ |
| "//src/storage/bin/blobfs", |
| "//src/storage/testing:storage_driver_test_realm", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ ":pkg-cache-tests" ] |
| } |
| |
| # If the file in this resource is included in the system_image package, then pkg-cache will *not* |
| # enforce executability restrictions. |
| resource("disable-executability-restrictions-resource") { |
| sources = [ "disable_executability_restrictions" ] |
| outputs = [ "data/pkgfs_disable_executability_restrictions" ] |
| visibility = [ ":*" ] |
| } |
| |
| fuchsia_system_package("disable-executability-restrictions") { |
| deps = [ |
| ":disable-executability-restrictions-resource", |
| "//build/validate:non_production_tag", |
| ] |
| visibility = [ "//src/sys/pkg:*" ] |
| } |