Skip to content

Commit

Permalink
build: Update Android.bp for pw_rpc
Browse files Browse the repository at this point in the history
Also update all the dependencies

Change-Id: If64547853ffa89865daa42521ccc406f6089f3e4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/123071
Reviewed-by: Wyatt Hepler <[email protected]>
Commit-Queue: Victor Berchet <[email protected]>
Reviewed-by: Anthony Stange <[email protected]>
  • Loading branch information
Victor Berchet authored and CQ Bot Account committed Dec 9, 2022
1 parent 721e37b commit 5e84749
Show file tree
Hide file tree
Showing 9 changed files with 397 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pw_protobuf/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
43 changes: 43 additions & 0 deletions pw_protobuf/py/Android.bp
Original file line number Diff line number Diff line change
@@ -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",
],
}
32 changes: 32 additions & 0 deletions pw_protobuf_compiler/py/Android.bp
Original file line number Diff line number Diff line change
@@ -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",
],
}
132 changes: 132 additions & 0 deletions pw_rpc/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
46 changes: 46 additions & 0 deletions pw_rpc/nanopb/Android.bp
Original file line number Diff line number Diff line change
@@ -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,
}
32 changes: 32 additions & 0 deletions pw_rpc/py/Android.bp
Original file line number Diff line number Diff line change
@@ -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",
],
}
38 changes: 38 additions & 0 deletions pw_rpc/raw/Android.bp
Original file line number Diff line number Diff line change
@@ -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,
}
24 changes: 24 additions & 0 deletions pw_status/py/Android.bp
Original file line number Diff line number Diff line change
@@ -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",
],
}
Loading

0 comments on commit 5e84749

Please sign in to comment.