| # Copyright 2019 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/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/python/python_host_test.gni") |
| import("//build/sdk/sdk_documentation.gni") |
| import("//sdk/ctf/build/verify_json_schemas.gni") |
| |
| # This list should only contain schemas that are currently exported outside of |
| # the Fuchsia source tree. |
| schemas = [ |
| # "banjo_library.json", |
| "cc_prebuilt_library.json", |
| "cc_source_library.json", |
| "common.json", |
| "dart_library.json", |
| "data.json", |
| "documentation.json", |
| "experimental_python_e2e_test.json", |
| "ffx_tool.json", |
| "fhcp_tests.json", |
| "fidl_library.json", |
| "hardware-f6f47515.json", |
| "host_tool.json", |
| "loadable_module.json", |
| "manifest.json", |
| "sysroot.json", |
| "version_history-22rnd667.json", |
| "virtual_device-93A41932.json", |
| ] |
| |
| sdk_documentation("meta") { |
| name = "metadata_schemas" |
| category = "partner" |
| |
| files = [] |
| foreach(schema, schemas) { |
| files += [ |
| { |
| source = "//build/sdk/meta/$schema" |
| dest = "meta/schemas/$schema" |
| }, |
| ] |
| } |
| } |
| |
| verify_json_schemas("verify_json_schemas") { |
| golden = [] |
| |
| # In the golden directory, there should be one golden file per schema. |
| # Please do not add or remove any schemas without consulting |
| # with sdk-dev@fuchsia.dev . |
| # |
| # If you have approval to make this change, you can fix the build error |
| # by ensuring the golden directory matches the current directory. |
| foreach(schema, schemas) { |
| golden += [ "golden/$schema.golden" ] |
| } |
| |
| current = schemas |
| } |
| |
| if (is_host) { |
| python_host_test("verify_json_schemas_test") { |
| main_source = "//sdk/ctf/build/scripts/verify_json_schemas_test.py" |
| sources = [ "//sdk/ctf/build/scripts/verify_json_schemas.py" ] |
| } |
| } |
| |
| source_set("schemas") { |
| inputs = schemas |
| deps = [ ":verify_json_schemas" ] |
| } |
| |
| if (is_host) { |
| import("//build/rust/rustc_library.gni") |
| |
| rustc_library("rust") { |
| name = "sdk_metadata" |
| |
| with_unit_tests = true |
| |
| edition = "2021" |
| |
| deps = [ |
| "//src/lib/assembly/assembly_manifest", |
| "//src/lib/assembly/partitions_config", |
| "//src/sys/pkg/lib/fuchsia-merkle", |
| "//src/sys/pkg/lib/fuchsia-repo", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:camino", |
| "//third_party/rust_crates:pathdiff", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| "//third_party/rust_crates:url-v1_7_2", |
| "//third_party/rust_crates:valico", |
| "//third_party/rust_crates:zip", |
| ] |
| |
| test_deps = [ |
| "//src/developer/ffx/lib/pkg:empty-repo-keys", |
| "//src/developer/ffx/lib/pkg:empty-repo-metadata", |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:tempfile", |
| ] |
| |
| non_rust_deps = [ ":schemas" ] |
| |
| sources = [ |
| "src/common.rs", |
| "src/ffx_tool.rs", |
| "src/host_tool.rs", |
| "src/json.rs", |
| "src/lib.rs", |
| "src/manifest.rs", |
| "src/product_bundle.rs", |
| "src/product_bundle/v2.rs", |
| "src/testing.rs", |
| "src/virtual_device.rs", |
| "src/virtual_device/manifest.rs", |
| "src/virtual_device/v1.rs", |
| ] |
| |
| inputs = [ |
| "common.json", |
| "ffx_tool.json", |
| "hardware-f6f47515.json", |
| "host_tool.json", |
| "manifest.json", |
| "test_data/virtual_device.json", |
| "test_data/empty_vd_manifest.json", |
| "test_data/single_vd_manifest.json", |
| "test_data/multi_vd_manifest.json", |
| "virtual_device-93A41932.json", |
| ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":rust_test($host_toolchain)", |
| ":verify_json_schemas_test($host_toolchain)", |
| ] |
| } |