xref: /aosp_15_r20/external/truth/Android.bp (revision b3996a89512f34bffd8f9a69f0bc726f1b19016a)
1*b3996a89SAndroid Build Coastguard Worker// Copyright (C) 2022 The Android Open Source Project
2*b3996a89SAndroid Build Coastguard Worker//
3*b3996a89SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*b3996a89SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*b3996a89SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*b3996a89SAndroid Build Coastguard Worker//
7*b3996a89SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*b3996a89SAndroid Build Coastguard Worker//
9*b3996a89SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*b3996a89SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*b3996a89SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*b3996a89SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*b3996a89SAndroid Build Coastguard Worker// limitations under the License.
14*b3996a89SAndroid Build Coastguard Worker
15*b3996a89SAndroid Build Coastguard Workerpackage {
16*b3996a89SAndroid Build Coastguard Worker    default_applicable_licenses: ["external_truth_license"],
17*b3996a89SAndroid Build Coastguard Worker}
18*b3996a89SAndroid Build Coastguard Worker
19*b3996a89SAndroid Build Coastguard Workerlicense {
20*b3996a89SAndroid Build Coastguard Worker    name: "external_truth_license",
21*b3996a89SAndroid Build Coastguard Worker    visibility: [":__subpackages__"],
22*b3996a89SAndroid Build Coastguard Worker    license_kinds: [
23*b3996a89SAndroid Build Coastguard Worker        "SPDX-license-identifier-Apache-2.0",
24*b3996a89SAndroid Build Coastguard Worker    ],
25*b3996a89SAndroid Build Coastguard Worker    license_text: [
26*b3996a89SAndroid Build Coastguard Worker        "LICENSE",
27*b3996a89SAndroid Build Coastguard Worker    ],
28*b3996a89SAndroid Build Coastguard Worker}
29*b3996a89SAndroid Build Coastguard Worker
30*b3996a89SAndroid Build Coastguard Workerjava_library {
31*b3996a89SAndroid Build Coastguard Worker    name: "truth",
32*b3996a89SAndroid Build Coastguard Worker    host_supported: true,
33*b3996a89SAndroid Build Coastguard Worker    srcs: ["core/src/main/java/com/google/common/truth/*.java"],
34*b3996a89SAndroid Build Coastguard Worker    libs: [
35*b3996a89SAndroid Build Coastguard Worker        "auto_value_annotations",
36*b3996a89SAndroid Build Coastguard Worker        "error_prone_annotations",
37*b3996a89SAndroid Build Coastguard Worker        "guava-android-annotation-stubs",
38*b3996a89SAndroid Build Coastguard Worker        "jspecify",
39*b3996a89SAndroid Build Coastguard Worker        "junit",
40*b3996a89SAndroid Build Coastguard Worker    ],
41*b3996a89SAndroid Build Coastguard Worker    static_libs: [
42*b3996a89SAndroid Build Coastguard Worker        "guava",
43*b3996a89SAndroid Build Coastguard Worker    ],
44*b3996a89SAndroid Build Coastguard Worker    plugins: ["auto_value_plugin"],
45*b3996a89SAndroid Build Coastguard Worker    sdk_version: "current",
46*b3996a89SAndroid Build Coastguard Worker    // Exclude the functionality that requires bytecode analysis on the device.
47*b3996a89SAndroid Build Coastguard Worker    // Android does not use standard Java .class files.
48*b3996a89SAndroid Build Coastguard Worker    target: {
49*b3996a89SAndroid Build Coastguard Worker        android: {
50*b3996a89SAndroid Build Coastguard Worker            exclude_srcs: ["core/src/main/java/com/google/common/truth/ActualValueInference.java"],
51*b3996a89SAndroid Build Coastguard Worker        },
52*b3996a89SAndroid Build Coastguard Worker        host: {
53*b3996a89SAndroid Build Coastguard Worker            static_libs: ["ow2-asm"],
54*b3996a89SAndroid Build Coastguard Worker        },
55*b3996a89SAndroid Build Coastguard Worker    },
56*b3996a89SAndroid Build Coastguard Worker    // b/267831518: Pin tradefed and dependencies to Java 11.
57*b3996a89SAndroid Build Coastguard Worker    java_version: "11",
58*b3996a89SAndroid Build Coastguard Worker    errorprone: {
59*b3996a89SAndroid Build Coastguard Worker        javacflags: [
60*b3996a89SAndroid Build Coastguard Worker            "-Xep:NoCanIgnoreReturnValueOnClasses:WARN",
61*b3996a89SAndroid Build Coastguard Worker        ],
62*b3996a89SAndroid Build Coastguard Worker    },
63*b3996a89SAndroid Build Coastguard Worker}
64*b3996a89SAndroid Build Coastguard Worker
65*b3996a89SAndroid Build Coastguard Workerjava_library {
66*b3996a89SAndroid Build Coastguard Worker    name: "truth-java8-extension",
67*b3996a89SAndroid Build Coastguard Worker    host_supported: true,
68*b3996a89SAndroid Build Coastguard Worker    srcs: ["extensions/java8/src/main/java/**/*.java"],
69*b3996a89SAndroid Build Coastguard Worker    libs: [
70*b3996a89SAndroid Build Coastguard Worker        "auto_value_annotations",
71*b3996a89SAndroid Build Coastguard Worker        "error_prone_annotations",
72*b3996a89SAndroid Build Coastguard Worker        "guava-android-annotation-stubs",
73*b3996a89SAndroid Build Coastguard Worker        "jspecify",
74*b3996a89SAndroid Build Coastguard Worker        "truth",
75*b3996a89SAndroid Build Coastguard Worker    ],
76*b3996a89SAndroid Build Coastguard Worker    static_libs: [
77*b3996a89SAndroid Build Coastguard Worker        "guava",
78*b3996a89SAndroid Build Coastguard Worker    ],
79*b3996a89SAndroid Build Coastguard Worker    java_version: "1.8",
80*b3996a89SAndroid Build Coastguard Worker    sdk_version: "current",
81*b3996a89SAndroid Build Coastguard Worker}
82*b3996a89SAndroid Build Coastguard Worker
83*b3996a89SAndroid Build Coastguard Workerjava_library {
84*b3996a89SAndroid Build Coastguard Worker    name: "truth-liteproto-extension",
85*b3996a89SAndroid Build Coastguard Worker    host_supported: true,
86*b3996a89SAndroid Build Coastguard Worker    srcs: ["extensions/liteproto/src/main/java/**/*.java"],
87*b3996a89SAndroid Build Coastguard Worker    libs: [
88*b3996a89SAndroid Build Coastguard Worker        "auto_value_annotations",
89*b3996a89SAndroid Build Coastguard Worker        "error_prone_annotations",
90*b3996a89SAndroid Build Coastguard Worker        "guava-android-annotation-stubs",
91*b3996a89SAndroid Build Coastguard Worker        "jspecify",
92*b3996a89SAndroid Build Coastguard Worker        "truth",
93*b3996a89SAndroid Build Coastguard Worker    ],
94*b3996a89SAndroid Build Coastguard Worker    static_libs: [
95*b3996a89SAndroid Build Coastguard Worker        "guava",
96*b3996a89SAndroid Build Coastguard Worker        "libprotobuf-java-lite",
97*b3996a89SAndroid Build Coastguard Worker    ],
98*b3996a89SAndroid Build Coastguard Worker    sdk_version: "current",
99*b3996a89SAndroid Build Coastguard Worker}
100*b3996a89SAndroid Build Coastguard Worker
101*b3996a89SAndroid Build Coastguard Workerjava_library_host {
102*b3996a89SAndroid Build Coastguard Worker    name: "truth-proto-extension",
103*b3996a89SAndroid Build Coastguard Worker    srcs: ["extensions/proto/src/main/java/**/*.java"],
104*b3996a89SAndroid Build Coastguard Worker    libs: [
105*b3996a89SAndroid Build Coastguard Worker        "auto_value_annotations",
106*b3996a89SAndroid Build Coastguard Worker        "auto_value_memoized_extension_annotations",
107*b3996a89SAndroid Build Coastguard Worker        "error_prone_annotations",
108*b3996a89SAndroid Build Coastguard Worker        "guava-android-annotation-stubs",
109*b3996a89SAndroid Build Coastguard Worker        "jspecify",
110*b3996a89SAndroid Build Coastguard Worker        "truth",
111*b3996a89SAndroid Build Coastguard Worker        "truth-liteproto-extension",
112*b3996a89SAndroid Build Coastguard Worker    ],
113*b3996a89SAndroid Build Coastguard Worker    plugins: [
114*b3996a89SAndroid Build Coastguard Worker        "auto_oneof_plugin",
115*b3996a89SAndroid Build Coastguard Worker        "auto_value_memoized_extension_plugin",
116*b3996a89SAndroid Build Coastguard Worker        "auto_value_plugin",
117*b3996a89SAndroid Build Coastguard Worker    ],
118*b3996a89SAndroid Build Coastguard Worker    static_libs: [
119*b3996a89SAndroid Build Coastguard Worker        "guava",
120*b3996a89SAndroid Build Coastguard Worker        "libprotobuf-java-full",
121*b3996a89SAndroid Build Coastguard Worker    ],
122*b3996a89SAndroid Build Coastguard Worker}
123