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
18package {
19    // See: http://go/android-license-faq
20    // A large-scale-change added 'default_applicable_licenses' to import
21    // all of the 'license_kinds' from "packages_modules_DeviceLock_DeviceLockController_license"
22    // to get the below license kinds:
23    //   SPDX-license-identifier-Apache-2.0
24    default_applicable_licenses: [
25        "packages_modules_DeviceLock_DeviceLockController_license",
26    ],
27}
28
29filegroup {
30    name: "devicelockcontroller-protos",
31    srcs: [
32        "*.proto",
33    ],
34}
35
36genrule {
37    name: "checkIn-service-stub-lite",
38    tools: [
39        "aprotoc",
40        "protoc-gen-grpc-java-plugin",
41        "soong_zip",
42    ],
43    cmd: "mkdir -p $(genDir)/gen && " +
44        "$(location aprotoc) --java_opt=annotate_code=false " +
45        "-Iexternal/protobuf/src -Ipackages/modules/DeviceLock/DeviceLockController/proto " +
46        "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) " +
47        "--grpc-java_out=lite:$(genDir)/gen $(locations :devicelockcontroller-protos) && " +
48        "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen",
49    srcs: [
50        ":devicelockcontroller-protos",
51        ":libprotobuf-internal-protos",
52    ],
53    out: [
54        "protos.srcjar",
55    ],
56}
57
58java_library {
59    name: "devicelockcontroller-proto-lite",
60    proto: {
61        type: "lite",
62        include_dirs: [
63            "external/protobuf/src",
64            "external/protobuf/java",
65            "packages/modules/DeviceLock/DeviceLockController/proto",
66        ],
67    },
68    srcs: [
69        ":checkIn-service-stub-lite",
70        "*.proto",
71        ":libprotobuf-internal-protos",
72    ],
73    libs: ["javax_annotation-api_1.3.2"],
74    static_libs: [
75        "libprotobuf-java-lite",
76        "guava",
77        "grpc-java-core-android",
78        "grpc-java-okhttp-client-lite",
79    ],
80    apex_available: ["com.android.devicelock"],
81    sdk_version: "module_current",
82    min_sdk_version: "UpsideDownCake",
83}
84