| // Copyright (C) 2011 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| package { |
| default_applicable_licenses: ["external_dexmaker_license"], |
| } |
| |
| // Added automatically by a large-scale-change that took the approach of |
| // 'apply every license found to every target'. While this makes sure we respect |
| // every license restriction, it may not be entirely correct. |
| // |
| // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| // |
| // Please consider splitting the single license below into multiple licenses, |
| // taking care not to lose any license_kind information, and overriding the |
| // default license using the 'licenses: [...]' property on targets as needed. |
| // |
| // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| // to attach the license to, and including a comment whether the files may be |
| // used in the current project. |
| // |
| // large-scale-change included anything that looked like it might be a license |
| // text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. |
| // |
| // Please consider removing redundant or irrelevant files from 'license_text:'. |
| // See: http://go/android-license-faq |
| license { |
| name: "external_dexmaker_license", |
| visibility: [":__subpackages__"], |
| license_kinds: [ |
| "SPDX-license-identifier-Apache-2.0", |
| "SPDX-license-identifier-MIT", |
| ], |
| license_text: [ |
| "COPYING", |
| "LICENSE", |
| "NOTICE", |
| ], |
| } |
| |
| java_library_static { |
| name: "dexmaker", |
| |
| // Include all the java files. |
| srcs: ["dexmaker/src/main/java/**/*.java"], |
| |
| static_libs: [ |
| "dexmaker-dx-target", |
| ], |
| |
| sdk_version: "core_current", |
| |
| errorprone: { |
| javacflags: [ |
| "-Xep:EmptyTopLevelDeclaration:WARN", |
| "-Xep:ReturnValueIgnored:WARN", |
| ], |
| }, |
| } |
| |
| // Build Dexmaker's MockMaker, a plugin to Mockito |
| java_library_static { |
| name: "dexmaker-mockmaker", |
| sdk_version: "core_current", |
| srcs: ["dexmaker-mockito/src/main/java/**/*.java"], |
| java_resource_dirs: ["dexmaker-mockito/src/main/resources"], |
| libs: [ |
| "dexmaker", |
| "mockito-api", |
| ], |
| } |
| |
| // Build dispatcher for Dexmaker's inline MockMaker |
| java_library_static { |
| name: "dexmaker-inline-mockmaker-dispatcher", |
| sdk_version: "core_current", |
| srcs: ["dexmaker-mockito-inline-dispatcher/src/main/java/**/*.java"], |
| } |
| |
| // Defaults for agent code. |
| cc_defaults { |
| name: "dexmaker_agent_defaults", |
| |
| // Compile with the NDK, so that the agent can be used in apps. |
| sdk_version: "current", |
| stl: "libc++_static", |
| |
| host_supported: false, |
| device_supported: true, |
| |
| rtti: true, |
| |
| cflags: [ |
| "-std=c++11", |
| "-Wall", |
| "-Werror", |
| "-Wno-unused-parameter", |
| "-Wno-shift-count-overflow", |
| "-Wno-error=non-virtual-dtor", |
| "-Wno-sign-compare", |
| "-Wno-switch", |
| "-Wno-missing-braces", |
| ], |
| |
| static_libs: [ |
| "slicer_ndk", |
| ], |
| |
| shared_libs: [ |
| "libz", |
| ], |
| |
| header_libs: [ |
| "jni_headers", |
| "libopenjdkjvmti_headers", |
| ], |
| } |
| |
| // Build agent for Dexmaker's inline MockMaker |
| cc_library_shared { |
| name: "libdexmakerjvmtiagent", |
| defaults: [ |
| "dexmaker_agent_defaults", |
| ], |
| srcs: ["dexmaker-mockito-inline/src/main/jni/**/*.cc"], |
| min_sdk_version: "29", |
| } |
| |
| // Build agent for Dexmaker's extended MockMaker |
| cc_library_shared { |
| name: "libstaticjvmtiagent", |
| defaults: [ |
| "dexmaker_agent_defaults", |
| ], |
| srcs: ["dexmaker-mockito-inline-extended/src/main/jni/**/*.cc"], |
| min_sdk_version: "29", |
| } |
| |
| // Build agent for Dexmaker's inline tests |
| cc_library_shared { |
| name: "libmultiplejvmtiagentsinterferenceagent", |
| defaults: [ |
| "dexmaker_agent_defaults", |
| ], |
| srcs: ["dexmaker-mockito-inline-tests/src/main/jni/**/*.cc"], |
| } |
| |
| // Build Dexmaker's inline MockMaker, a plugin to Mockito |
| java_library_static { |
| name: "dexmaker-inline-mockmaker", |
| sdk_version: "current", |
| srcs: ["dexmaker-mockito-inline/src/main/java/**/*.java"], |
| java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"], |
| libs: [ |
| "dexmaker", |
| "mockito-api", |
| ], |
| required: ["libdexmakerjvmtiagent"], |
| } |
| |
| // Build Dexmaker's extended MockMaker, a plugin to Mockito |
| java_library_static { |
| name: "dexmaker-extended-mockmaker", |
| sdk_version: "current", |
| srcs: ["dexmaker-mockito-inline-extended/src/main/java/**/*.java"], |
| |
| java_resource_dirs: ["dexmaker-mockito-inline/src/main/resources"], |
| |
| libs: [ |
| "dexmaker", |
| "mockito-api", |
| "dexmaker-inline-mockmaker", |
| ], |
| required: [ |
| "libdexmakerjvmtiagent", |
| "libstaticjvmtiagent", |
| ], |
| |
| errorprone: { |
| javacflags: [ |
| "-Xep:ReturnValueIgnored:WARN", |
| ], |
| }, |
| } |
| |
| // Provides mockito functionality for on-device tests. Does not allow stubbing of final or static |
| // methods. |
| java_library_static { |
| name: "mockito-target", |
| static_libs: [ |
| "mockito-target-minus-junit4", |
| "junit", |
| ], |
| sdk_version: "core_current", |
| } |
| |
| // Same as mockito-target but does not bundle junit |
| java_library_static { |
| name: "mockito-target-minus-junit4", |
| static_libs: [ |
| "mockito", |
| "dexmaker", |
| "dexmaker-mockmaker", |
| "objenesis", |
| ], |
| libs: ["junit"], |
| sdk_version: "core_current", |
| |
| java_version: "1.7", |
| } |
| |
| // Provides mockito functionality for on-device tests. Allows stubbing of final methods. Does not |
| // allow stubbing of static methods. |
| // Project depending on this also need to depend on the static JNI library libdexmakerjvmtiagent |
| java_library_static { |
| name: "mockito-target-inline", |
| static_libs: [ |
| "mockito-target-inline-minus-junit4", |
| "junit", |
| ], |
| sdk_version: "current", |
| } |
| |
| // Same as mockito-target-inline but does not bundle junit |
| java_library_static { |
| name: "mockito-target-inline-minus-junit4", |
| static_libs: [ |
| "mockito", |
| "dexmaker", |
| "dexmaker-inline-mockmaker", |
| "objenesis", |
| ], |
| libs: ["junit"], |
| sdk_version: "current", |
| |
| java_version: "1.7", |
| } |
| |
| // Provides mockito functionality for on-device tests. Allows stubbing of final and static methods. |
| // Stubbing static methods is not an official mockito API. |
| // Project depending on this also need to depend on the static JNI libraries libstaticjvmtiagent and |
| // libdexmakerjvmtiagent |
| java_library_static { |
| name: "mockito-target-extended", |
| static_libs: [ |
| "mockito-target-extended-minus-junit4", |
| "junit", |
| ], |
| sdk_version: "current", |
| } |
| |
| // Same as mockito-target-extended but does not bundle junit |
| java_library_static { |
| name: "mockito-target-extended-minus-junit4", |
| static_libs: [ |
| "mockito", |
| "dexmaker", |
| "dexmaker-inline-mockmaker", |
| "dexmaker-extended-mockmaker", |
| "objenesis", |
| ], |
| libs: ["junit"], |
| sdk_version: "current", |
| |
| java_version: "1.7", |
| } |
| |
| java_import { |
| name: "dexmaker-dx-target", |
| jars: ["lib/dalvik-dx-9.0.0_r3.jar"], |
| } |
| |
| // dexmaker tests |
| java_library_static { |
| name: "dexmaker-tests-lib", |
| sdk_version: "current", |
| srcs: ["dexmaker-tests/src/androidTest/java/**/*.java"], |
| |
| libs: [ |
| "androidx.test.rules", |
| "dexmaker", |
| "junit", |
| ], |
| |
| errorprone: { |
| javacflags: [ |
| "-Xep:ReturnValueIgnored:WARN", |
| ], |
| }, |
| } |
| |
| // dexmaker-mockito tests |
| java_library_static { |
| name: "dexmaker-mockmaker-tests", |
| sdk_version: "current", |
| srcs: ["dexmaker-mockito-tests/src/main/java/**/*.java"], |
| |
| libs: [ |
| "androidx.test.rules", |
| "dexmaker", |
| "mockito", |
| "junit", |
| "dexmaker-mockmaker", |
| ], |
| |
| errorprone: { |
| javacflags: [ |
| "-Xep:ReturnValueIgnored:WARN", |
| ], |
| }, |
| } |
| |
| // dexmaker-mockito-inline tests |
| java_library_static { |
| name: "dexmaker-inline-mockmaker-tests", |
| sdk_version: "current", |
| srcs: ["dexmaker-mockito-inline-tests/src/main/java/**/*.java"], |
| |
| libs: [ |
| "androidx.test.rules", |
| "dexmaker", |
| "android-support-v4", |
| "mockito", |
| "junit", |
| "dexmaker-inline-mockmaker", |
| ], |
| } |
| |
| // dexmaker-mockito-extended tests |
| java_library_static { |
| name: "dexmaker-extended-mockmaker-tests", |
| sdk_version: "current", |
| srcs: ["dexmaker-mockito-inline-extended-tests/src/main/java/**/*.java"], |
| |
| libs: [ |
| "androidx.test.rules", |
| "dexmaker", |
| "android-support-v4", |
| "mockito", |
| "junit", |
| "dexmaker-extended-mockmaker", |
| ], |
| } |
| |
| /* |
| * To run the tests: |
| * atest DexmakerTests |
| */ |
| |
| android_test { |
| name: "DexmakerTests", |
| sdk_version: "current", |
| static_libs: [ |
| "dexmaker-tests-lib", |
| "dexmaker", |
| "androidx.test.rules", |
| "junit", |
| ], |
| } |