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 15package { 16 default_applicable_licenses: ["external_dexmaker_license"], 17} 18 19// Added automatically by a large-scale-change that took the approach of 20// 'apply every license found to every target'. While this makes sure we respect 21// every license restriction, it may not be entirely correct. 22// 23// e.g. GPL in an MIT project might only apply to the contrib/ directory. 24// 25// Please consider splitting the single license below into multiple licenses, 26// taking care not to lose any license_kind information, and overriding the 27// default license using the 'licenses: [...]' property on targets as needed. 28// 29// For unused files, consider creating a 'fileGroup' with "//visibility:private" 30// to attach the license to, and including a comment whether the files may be 31// used in the current project. 32// 33// large-scale-change included anything that looked like it might be a license 34// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 35// 36// Please consider removing redundant or irrelevant files from 'license_text:'. 37// See: http://go/android-license-faq 38license { 39 name: "external_dexmaker_license", 40 visibility: [":__subpackages__"], 41 license_kinds: [ 42 "SPDX-license-identifier-Apache-2.0", 43 "SPDX-license-identifier-MIT", 44 ], 45 license_text: [ 46 "COPYING", 47 "LICENSE", 48 "NOTICE", 49 ], 50} 51 52java_library_static { 53 name: "dexmaker", 54 55 // Include all the java files. 56 srcs: ["dexmaker/src/main/java/**/*.java"], 57 58 static_libs: [ 59 "dexmaker-dx-target", 60 ], 61 62 sdk_version: "core_current", 63} 64 65// Build Dexmaker's MockMaker, a plugin to Mockito 66java_library_static { 67 name: "dexmaker-mockmaker", 68 sdk_version: "core_current", 69 srcs: ["dexmaker-mockito/src/main/java/**/*.java"], 70 java_resource_dirs: ["dexmaker-mockito/src/main/resources"], 71 libs: [ 72 "dexmaker", 73 "mockito-api", 74 ], 75} 76 77// Build dispatcher for Dexmaker's inline MockMaker 78java_library_static { 79 name: "dexmaker-inline-mockmaker-dispatcher", 80 sdk_version: "core_current", 81 srcs: ["dexmaker-mockito-inline-dispatcher/src/main/java/**/*.java"], 82} 83 84// Defaults for agent code. 85cc_defaults { 86 name: "dexmaker_agent_defaults", 87 88 // Compile with the NDK, so that the agent can be used in apps. 89 sdk_version: "current", 90 stl: "libc++_static", 91 92 host_supported: false, 93 device_supported: true, 94 95 rtti: true, 96 97 cflags: [ 98 "-std=c++11", 99 "-Wall", 100 "-Werror", 101 "-Wno-unused-parameter", 102 "-Wno-shift-count-overflow", 103 "-Wno-error=non-virtual-dtor", 104 "-Wno-sign-compare", 105 "-Wno-switch", 106 "-Wno-missing-braces", 107 ], 108 109 static_libs: [ 110 "slicer_ndk", 111 ], 112 113 shared_libs: [ 114 "libz", 115 ], 116 117 header_libs: [ 118 "jni_headers", 119 "libopenjdkjvmti_headers", 120 ], 121} 122 123// Build agent for Dexmaker's inline MockMaker 124cc_library_shared { 125 name: "libdexmakerjvmtiagent", 126 defaults: [ 127 "dexmaker_agent_defaults", 128 ], 129 srcs: ["dexmaker-mockito-inline/src/main/jni/**/*.cc"], 130} 131 132// Build agent for Dexmaker's extended MockMaker 133cc_library_shared { 134 name: "libstaticjvmtiagent", 135 defaults: [ 136 "dexmaker_agent_defaults", 137 ], 138 srcs: ["dexmaker-mockito-inline-extended/src/main/jni/**/*.cc"], 139} 140 141// Build agent for Dexmaker's inline tests 142cc_library_shared { 143 name: "libmultiplejvmtiagentsinterferenceagent", 144 defaults: [ 145 "dexmaker_agent_defaults", 146 ], 147 srcs: ["dexmaker-mockito-inline-tests/src/main/jni/**/*.cc"], 148} 149 150// Build Dexmaker's inline MockMaker, a plugin to Mockito 151java_library_static { 152 name: "dexmaker-inline-mockmaker", 153 sdk_version: "current", 154 srcs: ["dexmaker-mockito-inline/src/main/java/**/*.java"], 155 java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"], 156 libs: [ 157 "dexmaker", 158 "mockito-api", 159 ], 160 required: ["libdexmakerjvmtiagent"], 161} 162 163// Build Dexmaker's extended MockMaker, a plugin to Mockito 164java_library_static { 165 name: "dexmaker-extended-mockmaker", 166 sdk_version: "current", 167 srcs: ["dexmaker-mockito-inline-extended/src/main/java/**/*.java"], 168 169 java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"], 170 171 libs: [ 172 "dexmaker", 173 "mockito-api", 174 "dexmaker-inline-mockmaker", 175 ], 176 required: [ 177 "libdexmakerjvmtiagent", 178 "libstaticjvmtiagent", 179 ], 180} 181 182// Provides mockito functionality for on-device tests. Does not allow stubbing of final or static 183// methods. 184java_library_static { 185 name: "mockito-target", 186 static_libs: [ 187 "mockito-target-minus-junit4", 188 "junit", 189 ], 190 sdk_version: "core_current", 191} 192 193// Same as mockito-target but does not bundle junit 194java_library_static { 195 name: "mockito-target-minus-junit4", 196 static_libs: [ 197 "mockito", 198 "dexmaker", 199 "dexmaker-mockmaker", 200 "objenesis", 201 ], 202 libs: ["junit"], 203 sdk_version: "core_current", 204 205 java_version: "1.7", 206} 207 208// Provides mockito functionality for on-device tests. Allows stubbing of final methods. Does not 209// allow stubbing of static methods. 210// Project depending on this also need to depend on the static JNI library libdexmakerjvmtiagent 211java_library_static { 212 name: "mockito-target-inline", 213 static_libs: [ 214 "mockito-target-inline-minus-junit4", 215 "junit", 216 ], 217 sdk_version: "current", 218} 219 220// Same as mockito-target-inline but does not bundle junit 221java_library_static { 222 name: "mockito-target-inline-minus-junit4", 223 static_libs: [ 224 "mockito", 225 "dexmaker", 226 "dexmaker-inline-mockmaker", 227 "objenesis", 228 ], 229 libs: ["junit"], 230 sdk_version: "current", 231 232 java_version: "1.7", 233} 234 235// Provides mockito functionality for on-device tests. Allows stubbing of final and static methods. 236// Stubbing static methods is not an official mockito API. 237// Project depending on this also need to depend on the static JNI libraries libstaticjvmtiagent and 238// libdexmakerjvmtiagent 239java_library_static { 240 name: "mockito-target-extended", 241 static_libs: [ 242 "mockito-target-extended-minus-junit4", 243 "junit", 244 ], 245 sdk_version: "current", 246} 247 248// Same as mockito-target-extended but does not bundle junit 249java_library_static { 250 name: "mockito-target-extended-minus-junit4", 251 static_libs: [ 252 "mockito", 253 "dexmaker", 254 "dexmaker-inline-mockmaker", 255 "dexmaker-extended-mockmaker", 256 "objenesis", 257 ], 258 libs: ["junit"], 259 sdk_version: "current", 260 261 java_version: "1.7", 262} 263 264java_import { 265 name: "dexmaker-dx-target", 266 jars: ["lib/dalvik-dx-9.0.0_r3.jar"], 267} 268 269// dexmaker tests 270java_library_static { 271 name: "dexmaker-tests-lib", 272 sdk_version: "current", 273 srcs: ["dexmaker-tests/src/androidTest/java/**/*.java"], 274 275 libs: [ 276 "androidx.test.rules", 277 "dexmaker", 278 "junit", 279 ], 280} 281 282// dexmaker-mockito tests 283java_library_static { 284 name: "dexmaker-mockmaker-tests", 285 sdk_version: "current", 286 srcs: ["dexmaker-mockito-tests/src/main/java/**/*.java"], 287 288 libs: [ 289 "androidx.test.rules", 290 "dexmaker", 291 "mockito", 292 "junit", 293 "dexmaker-mockmaker", 294 ], 295} 296 297// dexmaker-mockito-inline tests 298java_library_static { 299 name: "dexmaker-inline-mockmaker-tests", 300 sdk_version: "current", 301 srcs: ["dexmaker-mockito-inline-tests/src/main/java/**/*.java"], 302 303 libs: [ 304 "androidx.test.rules", 305 "dexmaker", 306 "android-support-v4", 307 "mockito", 308 "junit", 309 "dexmaker-inline-mockmaker", 310 ], 311} 312 313// dexmaker-mockito-extended tests 314java_library_static { 315 name: "dexmaker-extended-mockmaker-tests", 316 sdk_version: "current", 317 srcs: ["dexmaker-mockito-inline-extended-tests/src/main/java/**/*.java"], 318 319 libs: [ 320 "androidx.test.rules", 321 "dexmaker", 322 "android-support-v4", 323 "mockito", 324 "junit", 325 "dexmaker-extended-mockmaker", 326 ], 327} 328 329/* 330 * To run the tests: 331 * atest DexmakerTests 332 */ 333 334android_test { 335 name: "DexmakerTests", 336 sdk_version: "current", 337 static_libs: [ 338 "dexmaker-tests-lib", 339 "dexmaker", 340 "androidx.test.rules", 341 "junit", 342 ], 343} 344