1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package { 18 default_applicable_licenses: ["Android-Apache-2.0"], 19} 20 21genrule { 22 name: "TracingVMProtoStub_h", 23 tools: [ 24 "aprotoc", 25 "protoc-gen-grpc-cpp-plugin", 26 ], 27 cmd: "$(location aprotoc) -I$$(dirname $(location TracingVM.proto)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location TracingVM.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)", 28 srcs: [ 29 "TracingVM.proto", 30 "perfetto_trace.proto", 31 ], 32 out: [ 33 "TracingVM.pb.h", 34 "TracingVM.grpc.pb.h", 35 ], 36} 37 38genrule { 39 name: "TracingVMProtoStub_cc", 40 tools: [ 41 "aprotoc", 42 "protoc-gen-grpc-cpp-plugin", 43 ], 44 cmd: "$(location aprotoc) -I$$(dirname $(location TracingVM.proto)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location TracingVM.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)", 45 srcs: [ 46 "TracingVM.proto", 47 "perfetto_trace.proto", 48 ], 49 out: [ 50 "TracingVM.pb.cc", 51 "TracingVM.grpc.pb.cc", 52 ], 53} 54 55genrule { 56 name: "perfetto_trace_gen_h", 57 tools: [ 58 "aprotoc", 59 "protoc-gen-grpc-cpp-plugin", 60 ], 61 cmd: "$(location aprotoc) -I$$(dirname $(in)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 62 srcs: [ 63 "perfetto_trace.proto", 64 ], 65 out: [ 66 "perfetto_trace.pb.h", 67 ], 68} 69 70 71genrule { 72 name: "perfetto_trace_gen_cc", 73 tools: [ 74 "aprotoc", 75 "protoc-gen-grpc-cpp-plugin", 76 ], 77 cmd: "$(location aprotoc) -I$$(dirname $(in)) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 78 srcs: [ 79 "perfetto_trace.proto", 80 ], 81 out: [ 82 "perfetto_trace.pb.cc", 83 ], 84} 85 86cc_library_static { 87 name: "tracing_vm_protos", 88 vendor: true, 89 srcs: [ 90 ":TracingVMProtoStub_cc", 91 ":perfetto_trace_gen_cc", 92 ], 93 host_supported: true, 94 generated_headers: [ 95 "TracingVMProtoStub_h", 96 "perfetto_trace_gen_h", 97 ], 98 export_generated_headers: [ 99 "TracingVMProtoStub_h", 100 "perfetto_trace_gen_h", 101 ], 102 shared_libs: [ 103 "libgrpc++", 104 "libprotobuf-cpp-lite", 105 ], 106 cflags: [ 107 "-O2", 108 "-Wno-error=return-type", 109 "-Wno-sign-compare", 110 "-Wno-sign-promo", 111 "-Wno-unused-parameter", 112 "-fvisibility=hidden", 113 "-DGOOGLE_PROTOBUF_NO_RTTI", 114 "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", 115 ], 116}