mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-09-20 05:41:06 +00:00
a9133b059e
Renames the backend header to match the object name. Adjusts the FinalizeUpdate() API to use Status again to report finalize failures before the reboot. Also changes ApplyTargetFile() to be pure virtual. Changes the backend API to use the Manifest object instead of the nanopb struct for the manifest. Moves the Manifest definition to a separate header. Adds missing pw_protobuf dependency. Change-Id: I295db6021b26d8ba96512f4627e39b5a76d92815 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/61820 Commit-Queue: Ewout van Bekkum <ewout@google.com> Reviewed-by: David Rogers <davidrogers@google.com> Reviewed-by: Keir Mierle <keir@google.com>
129 lines
3.3 KiB
Plaintext
129 lines
3.3 KiB
Plaintext
# 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_doc_group("docs") {
|
|
sources = [ "docs.rst" ]
|
|
}
|
|
|
|
pw_source_set("update_bundle") {
|
|
public_configs = [ ":public_include_path" ]
|
|
public_deps = [
|
|
dir_pw_blob_store,
|
|
dir_pw_kvs,
|
|
dir_pw_protobuf,
|
|
dir_pw_status,
|
|
dir_pw_stream,
|
|
]
|
|
public = [
|
|
"public/pw_software_update/bundled_update_backend.h",
|
|
"public/pw_software_update/config.h",
|
|
"public/pw_software_update/manifest.h",
|
|
"public/pw_software_update/update_bundle.h",
|
|
]
|
|
deps = [
|
|
":protos.pwpb",
|
|
dir_pw_log,
|
|
]
|
|
sources = [ "update_bundle.cc" ]
|
|
}
|
|
|
|
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",
|
|
]
|
|
}
|
|
} else {
|
|
group("rpc_service") {
|
|
}
|
|
}
|
|
|
|
pw_python_action("generate_test_bundle") {
|
|
header_output = "$target_gen_dir/$target_name/test_bundles.h"
|
|
script = "py/pw_software_update/generate_test_bundle.py"
|
|
python_deps = [
|
|
":protos.python",
|
|
"py",
|
|
]
|
|
outputs = [ header_output ]
|
|
args = [ rebase_path(header_output) ]
|
|
}
|
|
|
|
config("generated_test_bundle_include") {
|
|
_generated_outputs = get_target_outputs(":generate_test_bundle")
|
|
include_dirs = [ get_path_info(_generated_outputs[0], "dir") ]
|
|
}
|
|
|
|
pw_test("update_bundle_test") {
|
|
enable_if =
|
|
dir_pw_third_party_nanopb != "" && dir_pw_third_party_protobuf != ""
|
|
sources = [ "update_bundle_test.cc" ]
|
|
public_deps = [
|
|
":generate_test_bundle",
|
|
":rpc_service",
|
|
":update_bundle",
|
|
"$dir_pw_kvs:fake_flash",
|
|
"$dir_pw_kvs:fake_flash_test_key_value_store",
|
|
]
|
|
configs = [ ":generated_test_bundle_include" ]
|
|
}
|
|
|
|
pw_test_group("tests") {
|
|
tests = [ ":update_bundle_test" ]
|
|
}
|