summaryrefslogtreecommitdiff
path: root/adservices/service-core/proto/Android.bp
blob: eb229d3e89553ac974471d7f9b0ae4d7806e1475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright (C) 2022 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

filegroup {
    name: "adservices-proto",
    srcs: [
        "*.proto",
    ],
}

// Generate the Proto POJO builders, etc.
java_library {
    name: "adservices-proto-lite",
    sdk_version: "core_current",
    proto: {
        type: "lite",
        include_dirs: [
            "external/protobuf/src",
            "external/protobuf/java",
        ],
    },
    srcs: [
        ":adservices-proto",
        ":libprotobuf-internal-protos",
    ],
    static_libs: ["libprotobuf-java-lite"],
    apex_available: ["com.android.adservices"],
}

// Generate gRPC client code
PROTO_TOOLS = [
    "aprotoc",
    "protoc-gen-grpc-java-plugin",
    "soong_zip",
]
LITE_PROTO_CMD = "mkdir -p $(genDir)/gen && " +
    "$(location aprotoc) --java_opt=annotate_code=false -Ipackages/modules/AdServices/adservices/service-core -Iexternal/protobuf/src " +
    "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) --grpc-java_out=lite:$(genDir)/gen $(in) && " +
    "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen"
genrule {
    name: "seller-frontend-service-stub-lite",
    tools: PROTO_TOOLS,
    cmd: LITE_PROTO_CMD,
    srcs: [
        ":adservices-proto",
    ],
    out: [
        "protos.srcjar",
    ],
}

// Package into java_library to reference in "static_libs" in "adservices-service-core"
java_library {
    name: "adservices-grpclib-lite",
    min_sdk_version: "33",
    apex_available: ["com.android.adservices"],
    host_supported: true,
    srcs: [
        ":seller-frontend-service-stub-lite",
        ":adservices-proto",
        ":libprotobuf-internal-protos",
    ],
    libs: [
        "javax_annotation-api_1.3.2",
    ],
    static_libs: [
        "libprotobuf-java-lite",
        "guava",
        "grpc-java-core-android",
        "grpc-java-okhttp-client-lite",
    ],
    proto: {
        type: "lite",
        include_dirs: [
            "external/protobuf/src",
            "external/protobuf/java",
        ],
    },
}