280 lines
7.4 KiB
Plaintext
280 lines
7.4 KiB
Plaintext
// 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.
|
|
|
|
package {
|
|
default_applicable_licenses: ["external_pigweed_license"],
|
|
}
|
|
|
|
java_library {
|
|
name: "pw_rpc_java_client",
|
|
srcs: ["java/main/dev/pigweed/pw_rpc/*.java"],
|
|
visibility: ["//visibility:public"],
|
|
static_libs: [
|
|
"pw_log_android_java",
|
|
"pw_rpc_packet_proto_java_lite",
|
|
],
|
|
libs: [
|
|
"auto_value_annotations",
|
|
"guava",
|
|
"jsr305",
|
|
"libprotobuf-java-lite",
|
|
],
|
|
plugins: ["auto_value_plugin"],
|
|
sdk_version: "current",
|
|
}
|
|
|
|
java_library_static {
|
|
name: "pw_rpc_packet_proto_java_lite",
|
|
host_supported: true,
|
|
proto: {
|
|
type: "lite",
|
|
},
|
|
srcs: ["internal/packet.proto"],
|
|
sdk_version: "current",
|
|
}
|
|
|
|
java_library_static {
|
|
name: "pw_rpc_echo_proto_java_lite",
|
|
visibility: ["//visibility:public"],
|
|
host_supported: true,
|
|
proto: {
|
|
type: "lite",
|
|
},
|
|
srcs: ["echo.proto"],
|
|
sdk_version: "current",
|
|
}
|
|
|
|
filegroup {
|
|
name: "pw_rpc_src_files",
|
|
srcs: [
|
|
"call.cc",
|
|
"channel.cc",
|
|
"channel_list.cc",
|
|
"client.cc",
|
|
"client_call.cc",
|
|
"client_server.cc",
|
|
"endpoint.cc",
|
|
"packet.cc",
|
|
"packet_meta.cc",
|
|
"server.cc",
|
|
"server_call.cc",
|
|
"service.cc",
|
|
],
|
|
}
|
|
|
|
cc_library_headers {
|
|
name: "pw_rpc_include_dirs",
|
|
export_include_dirs: [
|
|
"public",
|
|
],
|
|
vendor_available: true,
|
|
host_supported: true,
|
|
}
|
|
|
|
// This rule must be instantiated, i.e.
|
|
//
|
|
// cc_library_static {
|
|
// name: "pw_rpc_<instance_name>",
|
|
// defaults: [
|
|
// "pw_rpc_cflags_<instance_name>",
|
|
// "pw_rpc_defaults",
|
|
// ],
|
|
// }
|
|
//
|
|
// where pw_rpc_cflags_<instance_name> defines your flags, i.e.
|
|
//
|
|
// cc_defaults {
|
|
// name: "pw_rpc_cflags_<instance_name>",
|
|
// cflags: [
|
|
// "-DPW_RPC_USE_GLOBAL_MUTEX=0",
|
|
// "-DPW_RPC_CLIENT_STREAM_END_CALLBACK",
|
|
// "-DPW_RPC_DYNAMIC_ALLOCATION",
|
|
// ],
|
|
// }
|
|
//
|
|
// see pw_rpc_nanopb_defaults, pw_rpc_raw_defaults
|
|
cc_defaults {
|
|
name: "pw_rpc_defaults",
|
|
cpp_std: "c++2a",
|
|
header_libs: [
|
|
"fuschia_sdk_lib_fit",
|
|
"fuschia_sdk_lib_stdcompat",
|
|
"pw_assert_headers",
|
|
"pw_assert_log_headers",
|
|
"pw_function_headers",
|
|
"pw_log_headers",
|
|
"pw_log_null_headers",
|
|
"pw_polyfill_headers",
|
|
"pw_preprocessor_headers",
|
|
"pw_result_headers",
|
|
"pw_rpc_include_dirs",
|
|
"pw_span_headers",
|
|
"pw_sync_baremetal_headers",
|
|
"pw_sync_headers",
|
|
"pw_toolchain",
|
|
],
|
|
export_header_lib_headers: [
|
|
"fuschia_sdk_lib_fit",
|
|
"fuschia_sdk_lib_stdcompat",
|
|
"pw_assert_headers",
|
|
"pw_assert_log_headers",
|
|
"pw_function_headers",
|
|
"pw_log_headers",
|
|
"pw_log_null_headers",
|
|
"pw_polyfill_headers",
|
|
"pw_preprocessor_headers",
|
|
"pw_result_headers",
|
|
"pw_rpc_include_dirs",
|
|
"pw_span_headers",
|
|
"pw_sync_baremetal_headers",
|
|
"pw_sync_headers",
|
|
"pw_toolchain",
|
|
],
|
|
static_libs: [
|
|
"pw_bytes",
|
|
"pw_containers",
|
|
"pw_protobuf",
|
|
"pw_status",
|
|
"pw_stream",
|
|
"pw_string",
|
|
"pw_varint",
|
|
],
|
|
export_static_lib_headers: [
|
|
"pw_bytes",
|
|
"pw_containers",
|
|
"pw_protobuf",
|
|
"pw_status",
|
|
"pw_stream",
|
|
"pw_string",
|
|
"pw_varint",
|
|
],
|
|
generated_headers: [
|
|
"pw_rpc_internal_packet_pwpb_h",
|
|
],
|
|
export_generated_headers: [
|
|
"pw_rpc_internal_packet_pwpb_h",
|
|
],
|
|
srcs: [
|
|
":pw_rpc_src_files"
|
|
],
|
|
host_supported: true,
|
|
vendor_available: true,
|
|
}
|
|
|
|
genrule {
|
|
name: "pw_rpc_internal_packet_pwpb_h",
|
|
srcs: ["internal/packet.proto"],
|
|
cmd: "python3 $(location pw_protobuf_compiler_py) " +
|
|
"--out-dir=$$(dirname $(location pw_rpc/internal/packet.pwpb.h)) " +
|
|
"--plugin-path=$(location pw_protobuf_plugin_py) " +
|
|
"--compile-dir=$$(dirname $(in)) " +
|
|
"--sources $(in) " +
|
|
"--language pwpb " +
|
|
"--no-experimental-proto3-optional " +
|
|
"--protoc=$(location aprotoc) ",
|
|
out: [
|
|
"pw_rpc/internal/packet.pwpb.h",
|
|
],
|
|
tools: [
|
|
"aprotoc",
|
|
"pw_protobuf_plugin_py",
|
|
"pw_protobuf_compiler_py",
|
|
],
|
|
}
|
|
|
|
genrule {
|
|
name: "pw_rpc_internal_packet_py",
|
|
srcs: ["internal/packet.proto"],
|
|
cmd: "python3 $(location pw_protobuf_compiler_py) " +
|
|
"--out-dir=$(genDir) " +
|
|
"--compile-dir=$$(dirname $(in)) " +
|
|
"--sources $(in) " +
|
|
"--language python " +
|
|
"--no-generate-type-hints " +
|
|
"--no-experimental-proto3-optional " +
|
|
"--protoc=$(location aprotoc)",
|
|
out: [
|
|
"packet_pb2.py",
|
|
],
|
|
tools: [
|
|
"aprotoc",
|
|
"pw_protobuf_compiler_py",
|
|
],
|
|
}
|
|
|
|
// Generate cc and header nanopb files.
|
|
// The output file names are based on the srcs file name with a .pb.c / .pb.h extension.
|
|
genrule_defaults {
|
|
name: "pw_rpc_generate_nanopb_proto",
|
|
cmd: "python3 $(location pw_protobuf_compiler_py) " +
|
|
"--plugin-path=$(location protoc-gen-nanopb) " +
|
|
"--out-dir=$(genDir) " +
|
|
"--compile-dir=$$(dirname $(in)) " +
|
|
"--language nanopb " +
|
|
"--sources $(in) " +
|
|
"--no-experimental-proto3-optional " +
|
|
"--protoc=$(location aprotoc)",
|
|
tools: [
|
|
"aprotoc",
|
|
"protoc-gen-nanopb",
|
|
"pw_protobuf_compiler_py",
|
|
],
|
|
}
|
|
|
|
// Generate the header nanopb RPC file.
|
|
// The output file name is based on the srcs file name with a .rpc.pb.h extension.
|
|
genrule_defaults {
|
|
name: "pw_rpc_generate_nanopb_rpc_header",
|
|
cmd: "python3 $(location pw_protobuf_compiler_py) " +
|
|
"--plugin-path=$(location pw_rpc_plugin_nanopb_py) " +
|
|
"--out-dir=$(genDir) " +
|
|
"--compile-dir=$$(dirname $(in)) " +
|
|
"--language nanopb_rpc " +
|
|
"--sources $(in) " +
|
|
"--no-experimental-proto3-optional " +
|
|
"--protoc=$(location aprotoc)",
|
|
tools: [
|
|
"aprotoc",
|
|
"pw_protobuf_compiler_py",
|
|
"pw_rpc_plugin_nanopb_py",
|
|
],
|
|
}
|
|
|
|
// Generate the header raw RPC file.
|
|
// The output file name is based on the srcs file name with a .raw_rpc.pb.h extension.
|
|
genrule_defaults {
|
|
name: "pw_rpc_generate_raw_rpc_header",
|
|
cmd: "python3 $(location pw_protobuf_compiler_py) " +
|
|
"--plugin-path=$(location pw_rpc_plugin_rawpb_py) " +
|
|
"--out-dir=$(genDir) " +
|
|
"--compile-dir=$$(dirname $(in)) " +
|
|
"--language raw_rpc " +
|
|
"--sources $(in) " +
|
|
"--no-experimental-proto3-optional " +
|
|
"--protoc=$(location aprotoc)",
|
|
tools: [
|
|
"aprotoc",
|
|
"pw_protobuf_compiler_py",
|
|
"pw_rpc_plugin_rawpb_py",
|
|
],
|
|
}
|
|
|
|
python_library_host {
|
|
name: "pw_rpc_internal_packet_py_lib",
|
|
srcs: [
|
|
":pw_rpc_internal_packet_py",
|
|
],
|
|
pkg_path: "pw_rpc/internal",
|
|
}
|