blob: 6f431d7fb7fb6646fdc1fcb838fa42e3fec3f15f [file] [log] [blame]
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_protobuf_compiler/proto.gni")
import("$dir_pw_third_party/protobuf/protobuf.gni")
import("$dir_pw_unit_test/test.gni")
config("public_include_path") {
include_dirs = [ "public" ]
visibility = [ ":*" ]
}
if (dir_pw_third_party_protobuf != "") {
pw_proto_library("protos") {
deps = [
"$dir_pw_protobuf:common_protos",
"$dir_pw_third_party/protobuf:wellknown_types",
]
sources = [
"service.proto",
"tuf.proto",
"update_bundle.proto",
]
prefix = "pw_software_update"
python_package = "py"
}
} else {
# placeholder target to allow py package to build
pw_proto_library("protos") {
deps = [ "$dir_pw_protobuf:common_protos" ]
sources = [
"service.proto",
"tuf.proto",
"update_bundle.proto",
]
prefix = "pw_software_update"
python_package = "py"
}
}
pw_test_group("tests") {
tests = [ ":update_bundle_test" ]
}
pw_doc_group("docs") {
sources = [ "docs.rst" ]
}
if (dir_pw_third_party_nanopb != "" && dir_pw_third_party_protobuf != "") {
pw_source_set("rpc_service") {
public_configs = [ ":public_include_path" ]
public_deps = [ ":protos.nanopb_rpc" ]
deps = [ dir_pw_log ]
sources = [
"public/pw_software_update/service.h",
"service.cc",
]
}
pw_source_set("update_backend") {
public_configs = [ ":public_include_path" ]
public_deps = [
":protos.nanopb",
dir_pw_status,
]
sources = [ "public/pw_software_update/update_backend.h" ]
}
pw_source_set("update_bundle") {
public_configs = [ ":public_include_path" ]
public_deps = [
":update_backend",
dir_pw_blob_store,
dir_pw_kvs,
]
deps = [ dir_pw_log ]
public = [
"public/pw_software_update/config.h",
"public/pw_software_update/update_bundle.h",
]
}
} else {
group("rpc_service") {
}
group("update_bundle") {
}
}
pw_test("update_bundle_test") {
enable_if =
dir_pw_third_party_nanopb != "" && dir_pw_third_party_protobuf != ""
sources = [ "update_bundle_test.cc" ]
public_deps = [
":rpc_service",
":update_bundle",
"$dir_pw_kvs:fake_flash",
"$dir_pw_kvs:fake_flash_test_key_value_store",
]
}