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
17LOCAL_PATH := $(call my-dir)
18
19###################################################################
20# Host build
21###################################################################
22
23include $(CLEAR_VARS)
24
25LOCAL_SRC_FILES := \
26    $(call all-java-files-under, src) \
27    $(call all-java-files-under, cglib-and-asm/src)
28
29LOCAL_JAVA_LIBRARIES := junit objenesis-host ant
30LOCAL_MODULE := mockito-host
31LOCAL_MODULE_TAGS := optional
32include $(BUILD_HOST_JAVA_LIBRARY)
33
34
35###################################################################
36# Target build
37###################################################################
38
39# Builds the Mockito source code, but does not include any run-time
40# dependencies. Most projects should use mockito-target instead, which includes
41# everything needed to run Mockito tests.
42include $(CLEAR_VARS)
43
44# Exclude source used to dynamically create classes since target builds use
45# dexmaker instead and including it causes conflicts.
46explicit_target_excludes := \
47    src/org/mockito/internal/creation/AbstractMockitoMethodProxy.java \
48    src/org/mockito/internal/creation/AcrossJVMSerializationFeature.java \
49    src/org/mockito/internal/creation/CglibMockMaker.java \
50    src/org/mockito/internal/creation/DelegatingMockitoMethodProxy.java \
51    src/org/mockito/internal/creation/MethodInterceptorFilter.java \
52    src/org/mockito/internal/creation/MockitoMethodProxy.java \
53    src/org/mockito/internal/creation/SerializableMockitoMethodProxy.java \
54    src/org/mockito/internal/invocation/realmethod/FilteredCGLIBProxyRealMethod.java \
55    src/org/mockito/internal/invocation/realmethod/CGLIBProxyRealMethod.java \
56    src/org/mockito/internal/invocation/realmethod/HasCGLIBMethodProxy.java
57
58target_src_files := \
59    $(call all-java-files-under, src)
60target_src_files := \
61    $(filter-out src/org/mockito/internal/creation/cglib/%, $(target_src_files))
62target_src_files := \
63    $(filter-out src/org/mockito/internal/creation/jmock/%, $(target_src_files))
64target_src_files := \
65    $(filter-out $(explicit_target_excludes), $(target_src_files))
66
67LOCAL_SRC_FILES := $(target_src_files)
68LOCAL_JAVA_LIBRARIES := junit4-target objenesis-target
69LOCAL_MODULE := mockito-api
70LOCAL_SDK_VERSION := 10
71LOCAL_MODULE_TAGS := optional
72include $(BUILD_STATIC_JAVA_LIBRARY)
73
74# Main target for dependent projects. Bundles all the run-time dependencies
75# needed to run Mockito tests on the device.
76include $(CLEAR_VARS)
77
78LOCAL_MODULE := mockito-target
79LOCAL_STATIC_JAVA_LIBRARIES := mockito-api dexmaker dexmaker-mockmaker \
80    objenesis-target junit4-target
81LOCAL_SDK_VERSION := 10
82LOCAL_MODULE_TAGS := optional
83include $(BUILD_STATIC_JAVA_LIBRARY)
84
85###################################################
86# Clean up temp vars
87###################################################
88explicit_target_excludes :=
89target_src_files :=
90