diff --git a/pw_protobuf/Android.bp b/pw_protobuf/Android.bp index 9166c2fb37..e5c0f2a577 100644 --- a/pw_protobuf/Android.bp +++ b/pw_protobuf/Android.bp @@ -51,3 +51,26 @@ cc_library_static { "pw_varint", ], } + +genrule { + name: "pw_protobuf_codegen_protos_py", + srcs: ["pw_protobuf_codegen_protos/options.proto"], + cmd: "$(location aprotoc) " + + "-I$$(dirname $(in)) " + + "--python_out=$(genDir) " + + "$(in)", + out: [ + "options_pb2.py", + ], + tools: [ + "aprotoc", + ], +} + +python_library_host { + name: "pw_protobuf_codegen_protos_py_lib", + srcs: [ + ":pw_protobuf_codegen_protos_py", + ], + pkg_path: "pw_protobuf_codegen_protos", +} \ No newline at end of file diff --git a/pw_protobuf/py/Android.bp b/pw_protobuf/py/Android.bp new file mode 100644 index 0000000000..61a72d093d --- /dev/null +++ b/pw_protobuf/py/Android.bp @@ -0,0 +1,43 @@ +// 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"], +} + +python_binary_host { + name: "pw_protobuf_plugin_py", + main: "pw_protobuf/plugin.py", + srcs: [ + "pw_protobuf/plugin.py", + ], + libs: [ + "libprotobuf-python", + "pw_protobuf_plugin_py_lib", + ], +} + +python_library_host { + name: "pw_protobuf_plugin_py_lib", + srcs: [ + "pw_protobuf/*.py", + ], + exclude_srcs: [ + "pw_protobuf/plugin.py", + ], + libs: [ + "libprotobuf-python", + "pw_protobuf_codegen_protos_py_lib", + ], +} diff --git a/pw_protobuf_compiler/py/Android.bp b/pw_protobuf_compiler/py/Android.bp new file mode 100644 index 0000000000..d51246ac7d --- /dev/null +++ b/pw_protobuf_compiler/py/Android.bp @@ -0,0 +1,32 @@ +// 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"], +} + +python_library_host { + name: "pw_protobuf_compiler_py_lib", + srcs: [ + "pw_protobuf_compiler/*.py", + ], +} + +python_binary_host { + name: "pw_protobuf_compiler_py", + main: "pw_protobuf_compiler/generate_protos.py", + srcs: [ + "pw_protobuf_compiler/generate_protos.py", + ], +} \ No newline at end of file diff --git a/pw_rpc/Android.bp b/pw_rpc/Android.bp index 2874ee5f33..52f2d1ea04 100644 --- a/pw_rpc/Android.bp +++ b/pw_rpc/Android.bp @@ -54,3 +54,135 @@ java_library_static { srcs: ["echo.proto"], sdk_version: "current", } + +cc_library_static { + name: "pw_rpc", + cpp_std: "c++2a", + vendor_available: true, + export_include_dirs: [ + "public", + ], + 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_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_span_headers", + "pw_sync_baremetal_headers", + "pw_sync_headers", + ], + 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: [ + "call.cc", + "channel.cc", + "channel_list.cc", + "client.cc", + "client_call.cc", + "endpoint.cc", + "packet.cc", + "packet_meta.cc", + "server.cc", + "server_call.cc", + "service.cc", + ], + cflags: [ + "-DPW_RPC_USE_GLOBAL_MUTEX=0", + "-DPW_RPC_CLIENT_STREAM_END_CALLBACK", + "-DPW_RPC_DYNAMIC_ALLOCATION", + ], + host_supported: 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", + ], +} + +python_library_host { + name: "pw_rpc_internal_packet_py_lib", + srcs: [ + ":pw_rpc_internal_packet_py", + ], + pkg_path: "pw_rpc/internal", +} diff --git a/pw_rpc/nanopb/Android.bp b/pw_rpc/nanopb/Android.bp new file mode 100644 index 0000000000..46e6b3e078 --- /dev/null +++ b/pw_rpc/nanopb/Android.bp @@ -0,0 +1,46 @@ +// 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"], +} + +cc_library_static { + name: "pw_rpc_nanopb", + cpp_std: "c++2a", + vendor_available: true, + export_include_dirs: [ + "public", + ], + static_libs: [ + "libprotobuf-c-nano", + "pw_rpc_raw", + "pw_rpc", + ], + export_static_lib_headers: [ + "pw_rpc_raw", + "pw_rpc", + ], + srcs: [ + "common.cc", + "method.cc", + "server_reader_writer.cc", + ], + cflags: [ + "-DPW_RPC_USE_GLOBAL_MUTEX=0", + "-DPW_RPC_CLIENT_STREAM_END_CALLBACK", + "-DPW_RPC_DYNAMIC_ALLOCATION", + ], + host_supported: true, +} \ No newline at end of file diff --git a/pw_rpc/py/Android.bp b/pw_rpc/py/Android.bp new file mode 100644 index 0000000000..bbfb47d72b --- /dev/null +++ b/pw_rpc/py/Android.bp @@ -0,0 +1,32 @@ +// 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"], +} + +python_binary_host { + name: "pw_rpc_plugin_nanopb_py", + main: "pw_rpc/plugin_nanopb.py", + srcs: [ + "pw_rpc/**/*.py", + ], + libs: [ + "libprotobuf-python", + "pw_protobuf_compiler_py_lib", + "pw_protobuf_plugin_py_lib", + "pw_rpc_internal_packet_py_lib", + "pw_status_py_lib", + ], +} \ No newline at end of file diff --git a/pw_rpc/raw/Android.bp b/pw_rpc/raw/Android.bp new file mode 100644 index 0000000000..df98c84773 --- /dev/null +++ b/pw_rpc/raw/Android.bp @@ -0,0 +1,38 @@ +// 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"], +} + +cc_library_static { + name: "pw_rpc_raw", + cpp_std: "c++2a", + vendor_available: true, + export_include_dirs: [ + "public", + ], + static_libs: [ + "pw_rpc", + ], + srcs: [ + "method.cc", + ], + cflags: [ + "-DPW_RPC_USE_GLOBAL_MUTEX=0", + "-DPW_RPC_CLIENT_STREAM_END_CALLBACK", + "-DPW_RPC_DYNAMIC_ALLOCATION", + ], + host_supported: true, +} \ No newline at end of file diff --git a/pw_status/py/Android.bp b/pw_status/py/Android.bp new file mode 100644 index 0000000000..074586278c --- /dev/null +++ b/pw_status/py/Android.bp @@ -0,0 +1,24 @@ +// 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"], +} + +python_library_host { + name: "pw_status_py_lib", + srcs: [ + "pw_status/*.py", + ], +} diff --git a/pw_toolchain/Android.bp b/pw_toolchain/Android.bp new file mode 100644 index 0000000000..4ba2e5888f --- /dev/null +++ b/pw_toolchain/Android.bp @@ -0,0 +1,27 @@ +// 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"], +} + +cc_library_headers { + name: "pw_toolchain", + cpp_std: "c++2a", + vendor_available: true, + export_include_dirs: [ + "public", + ], + host_supported: true, +} \ No newline at end of file