Colin Cross | 4c60995 | 2017-10-18 13:00:01 -0700 | [diff] [blame] | 1 | // Copyright (C) 2011 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 | java_library_static { |
| 16 | name: "dexmaker", |
| 17 | |
| 18 | // Include all the java files. |
| 19 | srcs: ["dexmaker/src/main/java/**/*.java"], |
| 20 | |
| 21 | static_libs: [ |
| 22 | "dexmaker-dx-target", |
Colin Cross | 4c60995 | 2017-10-18 13:00:01 -0700 | [diff] [blame] | 23 | ], |
| 24 | |
Neil Fuller | bc1141d | 2018-10-09 17:29:21 +0100 | [diff] [blame] | 25 | sdk_version: "core_current", |
Colin Cross | 4c60995 | 2017-10-18 13:00:01 -0700 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | // Build Dexmaker's MockMaker, a plugin to Mockito |
| 29 | java_library_static { |
| 30 | name: "dexmaker-mockmaker", |
Neil Fuller | bc1141d | 2018-10-09 17:29:21 +0100 | [diff] [blame] | 31 | sdk_version: "core_current", |
Colin Cross | 4c60995 | 2017-10-18 13:00:01 -0700 | [diff] [blame] | 32 | srcs: ["dexmaker-mockito/src/main/java/**/*.java"], |
| 33 | java_resource_dirs: ["dexmaker-mockito/src/main/resources"], |
| 34 | libs: [ |
| 35 | "dexmaker", |
| 36 | "mockito-api", |
| 37 | ], |
| 38 | } |
| 39 | |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 40 | // Build dispatcher for Dexmaker's inline MockMaker |
| 41 | java_library_static { |
| 42 | name: "dexmaker-inline-mockmaker-dispatcher", |
Philip P. Moltmann | d4a2056 | 2018-03-13 13:11:07 -0700 | [diff] [blame] | 43 | sdk_version: "current", |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 44 | srcs: ["dexmaker-mockito-inline-dispatcher/src/main/java/**/*.java"], |
| 45 | } |
| 46 | |
Andreas Gampe | a884f90 | 2018-01-18 21:29:41 -0800 | [diff] [blame] | 47 | // Defaults for agent code. |
| 48 | cc_defaults { |
| 49 | name: "dexmaker_agent_defaults", |
| 50 | |
| 51 | // Compile with the NDK, so that the agent can be used in apps. |
| 52 | sdk_version: "current", |
| 53 | stl: "libc++_static", |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 54 | |
| 55 | host_supported: false, |
| 56 | device_supported: true, |
| 57 | |
| 58 | rtti: true, |
| 59 | |
| 60 | cflags: [ |
| 61 | "-std=c++11", |
| 62 | "-Wall", |
| 63 | "-Werror", |
| 64 | "-Wno-unused-parameter", |
| 65 | "-Wno-shift-count-overflow", |
| 66 | "-Wno-error=non-virtual-dtor", |
| 67 | "-Wno-sign-compare", |
| 68 | "-Wno-switch", |
| 69 | "-Wno-missing-braces", |
| 70 | ], |
| 71 | |
| 72 | static_libs: [ |
Andreas Gampe | a884f90 | 2018-01-18 21:29:41 -0800 | [diff] [blame] | 73 | "slicer_ndk", |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 74 | ], |
| 75 | |
| 76 | shared_libs: [ |
| 77 | "libz", |
| 78 | ], |
| 79 | |
Andreas Gampe | a884f90 | 2018-01-18 21:29:41 -0800 | [diff] [blame] | 80 | include_dirs: [ |
| 81 | "art/openjdkjvmti/include", |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 82 | ], |
| 83 | } |
| 84 | |
Andreas Gampe | a884f90 | 2018-01-18 21:29:41 -0800 | [diff] [blame] | 85 | // Build agent for Dexmaker's inline MockMaker |
| 86 | cc_library_shared { |
| 87 | name: "libdexmakerjvmtiagent", |
| 88 | defaults: [ |
| 89 | "dexmaker_agent_defaults", |
| 90 | ], |
| 91 | srcs: ["dexmaker-mockito-inline/src/main/jni/**/*.cc"], |
| 92 | } |
| 93 | |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 94 | // Build agent for Dexmaker's extended MockMaker |
| 95 | cc_library_shared { |
| 96 | name: "libstaticjvmtiagent", |
| 97 | defaults: [ |
| 98 | "dexmaker_agent_defaults", |
| 99 | ], |
| 100 | srcs: ["dexmaker-mockito-inline-extended/src/main/jni/**/*.cc"], |
| 101 | } |
| 102 | |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 103 | // Build agent for Dexmaker's inline tests |
| 104 | cc_library_shared { |
| 105 | name: "libmultiplejvmtiagentsinterferenceagent", |
Andreas Gampe | a884f90 | 2018-01-18 21:29:41 -0800 | [diff] [blame] | 106 | defaults: [ |
| 107 | "dexmaker_agent_defaults", |
| 108 | ], |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 109 | srcs: ["dexmaker-mockito-inline-tests/src/main/jni/**/*.cc"], |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | // Build Dexmaker's inline MockMaker, a plugin to Mockito |
| 113 | java_library_static { |
| 114 | name: "dexmaker-inline-mockmaker", |
Philip P. Moltmann | d4a2056 | 2018-03-13 13:11:07 -0700 | [diff] [blame] | 115 | sdk_version: "current", |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 116 | srcs: ["dexmaker-mockito-inline/src/main/java/**/*.java"], |
| 117 | java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"], |
| 118 | libs: [ |
| 119 | "dexmaker", |
| 120 | "mockito-api", |
| 121 | ], |
| 122 | required: ["libdexmakerjvmtiagent"], |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 123 | } |
Philip P. Moltmann | d4a2056 | 2018-03-13 13:11:07 -0700 | [diff] [blame] | 124 | |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 125 | // Build Dexmaker's extended MockMaker, a plugin to Mockito |
| 126 | java_library_static { |
| 127 | name: "dexmaker-extended-mockmaker", |
| 128 | sdk_version: "current", |
| 129 | srcs: ["dexmaker-mockito-inline-extended/src/main/java/**/*.java"], |
| 130 | |
| 131 | java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"], |
| 132 | |
| 133 | libs: [ |
| 134 | "dexmaker", |
| 135 | "mockito-api", |
| 136 | "dexmaker-inline-mockmaker", |
| 137 | ], |
| 138 | required: [ |
| 139 | "libdexmakerjvmtiagent", |
| 140 | "libstaticjvmtiagent" |
| 141 | ], |
| 142 | } |
| 143 | |
| 144 | // Provides mockito functionality for on-device tests. Does not allow stubbing of final or static |
| 145 | // methods. |
| 146 | java_library_static { |
| 147 | name: "mockito-target", |
| 148 | no_framework_libs: true, |
| 149 | static_libs: [ |
| 150 | "mockito-target-minus-junit4", |
| 151 | "junit", |
| 152 | ], |
Neil Fuller | bc1141d | 2018-10-09 17:29:21 +0100 | [diff] [blame] | 153 | sdk_version: "core_current", |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | // Same as mockito-target but does not bundle junit |
| 157 | java_library_static { |
| 158 | name: "mockito-target-minus-junit4", |
| 159 | no_framework_libs: true, |
| 160 | static_libs: [ |
| 161 | "mockito", |
| 162 | "dexmaker", |
| 163 | "dexmaker-mockmaker", |
| 164 | "objenesis", |
| 165 | ], |
| 166 | libs: ["junit"], |
Neil Fuller | bc1141d | 2018-10-09 17:29:21 +0100 | [diff] [blame] | 167 | sdk_version: "core_current", |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 168 | |
| 169 | java_version: "1.7", |
| 170 | } |
| 171 | |
| 172 | // Provides mockito functionality for on-device tests. Allows stubbing of final methods. Does not |
| 173 | // allow stubbing of static methods. |
| 174 | // Project depending on this also need to depend on the static JNI library libdexmakerjvmtiagent |
| 175 | java_library_static { |
| 176 | name: "mockito-target-inline", |
| 177 | no_framework_libs: true, |
| 178 | static_libs: [ |
| 179 | "mockito-target-inline-minus-junit4", |
| 180 | "junit", |
| 181 | ], |
| 182 | sdk_version: "current", |
| 183 | } |
| 184 | |
| 185 | // Same as mockito-target-inline but does not bundle junit |
| 186 | java_library_static { |
| 187 | name: "mockito-target-inline-minus-junit4", |
| 188 | no_framework_libs: true, |
| 189 | static_libs: [ |
| 190 | "mockito", |
| 191 | "dexmaker", |
| 192 | "dexmaker-inline-mockmaker", |
| 193 | "objenesis", |
| 194 | ], |
| 195 | libs: ["junit"], |
| 196 | sdk_version: "current", |
| 197 | |
| 198 | java_version: "1.7", |
| 199 | } |
| 200 | |
| 201 | // Provides mockito functionality for on-device tests. Allows stubbing of final and static methods. |
| 202 | // Stubbing static methods is not an official mockito API. |
| 203 | // Project depending on this also need to depend on the static JNI libraries libstaticjvmtiagent and |
| 204 | // libdexmakerjvmtiagent |
| 205 | java_library_static { |
| 206 | name: "mockito-target-extended", |
| 207 | no_framework_libs: true, |
| 208 | static_libs: [ |
| 209 | "mockito-target-extended-minus-junit4", |
| 210 | "junit", |
| 211 | ], |
| 212 | sdk_version: "current", |
| 213 | } |
| 214 | |
| 215 | // Same as mockito-target-extended but does not bundle junit |
| 216 | java_library_static { |
| 217 | name: "mockito-target-extended-minus-junit4", |
| 218 | no_framework_libs: true, |
| 219 | static_libs: [ |
| 220 | "mockito", |
| 221 | "dexmaker", |
| 222 | "dexmaker-inline-mockmaker", |
| 223 | "dexmaker-extended-mockmaker", |
| 224 | "objenesis", |
| 225 | ], |
| 226 | libs: ["junit"], |
| 227 | sdk_version: "current", |
| 228 | |
| 229 | java_version: "1.7", |
Philip P. Moltmann | 43b4c62 | 2017-11-20 09:38:54 -0800 | [diff] [blame] | 230 | } |
| 231 | |
Colin Cross | 4c60995 | 2017-10-18 13:00:01 -0700 | [diff] [blame] | 232 | java_import { |
| 233 | name: "dexmaker-dx-target", |
Philip P. Moltmann | aa1c0e9 | 2018-12-05 08:46:19 -0800 | [diff] [blame] | 234 | jars: ["lib/dalvik-dx-9.0.0_r3.jar"], |
Colin Cross | 4c60995 | 2017-10-18 13:00:01 -0700 | [diff] [blame] | 235 | } |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 236 | |
| 237 | // dexmaker tests |
| 238 | java_library_static { |
| 239 | name: "dexmaker-tests-lib", |
| 240 | sdk_version: "current", |
| 241 | srcs: ["dexmaker-tests/src/androidTest/java/**/*.java"], |
| 242 | |
| 243 | libs: [ |
Brett Chabot | 8d384cf | 2019-02-06 21:09:21 -0800 | [diff] [blame] | 244 | "androidx.test.rules", |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 245 | "dexmaker", |
| 246 | "junit", |
| 247 | ], |
| 248 | } |
| 249 | |
| 250 | // dexmaker-mockito tests |
| 251 | java_library_static { |
| 252 | name: "dexmaker-mockmaker-tests", |
| 253 | sdk_version: "current", |
| 254 | srcs: ["dexmaker-mockito-tests/src/main/java/**/*.java"], |
| 255 | |
| 256 | libs: [ |
Brett Chabot | 8d384cf | 2019-02-06 21:09:21 -0800 | [diff] [blame] | 257 | "androidx.test.rules", |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 258 | "dexmaker", |
| 259 | "mockito", |
| 260 | "junit", |
| 261 | "dexmaker-mockmaker", |
| 262 | ], |
| 263 | } |
| 264 | |
| 265 | // dexmaker-mockito-inline tests |
| 266 | java_library_static { |
| 267 | name: "dexmaker-inline-mockmaker-tests", |
| 268 | sdk_version: "current", |
| 269 | srcs: ["dexmaker-mockito-inline-tests/src/main/java/**/*.java"], |
| 270 | |
| 271 | libs: [ |
Brett Chabot | 8d384cf | 2019-02-06 21:09:21 -0800 | [diff] [blame] | 272 | "androidx.test.rules", |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 273 | "dexmaker", |
| 274 | "android-support-v4", |
| 275 | "mockito", |
| 276 | "junit", |
| 277 | "dexmaker-inline-mockmaker", |
| 278 | ], |
| 279 | } |
| 280 | |
| 281 | // dexmaker-mockito-extended tests |
| 282 | java_library_static { |
| 283 | name: "dexmaker-extended-mockmaker-tests", |
| 284 | sdk_version: "current", |
| 285 | srcs: ["dexmaker-mockito-inline-extended-tests/src/main/java/**/*.java"], |
| 286 | |
| 287 | libs: [ |
Brett Chabot | 8d384cf | 2019-02-06 21:09:21 -0800 | [diff] [blame] | 288 | "androidx.test.rules", |
Philip P. Moltmann | 70402ca | 2018-08-28 16:57:52 +0000 | [diff] [blame] | 289 | "dexmaker", |
| 290 | "android-support-v4", |
| 291 | "mockito", |
| 292 | "junit", |
| 293 | "dexmaker-extended-mockmaker", |
| 294 | ], |
| 295 | } |
Sasha Smundak | c71c1f3 | 2019-01-29 12:54:20 -0800 | [diff] [blame] | 296 | |
| 297 | /* |
| 298 | * To run the tests: |
| 299 | * atest DexmakerTests |
| 300 | */ |
| 301 | |
| 302 | android_test { |
| 303 | name: "DexmakerTests", |
| 304 | sdk_version: "current", |
| 305 | static_libs: [ |
| 306 | "dexmaker-tests-lib", |
| 307 | "dexmaker", |
Brett Chabot | 8d384cf | 2019-02-06 21:09:21 -0800 | [diff] [blame] | 308 | "androidx.test.rules", |
Sasha Smundak | c71c1f3 | 2019-01-29 12:54:20 -0800 | [diff] [blame] | 309 | "junit", |
| 310 | ], |
| 311 | } |