xref: /aosp_15_r20/external/grpc-grpc-java/core/Android.bp (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1// Copyright (C) 2018 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//
15
16package {
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "external_grpc-grpc-java_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    default_applicable_licenses: ["external_grpc-grpc-java_license"],
23}
24
25java_library {
26    name: "grpc-java-core",
27    host_supported: true,
28    srcs: [
29        "src/main/java/io/grpc/*.java",
30    ],
31    java_resource_dirs: [
32        "src/main/resources",
33    ],
34    static_libs: [
35        "grpc-java-api",
36    ],
37    libs: [
38        "grpc-java-context",
39        "jsr305",
40        "guava",
41    ],
42    // b/267831518: Pin tradefed and dependencies to Java 11.
43    java_version: "11",
44    sdk_version: "current",
45    min_sdk_version: "30",
46    apex_available: [
47        "com.android.adservices",
48        "com.android.devicelock",
49        "com.android.extservices",
50        "com.android.virt",
51        "//apex_available:platform",
52    ],
53    target: {
54        windows: {
55            enabled: true,
56        },
57    },
58}
59
60java_library {
61    name: "grpc-java-core-inprocess",
62    host_supported: true,
63    srcs: [
64        "src/main/java/io/grpc/inprocess/*.java",
65    ],
66    libs: [
67        "error_prone_annotations",
68        "grpc-java-annotation-stubs",
69        "grpc-java-api",
70        "grpc-java-context",
71        "grpc-java-core",
72        "grpc-java-core-internal",
73        "guava",
74        "jsr305",
75    ],
76    // b/267831518: Pin tradefed and dependencies to Java 11.
77    java_version: "11",
78    sdk_version: "current",
79    target: {
80        windows: {
81            enabled: true,
82        },
83    },
84}
85
86java_library {
87    name: "grpc-java-core-internal",
88    host_supported: true,
89    srcs: [
90        "src/main/java/io/grpc/internal/*.java",
91    ],
92    libs: [
93        "grpc-java-annotation-stubs",
94        "grpc-java-api",
95        "grpc-java-core",
96        "grpc-java-context",
97        "jsr305",
98        "gson",
99        "error_prone_annotations",
100        "guava",
101        "perfmark",
102    ],
103    target: {
104        // For the Android variant, ignore this class since it is optional,
105        // uses javax APIs not available on Android, and is used reflectively
106        // so ignoring it does not affect the functionality of the library.
107        android: {
108            exclude_srcs: [
109                "src/main/java/io/grpc/internal/JndiResourceResolverFactory.java",
110            ],
111        },
112        host: {
113            libs: [
114                "annotations", // For android.annotation.SuppressLint
115            ],
116        },
117        windows: {
118            enabled: true,
119        },
120    },
121    // b/267831518: Pin tradefed and dependencies to Java 11.
122    java_version: "11",
123    sdk_version: "current",
124    min_sdk_version: "30",
125    apex_available: [
126        "com.android.adservices",
127        "com.android.devicelock",
128        "com.android.extservices",
129        "com.android.virt",
130        "//apex_available:platform",
131    ],
132    errorprone: {
133        javacflags: [
134            "-Xep:BanJNDI:WARN",
135        ],
136    },
137}
138
139java_library {
140    name: "grpc-java-core-util",
141    host_supported: true,
142    srcs: [
143        "src/main/java/io/grpc/util/*.java",
144    ],
145    libs: [
146        "error_prone_annotations",
147        "grpc-java-annotation-stubs",
148        "grpc-java-api",
149        "grpc-java-core",
150        "grpc-java-core-internal",
151        "jsr305",
152        "guava",
153    ],
154    // b/267831518: Pin tradefed and dependencies to Java 11.
155    java_version: "11",
156    sdk_version: "current",
157    min_sdk_version: "30",
158    apex_available: [
159        "com.android.adservices",
160        "com.android.devicelock",
161        "com.android.extservices",
162        "com.android.virt",
163        "//apex_available:platform",
164    ],
165    target: {
166        windows: {
167            enabled: true,
168        },
169    },
170}
171