1// Copyright (C) 2022 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 default_applicable_licenses: ["Android-Apache-2.0"], 17} 18 19filegroup { 20 name: "adservices-proto", 21 srcs: [ 22 "*.proto", 23 ], 24} 25 26// Generate the Proto POJO builders, etc. 27java_library { 28 name: "adservices-proto-lite", 29 sdk_version: "core_current", 30 proto: { 31 type: "lite", 32 include_dirs: [ 33 "external/protobuf/src", 34 "external/protobuf/java", 35 "external/anonymous-counting-tokens", 36 "external/private-join-and-compute", 37 ], 38 }, 39 srcs: [ 40 ":adservices-proto", 41 ":libprotobuf-internal-protos", 42 ":act-proto", 43 ":private-join-and-compute-proto", 44 ], 45 static_libs: ["libprotobuf-java-lite"], 46 apex_available: [ 47 "com.android.adservices", 48 "com.android.extservices", 49 ], 50} 51 52// Generate gRPC client code 53genrule { 54 name: "seller-frontend-service-stub-lite", 55 tools: [ 56 "aprotoc", 57 "protoc-gen-grpc-java-plugin", 58 "soong_zip", 59 ], 60 cmd: "mkdir -p $(genDir)/gen && " + 61 "$(location aprotoc) --java_opt=annotate_code=false -Ipackages/modules/AdServices/adservices/service-core -Iexternal/protobuf/src " + 62 "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) --grpc-java_out=lite:$(genDir)/gen $(locations :adservices-proto) && " + 63 "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen", 64 srcs: [ 65 ":adservices-proto", 66 ":libprotobuf-internal-protos", 67 ], 68 out: [ 69 "protos.srcjar", 70 ], 71} 72 73// Package into java_library to reference in "static_libs" in "adservices-service-core" 74java_library { 75 name: "adservices-grpclib-lite", 76 sdk_version: "module_current", 77 min_sdk_version: "30", 78 apex_available: [ 79 "com.android.adservices", 80 "com.android.extservices", 81 ], 82 srcs: [ 83 ":seller-frontend-service-stub-lite", 84 ":adservices-proto", 85 ":libprotobuf-internal-protos", 86 ], 87 libs: [ 88 "javax_annotation-api_1.3.2", 89 ], 90 static_libs: [ 91 "libprotobuf-java-lite", 92 "guava", 93 "grpc-java-core-android", 94 "grpc-java-okhttp-client-lite", 95 ], 96 proto: { 97 type: "lite", 98 include_dirs: [ 99 "external/protobuf/src", 100 "external/protobuf/java", 101 ], 102 }, 103} 104