xref: /aosp_15_r20/external/truth/Android.bp (revision b3996a89512f34bffd8f9a69f0bc726f1b19016a)
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: ["external_truth_license"],
17}
18
19license {
20    name: "external_truth_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-Apache-2.0",
24    ],
25    license_text: [
26        "LICENSE",
27    ],
28}
29
30java_library {
31    name: "truth",
32    host_supported: true,
33    srcs: ["core/src/main/java/com/google/common/truth/*.java"],
34    libs: [
35        "auto_value_annotations",
36        "error_prone_annotations",
37        "guava-android-annotation-stubs",
38        "jspecify",
39        "junit",
40    ],
41    static_libs: [
42        "guava",
43    ],
44    plugins: ["auto_value_plugin"],
45    sdk_version: "current",
46    // Exclude the functionality that requires bytecode analysis on the device.
47    // Android does not use standard Java .class files.
48    target: {
49        android: {
50            exclude_srcs: ["core/src/main/java/com/google/common/truth/ActualValueInference.java"],
51        },
52        host: {
53            static_libs: ["ow2-asm"],
54        },
55    },
56    // b/267831518: Pin tradefed and dependencies to Java 11.
57    java_version: "11",
58    errorprone: {
59        javacflags: [
60            "-Xep:NoCanIgnoreReturnValueOnClasses:WARN",
61        ],
62    },
63}
64
65java_library {
66    name: "truth-java8-extension",
67    host_supported: true,
68    srcs: ["extensions/java8/src/main/java/**/*.java"],
69    libs: [
70        "auto_value_annotations",
71        "error_prone_annotations",
72        "guava-android-annotation-stubs",
73        "jspecify",
74        "truth",
75    ],
76    static_libs: [
77        "guava",
78    ],
79    java_version: "1.8",
80    sdk_version: "current",
81}
82
83java_library {
84    name: "truth-liteproto-extension",
85    host_supported: true,
86    srcs: ["extensions/liteproto/src/main/java/**/*.java"],
87    libs: [
88        "auto_value_annotations",
89        "error_prone_annotations",
90        "guava-android-annotation-stubs",
91        "jspecify",
92        "truth",
93    ],
94    static_libs: [
95        "guava",
96        "libprotobuf-java-lite",
97    ],
98    sdk_version: "current",
99}
100
101java_library_host {
102    name: "truth-proto-extension",
103    srcs: ["extensions/proto/src/main/java/**/*.java"],
104    libs: [
105        "auto_value_annotations",
106        "auto_value_memoized_extension_annotations",
107        "error_prone_annotations",
108        "guava-android-annotation-stubs",
109        "jspecify",
110        "truth",
111        "truth-liteproto-extension",
112    ],
113    plugins: [
114        "auto_oneof_plugin",
115        "auto_value_memoized_extension_plugin",
116        "auto_value_plugin",
117    ],
118    static_libs: [
119        "guava",
120        "libprotobuf-java-full",
121    ],
122}
123