Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 1 | // Copyright (C) 2013 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 | // |
| 16 | |
| 17 | // Builds the Mockito source code, but does not include any run-time |
| 18 | // dependencies. Most projects should use mockito-target instead, which includes |
| 19 | // everything needed to run Mockito tests. |
Bob Badour | c9ec311 | 2021-02-12 21:28:53 -0800 | [diff] [blame] | 20 | package { |
| 21 | default_applicable_licenses: ["external_mockito_license"], |
| 22 | } |
| 23 | |
| 24 | // Added automatically by a large-scale-change that took the approach of |
| 25 | // 'apply every license found to every target'. While this makes sure we respect |
| 26 | // every license restriction, it may not be entirely correct. |
| 27 | // |
| 28 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 29 | // |
| 30 | // Please consider splitting the single license below into multiple licenses, |
| 31 | // taking care not to lose any license_kind information, and overriding the |
| 32 | // default license using the 'licenses: [...]' property on targets as needed. |
| 33 | // |
| 34 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 35 | // to attach the license to, and including a comment whether the files may be |
| 36 | // used in the current project. |
| 37 | // See: http://go/android-license-faq |
| 38 | license { |
| 39 | name: "external_mockito_license", |
| 40 | visibility: [":__subpackages__"], |
| 41 | license_kinds: [ |
| 42 | "SPDX-license-identifier-Apache-2.0", |
| 43 | "SPDX-license-identifier-MIT", |
| 44 | ], |
| 45 | license_text: [ |
| 46 | "LICENSE", |
| 47 | ], |
| 48 | } |
| 49 | |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 50 | java_library_static { |
| 51 | name: "mockito", |
| 52 | host_supported: true, |
| 53 | hostdex: true, |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 54 | srcs: ["src/main/java/**/*.java"], |
| 55 | |
| 56 | libs: [ |
| 57 | "junit", |
| 58 | "objenesis", |
| 59 | ], |
| 60 | |
| 61 | target: { |
| 62 | android: { |
| 63 | // Exclude source used to dynamically create classes since target builds use |
| 64 | // dexmaker instead and including it causes conflicts. |
Philip P. Moltmann | 3604852 | 2017-11-20 15:13:48 -0800 | [diff] [blame] | 65 | exclude_srcs: [ |
| 66 | "src/main/java/org/mockito/internal/creation/bytebuddy/**/*.java", |
| 67 | ], |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 68 | }, |
| 69 | host: { |
| 70 | static_libs: [ |
| 71 | "mockito-byte-buddy", |
| 72 | "mockito-byte-buddy-agent", |
| 73 | ], |
| 74 | }, |
| 75 | }, |
Neil Fuller | fa42ce4 | 2018-10-09 17:33:22 +0100 | [diff] [blame] | 76 | sdk_version: "core_current", |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 77 | java_version: "1.7", |
Andreas Gampe | 42004bd | 2018-03-05 18:40:12 -0800 | [diff] [blame] | 78 | |
| 79 | errorprone: { |
| 80 | javacflags: [ |
| 81 | "-Xep:CollectionIncompatibleType:WARN", // b/74213384 |
| 82 | ], |
| 83 | } |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | // Compatibility library for old name of host target |
| 87 | java_library_host { |
| 88 | name: "mockito-host", |
| 89 | static_libs: ["mockito"], |
| 90 | } |
| 91 | |
| 92 | // Compatibility library for old name of api target |
| 93 | java_library_static { |
| 94 | name: "mockito-api", |
| 95 | hostdex: true, |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 96 | static_libs: ["mockito"], |
Neil Fuller | fa42ce4 | 2018-10-09 17:33:22 +0100 | [diff] [blame] | 97 | sdk_version: "core_current", |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 98 | } |
| 99 | |
Philip P. Moltmann | 977c6af | 2017-12-14 13:21:55 -0800 | [diff] [blame] | 100 | // Compatibility library for old name of host target |
| 101 | java_library_host { |
| 102 | name: "mockito-inline", |
| 103 | static_libs: ["mockito"], |
| 104 | java_resource_dirs: ["subprojects/inline/src/main/resources"], |
| 105 | } |
| 106 | |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 107 | // Host prebuilt dependencies. |
| 108 | // ============================================================ |
| 109 | java_import_host { |
| 110 | name: "mockito-byte-buddy", |
Garfield Tan | 49ce6ea | 2019-09-10 10:59:56 -0700 | [diff] [blame] | 111 | jars: ["lib/byte-buddy-1.8.15.jar"], |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | java_import_host { |
| 115 | name: "mockito-byte-buddy-agent", |
Garfield Tan | 49ce6ea | 2019-09-10 10:59:56 -0700 | [diff] [blame] | 116 | jars: ["lib/byte-buddy-agent-1.8.15.jar"], |
Colin Cross | 56a9170 | 2017-10-18 13:00:38 -0700 | [diff] [blame] | 117 | } |