1// 2// Copyright (C) 2023 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// Generate gRPC client code 18LITE_PROTO_CMD = "mkdir -p $(genDir)/gen && " + 19 "$(location aprotoc) --java_opt=annotate_code=false " + 20 "-Iexternal/protobuf/src -Ipackages/modules/DeviceLock/DeviceLockController/proto " + 21 "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) " + 22 "--grpc-java_out=lite:$(genDir)/gen $(in) && " + 23 "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen" 24 25genrule { 26 name: "checkIn-service-stub-lite", 27 tools: [ 28 "aprotoc", 29 "protoc-gen-grpc-java-plugin", 30 "soong_zip", 31 ], 32 cmd: LITE_PROTO_CMD, 33 srcs: [ 34 "*.proto", 35 ], 36 out: [ 37 "protos.srcjar", 38 ], 39} 40 41java_library { 42 name: "devicelockcontroller-proto-lite", 43 proto: { 44 type: "lite", 45 include_dirs: [ 46 "external/protobuf/src", 47 "external/protobuf/java", 48 "packages/modules/DeviceLock/DeviceLockController/proto", 49 ], 50 }, 51 srcs: [ 52 ":checkIn-service-stub-lite", 53 "*.proto", 54 ":libprotobuf-internal-protos", 55 ], 56 libs: ["javax_annotation-api_1.3.2"], 57 static_libs: [ 58 "libprotobuf-java-lite", 59 "guava", 60 "grpc-java-core-android", 61 "grpc-java-okhttp-client-lite", 62 ], 63 apex_available: ["com.android.devicelock"], 64 sdk_version: "module_current", 65 min_sdk_version: "UpsideDownCake", 66} 67