# 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. load("@com_google_protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library") load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_python//python:proto.bzl", "py_proto_library") load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") load("//pw_build:compatibility.bzl", "incompatible_with_mcu") load("//pw_protobuf_compiler:pw_proto_library.bzl", "pwpb_proto_library") load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") package(default_visibility = ["//visibility:public"]) licenses(["notice"]) proto_library( name = "tuf_proto", srcs = [ "tuf.proto", ], deps = [ "@com_google_protobuf//:timestamp_proto", ], ) proto_library( name = "update_bundle_proto", srcs = [ "update_bundle.proto", ], deps = [ ":tuf_proto", ], ) pwpb_proto_library( name = "update_bundle_proto_pwpb", deps = [":update_bundle_proto"], ) py_proto_library( name = "update_bundle_py_pb2", deps = [":update_bundle_proto"], ) java_lite_proto_library( name = "update_bundle_java_proto_lite", deps = [":update_bundle_proto"], ) proto_library( name = "bundled_update_proto", srcs = [ "bundled_update.proto", ], deps = [ "//pw_protobuf:common_proto", "//pw_tokenizer:tokenizer_proto", "@com_google_protobuf//:any_proto", ], ) py_proto_library( name = "bundled_update_py_pb2", deps = [":bundled_update_proto"], ) java_lite_proto_library( name = "bundled_update_java_proto_lite", deps = [":bundled_update_proto"], ) # TODO: b/258074401 - Depends on the `any` proto, which doesn't build under # nanopb. # pw_proto_library( # name = "bundled_update_proto_cc", # # TODO: b/258074760 - Adding this tag breaks the pw_proto_library rule. # tags = ["manual"], # deps = [":bundled_update_proto"], # ) cc_library( name = "openable_reader", hdrs = [ "public/pw_software_update/openable_reader.h", ], strip_include_prefix = "public", deps = [ "//pw_stream", ], ) cc_library( name = "blob_store_openable_reader", hdrs = [ "public/pw_software_update/blob_store_openable_reader.h", ], strip_include_prefix = "public", deps = [ ":openable_reader", "//pw_blob_store", ], ) cc_library( name = "update_bundle", srcs = [ "manifest_accessor.cc", "update_bundle_accessor.cc", ], hdrs = [ "public/pw_software_update/bundled_update_backend.h", "public/pw_software_update/config.h", "public/pw_software_update/manifest_accessor.h", "public/pw_software_update/update_bundle_accessor.h", ], strip_include_prefix = "public", tags = ["manual"], # TODO: b/236321905 - Depends on pw_crypto. deps = [ ":blob_store_openable_reader", ":config_override", ":openable_reader", ":update_bundle_proto_pwpb", "//pw_blob_store", "//pw_crypto:ecdsa.facade", "//pw_crypto:sha256.facade", "//pw_kvs", "//pw_log", "//pw_protobuf", "//pw_status", "//pw_stream", "//pw_string", ], ) label_flag( name = "config_override", build_setting_default = "//pw_build:default_module_config", ) # TODO: b/258074401 - Depends on bundled_update_proto_cc.nanopb_rpc, which # doesn't build yet. cc_library( name = "bundled_update_service", srcs = ["bundled_update_service.cc"], hdrs = ["public/pw_software_update/bundled_update_service.h"], strip_include_prefix = "public", tags = ["manual"], deps = [ # ":bundled_update_proto_cc.nanopb_rpc", # ":bundled_update_proto_cc.pwpb", ":update_bundle", # ":update_bundle_proto_cc.nanopb_rpc", # ":update_bundle_proto_cc.pwpb", "//pw_log", "//pw_result", "//pw_status", "//pw_sync:borrow", "//pw_sync:lock_annotations", "//pw_sync:mutex", "//pw_tokenizer", "//pw_work_queue", ], ) # TODO: b/258074401 - Depends on bundled_update_proto_cc.nanopb_rpc, which # doesn't build yet. cc_library( name = "bundled_update_service_pwpb", srcs = ["bundled_update_service_pwpb.cc"], hdrs = ["public/pw_software_update/bundled_update_service_pwpb.h"], strip_include_prefix = "public", tags = ["manual"], deps = [ # ":bundled_update_proto_cc.pwpb", # ":bundled_update_proto_cc.pwpb_rpc", ":update_bundle", # ":update_bundle_proto_cc.pwpb", # ":update_bundle_proto_cc.pwpb_rpc", "//pw_log", "//pw_result", "//pw_status", "//pw_string:util", "//pw_sync:borrow", "//pw_sync:lock_annotations", "//pw_sync:mutex", "//pw_tokenizer", "//pw_work_queue", ], ) # TODO: b/258222107 - pw_python_action doesn't exist yet. # pw_python_action( # name = "generate_test_bundle", # outputs = ["$target_gen_dir/generate_test_bundle/test_bundles.h"], # script = "py/pw_software_update/generate_test_bundle.py", # deps = [ # ":bundled_update_py_pb2", # "py", # ], # args = [ "$target_gen_dir/generate_test_bundle/test_bundles.h" ], # ) pw_cc_test( name = "update_bundle_test", srcs = ["update_bundle_test.cc"], tags = ["manual"], deps = [ # This dependency is needed, but doesn't exist yet. # "generate_test_bundle", ":update_bundle", "//pw_kvs:fake_flash_test_key_value_store", ], ) pw_cc_test( name = "bundled_update_service_test", srcs = ["bundled_update_service_test.cc"], tags = ["manual"], # bundled_update_service doesn't work yet. deps = [":bundled_update_service"], ) pw_cc_test( name = "bundled_update_service_pwpb_test", srcs = ["bundled_update_service_pwpb_test.cc"], tags = ["manual"], # bundled_update_service_pwpb doesn't work yet. deps = [":bundled_update_service_pwpb"], ) sphinx_docs_library( name = "docs", srcs = [ "cli.rst", "design.rst", "docs.rst", "get_started.rst", "guides.rst", ], prefix = "pw_software_update/", target_compatible_with = incompatible_with_mcu(), )