xref: /aosp_15_r20/external/mockito/Android.bp (revision ceffa222020788e9b81e120db61d5f29c922f983)
1*ceffa222STreehugger Robot// Copyright (C) 2013 The Android Open Source Project
2*ceffa222STreehugger Robot//
3*ceffa222STreehugger Robot// Licensed under the Apache License, Version 2.0 (the "License");
4*ceffa222STreehugger Robot// you may not use this file except in compliance with the License.
5*ceffa222STreehugger Robot// You may obtain a copy of the License at
6*ceffa222STreehugger Robot//
7*ceffa222STreehugger Robot//      http://www.apache.org/licenses/LICENSE-2.0
8*ceffa222STreehugger Robot//
9*ceffa222STreehugger Robot// Unless required by applicable law or agreed to in writing, software
10*ceffa222STreehugger Robot// distributed under the License is distributed on an "AS IS" BASIS,
11*ceffa222STreehugger Robot// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*ceffa222STreehugger Robot// See the License for the specific language governing permissions and
13*ceffa222STreehugger Robot// limitations under the License.
14*ceffa222STreehugger Robot//
15*ceffa222STreehugger Robot//
16*ceffa222STreehugger Robot
17*ceffa222STreehugger Robot// Builds the Mockito source code, but does not include any run-time
18*ceffa222STreehugger Robot// dependencies. Most projects should use mockito-target instead, which includes
19*ceffa222STreehugger Robot// everything needed to run Mockito tests.
20*ceffa222STreehugger Robotpackage {
21*ceffa222STreehugger Robot    default_applicable_licenses: ["external_mockito_license"],
22*ceffa222STreehugger Robot}
23*ceffa222STreehugger Robot
24*ceffa222STreehugger Robot// Added automatically by a large-scale-change that took the approach of
25*ceffa222STreehugger Robot// 'apply every license found to every target'. While this makes sure we respect
26*ceffa222STreehugger Robot// every license restriction, it may not be entirely correct.
27*ceffa222STreehugger Robot//
28*ceffa222STreehugger Robot// e.g. GPL in an MIT project might only apply to the contrib/ directory.
29*ceffa222STreehugger Robot//
30*ceffa222STreehugger Robot// Please consider splitting the single license below into multiple licenses,
31*ceffa222STreehugger Robot// taking care not to lose any license_kind information, and overriding the
32*ceffa222STreehugger Robot// default license using the 'licenses: [...]' property on targets as needed.
33*ceffa222STreehugger Robot//
34*ceffa222STreehugger Robot// For unused files, consider creating a 'fileGroup' with "//visibility:private"
35*ceffa222STreehugger Robot// to attach the license to, and including a comment whether the files may be
36*ceffa222STreehugger Robot// used in the current project.
37*ceffa222STreehugger Robot// See: http://go/android-license-faq
38*ceffa222STreehugger Robotlicense {
39*ceffa222STreehugger Robot    name: "external_mockito_license",
40*ceffa222STreehugger Robot    visibility: [":__subpackages__"],
41*ceffa222STreehugger Robot    license_kinds: [
42*ceffa222STreehugger Robot        "SPDX-license-identifier-Apache-2.0",
43*ceffa222STreehugger Robot        "SPDX-license-identifier-MIT",
44*ceffa222STreehugger Robot    ],
45*ceffa222STreehugger Robot    license_text: [
46*ceffa222STreehugger Robot        "LICENSE",
47*ceffa222STreehugger Robot    ],
48*ceffa222STreehugger Robot}
49*ceffa222STreehugger Robot
50*ceffa222STreehugger Robotjava_library_static {
51*ceffa222STreehugger Robot    name: "mockito",
52*ceffa222STreehugger Robot    host_supported: true,
53*ceffa222STreehugger Robot    hostdex: true,
54*ceffa222STreehugger Robot    srcs: ["src/main/java/**/*.java"],
55*ceffa222STreehugger Robot
56*ceffa222STreehugger Robot    libs: [
57*ceffa222STreehugger Robot        "junit",
58*ceffa222STreehugger Robot        "objenesis",
59*ceffa222STreehugger Robot    ],
60*ceffa222STreehugger Robot
61*ceffa222STreehugger Robot    target: {
62*ceffa222STreehugger Robot        android: {
63*ceffa222STreehugger Robot            // Exclude source used to dynamically create classes since target builds use
64*ceffa222STreehugger Robot            // dexmaker instead and including it causes conflicts.
65*ceffa222STreehugger Robot            exclude_srcs: [
66*ceffa222STreehugger Robot                "src/main/java/org/mockito/internal/creation/bytebuddy/**/*.java",
67*ceffa222STreehugger Robot            ],
68*ceffa222STreehugger Robot        },
69*ceffa222STreehugger Robot        host: {
70*ceffa222STreehugger Robot            static_libs: [
71*ceffa222STreehugger Robot                "byte-buddy-prebuilt-jar",
72*ceffa222STreehugger Robot            ],
73*ceffa222STreehugger Robot        },
74*ceffa222STreehugger Robot    },
75*ceffa222STreehugger Robot    sdk_version: "core_current",
76*ceffa222STreehugger Robot    java_version: "1.7",
77*ceffa222STreehugger Robot
78*ceffa222STreehugger Robot    errorprone: {
79*ceffa222STreehugger Robot        javacflags: [
80*ceffa222STreehugger Robot            "-Xep:CollectionIncompatibleType:WARN",  // b/74213384
81*ceffa222STreehugger Robot            "-Xep:BoxedPrimitiveEquality:WARN",
82*ceffa222STreehugger Robot        ],
83*ceffa222STreehugger Robot    }
84*ceffa222STreehugger Robot}
85*ceffa222STreehugger Robot
86*ceffa222STreehugger Robot// Compatibility library for Maven artifact naming scheme
87*ceffa222STreehugger Robotjava_library_static {
88*ceffa222STreehugger Robot    name: "mockito-core",
89*ceffa222STreehugger Robot    hostdex: true,
90*ceffa222STreehugger Robot    static_libs: ["mockito"],
91*ceffa222STreehugger Robot    sdk_version: "core_current",
92*ceffa222STreehugger Robot}
93*ceffa222STreehugger Robot
94*ceffa222STreehugger Robot// Compatibility library for old name of host target
95*ceffa222STreehugger Robotjava_library_host {
96*ceffa222STreehugger Robot    name: "mockito-host",
97*ceffa222STreehugger Robot    static_libs: ["mockito"],
98*ceffa222STreehugger Robot}
99*ceffa222STreehugger Robot
100*ceffa222STreehugger Robot// Compatibility library for old name of api target
101*ceffa222STreehugger Robotjava_library_static {
102*ceffa222STreehugger Robot    name: "mockito-api",
103*ceffa222STreehugger Robot    hostdex: true,
104*ceffa222STreehugger Robot    static_libs: ["mockito"],
105*ceffa222STreehugger Robot    sdk_version: "core_current",
106*ceffa222STreehugger Robot}
107*ceffa222STreehugger Robot
108*ceffa222STreehugger Robot// Compatibility library for old name of host target
109*ceffa222STreehugger Robotjava_library_host {
110*ceffa222STreehugger Robot    name: "mockito-inline",
111*ceffa222STreehugger Robot    static_libs: ["mockito"],
112*ceffa222STreehugger Robot    java_resource_dirs: ["subprojects/inline/src/main/resources"],
113*ceffa222STreehugger Robot}
114