From 1228b0baef2a157b10b467d8b903558107419d20 Mon Sep 17 00:00:00 2001 From: Ronald Braunstein Date: Thu, 25 Jan 2024 21:07:41 -0800 Subject: [PATCH] Add rule for proto file so we can write python to use it. I wrote another tool filter and augment the proto files, but these proto files need to have a python library for that tool. Test: m filter_teams && out/host/linux-x86/bin/filter_teams --filter_teams Change-Id: I6b259ddda2b6c09d55a9c6d445b96e5b77741f09 --- android/team_proto/Android.bp | 14 ++++++++++++++ testing/code_metadata_proto/Android.bp | 20 +++++++++++++++++--- testing/test_spec_proto/Android.bp | 20 +++++++++++++++++--- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/android/team_proto/Android.bp b/android/team_proto/Android.bp index 061e77e03..7e2a4c137 100644 --- a/android/team_proto/Android.bp +++ b/android/team_proto/Android.bp @@ -27,3 +27,17 @@ bootstrap_go_package { "team.pb.go", ], } + +python_library_host { + name: "teams-proto-py", + pkg_path: "teams", + srcs: [ + "team.proto", + ], + libs: [ + "libprotobuf-python", + ], + proto: { + canonical_path_from_root: false, + }, +} diff --git a/testing/code_metadata_proto/Android.bp b/testing/code_metadata_proto/Android.bp index 8fcca1918..f07efffb3 100644 --- a/testing/code_metadata_proto/Android.bp +++ b/testing/code_metadata_proto/Android.bp @@ -20,10 +20,24 @@ bootstrap_go_package { name: "soong-testing-code_metadata_proto", pkgPath: "android/soong/testing/code_metadata_proto", deps: [ - "golang-protobuf-reflect-protoreflect", - "golang-protobuf-runtime-protoimpl", - ], + "golang-protobuf-reflect-protoreflect", + "golang-protobuf-runtime-protoimpl", + ], srcs: [ "code_metadata.pb.go", ], } + +python_library_host { + name: "code-metadata-proto-py", + pkg_path: "code_metadata", + srcs: [ + "code_metadata.proto", + ], + libs: [ + "libprotobuf-python", + ], + proto: { + canonical_path_from_root: false, + }, +} diff --git a/testing/test_spec_proto/Android.bp b/testing/test_spec_proto/Android.bp index 1cac492f1..d5ad70b73 100644 --- a/testing/test_spec_proto/Android.bp +++ b/testing/test_spec_proto/Android.bp @@ -20,10 +20,24 @@ bootstrap_go_package { name: "soong-testing-test_spec_proto", pkgPath: "android/soong/testing/test_spec_proto", deps: [ - "golang-protobuf-reflect-protoreflect", - "golang-protobuf-runtime-protoimpl", - ], + "golang-protobuf-reflect-protoreflect", + "golang-protobuf-runtime-protoimpl", + ], srcs: [ "test_spec.pb.go", ], } + +python_library_host { + name: "test-spec-proto-py", + pkg_path: "test_spec", + srcs: [ + "test_spec.proto", + ], + libs: [ + "libprotobuf-python", + ], + proto: { + canonical_path_from_root: false, + }, +}