1/* 2 * Copyright (C) 2020 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 17// Proto Targets for the Audio Test Harness System. 18// These protos are used on both the host and device side and thus are 19// included in both lite and full variants. 20// DEFINITIONS ============================================================== 21 22package { 23 default_applicable_licenses: ["Android-Apache-2.0"], 24} 25 26PROTO_TOOLS = [ 27 "aprotoc", 28 "protoc-gen-grpc-java-plugin", 29 "soong_zip", 30] 31FULL_PROTO_CMD = "mkdir -p $(genDir)/gen && " + 32 "$(location aprotoc) -Iplatform_testing/libraries -Iexternal/protobuf/src " + 33 "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) --grpc-java_out=$(genDir)/gen $(in) && " + 34 "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen" 35LITE_PROTO_CMD = "mkdir -p $(genDir)/gen && " + 36 "$(location aprotoc) --java_opt=annotate_code=false -Iplatform_testing/libraries -Iexternal/protobuf/src " + 37 "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) --grpc-java_out=lite:$(genDir)/gen $(in) && " + 38 "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen" 39 40// PROTO SOURCE ============================================================== 41 42// Common protos shared between the server and client libraries as model classes. 43filegroup { 44 name: "audiotestharness-commonproto", 45 srcs: [ 46 "audio_device.proto", 47 "audio_format.proto", 48 ], 49} 50 51// The protos for the Audio Test Harness service definition. 52filegroup { 53 name: "audiotestharness-serviceproto", 54 srcs: [ 55 "audio_test_harness_service.proto", 56 ], 57} 58 59// GRPC GENERATED ============================================================== 60 61// The generated gRPC Stub based on the above service definition. 62genrule { 63 name: "audiotestharness-servicestub-full", 64 tools: PROTO_TOOLS, 65 cmd: FULL_PROTO_CMD, 66 srcs: [ 67 ":audiotestharness-serviceproto", 68 ], 69 out: [ 70 "protos.srcjar", 71 ], 72} 73 74genrule { 75 name: "audiotestharness-servicestub-lite", 76 tools: PROTO_TOOLS, 77 cmd: LITE_PROTO_CMD, 78 srcs: [ 79 ":audiotestharness-serviceproto", 80 ], 81 out: [ 82 "protos.srcjar", 83 ], 84} 85 86// LIBRARIES ============================================================== 87 88java_library_host { 89 name: "audiotestharness-commonprotolib-full", 90 srcs: [ 91 ":audiotestharness-commonproto", 92 ], 93 static_libs: [ 94 "libprotobuf-java-full", 95 ], 96 proto: { 97 type: "full", 98 }, 99} 100 101java_library { 102 name: "audiotestharness-commonprotolib-lite", 103 host_supported: true, 104 srcs: [ 105 ":audiotestharness-commonproto", 106 ], 107 static_libs: [ 108 "libprotobuf-java-lite", 109 ], 110 proto: { 111 type: "lite", 112 }, 113 sdk_version: "current", 114} 115 116java_library_host { 117 name: "audiotestharness-servicegrpclib-full", 118 srcs: [ 119 ":audiotestharness-servicestub-full", 120 ":audiotestharness-serviceproto", 121 ], 122 libs: [ 123 "javax_annotation-api_1.3.2", 124 ], 125 static_libs: [ 126 "libprotobuf-java-full", 127 "grpc-java", 128 "opencensus-java-api", 129 "opencensus-java-contrib-grpc-metrics", 130 ], 131 proto: { 132 type: "full", 133 }, 134} 135 136java_library { 137 name: "audiotestharness-servicegrpclib-lite", 138 host_supported: true, 139 srcs: [ 140 ":audiotestharness-servicestub-lite", 141 ":audiotestharness-serviceproto", 142 ], 143 libs: [ 144 "javax_annotation-api_1.3.2", 145 ], 146 static_libs: [ 147 "libprotobuf-java-lite", 148 "grpc-java-okhttp-client-lite", 149 "opencensus-java-api", 150 "opencensus-java-contrib-grpc-metrics", 151 ], 152 proto: { 153 type: "lite", 154 }, 155 sdk_version: "current", 156} 157