# Copyright 2022 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("//pw_build:pigweed.bzl", "pw_cc_binary", "pw_cc_library", "pw_cc_test") load("//pw_protobuf_compiler:proto.bzl", "pw_proto_library") load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") load("@rules_proto_grpc//js:defs.bzl", "js_proto_library") package(default_visibility = ["//visibility:public"]) licenses(["notice"]) pw_cc_library( name = "config", hdrs = ["public/pw_transfer/internal/config.h"], includes = ["public"], deps = [ "//pw_chrono:system_clock", ], ) pw_cc_library( name = "core", srcs = [ "chunk.cc", "client_context.cc", "context.cc", "public/pw_transfer/internal/chunk.h", "public/pw_transfer/internal/client_context.h", "public/pw_transfer/internal/context.h", "public/pw_transfer/internal/event.h", "public/pw_transfer/internal/server_context.h", "rate_estimate.cc", "server_context.cc", "transfer_thread.cc", ], hdrs = [ "public/pw_transfer/handler.h", "public/pw_transfer/rate_estimate.h", "public/pw_transfer/transfer_thread.h", ], includes = ["public"], deps = [ ":config", ":transfer_pwpb", "//pw_bytes", "//pw_chrono:system_clock", "//pw_containers:intrusive_list", "//pw_log", "//pw_preprocessor", "//pw_protobuf", "//pw_result", "//pw_rpc:client_server", "//pw_rpc:internal_packet_cc.pwpb", "//pw_rpc/raw:client_api", "//pw_rpc/raw:server_api", "//pw_status", "//pw_stream", "//pw_sync:binary_semaphore", "//pw_sync:timed_thread_notification", "//pw_thread:thread_core", "//pw_varint", ], ) pw_cc_library( name = "pw_transfer", srcs = [ "transfer.cc", ], hdrs = [ "public/pw_transfer/transfer.h", ], includes = ["public"], deps = [ ":core", "//pw_assert", "//pw_bytes", "//pw_log", "//pw_result", "//pw_rpc:internal_packet_cc.pwpb", "//pw_rpc/raw:server_api", "//pw_status", "//pw_stream", ], ) pw_cc_library( name = "client", srcs = [ "client.cc", ], hdrs = [ "public/pw_transfer/client.h", ], includes = ["public"], deps = [ ":core", "//pw_assert", "//pw_function", "//pw_log", "//pw_stream", ], ) pw_cc_library( name = "test_helpers", srcs = [ "pw_transfer_private/chunk_testing.h", ], deps = [ ":core", "//pw_containers", ], ) # TODO(pwbug/507): Add the client integration test to the build. filegroup( name = "integration_test", srcs = ["integration_test.cc"], ) pw_cc_test( name = "handler_test", srcs = ["handler_test.cc"], deps = [ ":pw_transfer", "//pw_unit_test", ], ) pw_cc_test( name = "transfer_thread_test", srcs = ["transfer_thread_test.cc"], deps = [ ":pw_transfer", ":test_helpers", "//pw_rpc:thread_testing", "//pw_rpc/raw:client_testing", "//pw_rpc/raw:test_method_context", "//pw_thread:thread", "//pw_unit_test", ], ) pw_cc_test( name = "transfer_test", srcs = ["transfer_test.cc"], deps = [ ":pw_transfer", ":test_helpers", "//pw_rpc:thread_testing", "//pw_rpc/raw:test_method_context", "//pw_thread:thread", "//pw_unit_test", ], ) pw_cc_test( name = "client_test", srcs = ["client_test.cc"], deps = [ ":client", ":test_helpers", "//pw_rpc:thread_testing", "//pw_rpc/raw:client_testing", "//pw_thread:sleep", "//pw_thread:thread", "//pw_unit_test", ], ) pw_cc_binary( name = "test_rpc_server", srcs = ["test_rpc_server.cc"], deps = [ ":pw_transfer", ":test_server_pwpb", "//pw_log", "//pw_rpc/system_server", "//pw_stream:std_file_stream", "//pw_thread:thread", "//pw_work_queue", ], ) proto_library( name = "transfer_proto", srcs = [ "transfer.proto", ], ) pw_proto_library( name = "transfer_pwpb", deps = [":transfer_proto"], ) py_proto_library( name = "transfer_proto_pb2", srcs = ["transfer.proto"], ) js_proto_library( name = "transfer_proto_tspb", protos = [":transfer_proto"], ) proto_library( name = "test_server", srcs = [ "test_server.proto", ], import_prefix = "pw_transfer_test", strip_import_prefix = "//pw_transfer", deps = [ "//pw_protobuf:common_protos", ], ) pw_proto_library( name = "test_server_pwpb", deps = [":test_server"], )