• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/main/java)
27
28LOCAL_JAVA_LIBRARIES := junit-host objenesis-host
29LOCAL_STATIC_JAVA_LIBRARIES := \
30    mockito-byte-buddy-host \
31    mockito-byte-buddy-agent-host
32LOCAL_MODULE := mockito-host
33LOCAL_MODULE_TAGS := optional
34LOCAL_JAVA_LANGUAGE_VERSION := 1.7
35include $(BUILD_HOST_JAVA_LIBRARY)
36
37###################################################################
38# Target build
39###################################################################
40
41# Builds the Mockito source code, but does not include any run-time
42# dependencies. Most projects should use mockito-target instead, which includes
43# everything needed to run Mockito tests.
44include $(CLEAR_VARS)
45
46# Exclude source used to dynamically create classes since target builds use
47# dexmaker instead and including it causes conflicts.
48target_src_files := \
49    $(call all-java-files-under, src/main/java)
50target_src_files := \
51    $(filter-out src/main/java/org/mockito/internal/creation/bytebuddy/%, $(target_src_files))
52
53LOCAL_SRC_FILES := $(target_src_files)
54LOCAL_JAVA_LIBRARIES := junit objenesis-target
55LOCAL_MODULE := mockito-api
56LOCAL_SDK_VERSION := 16
57LOCAL_MODULE_TAGS := optional
58include $(BUILD_STATIC_JAVA_LIBRARY)
59
60# Main target for dependent projects. Bundles all the run-time dependencies
61# needed to run Mockito tests on the device.
62include $(CLEAR_VARS)
63
64LOCAL_MODULE := mockito-target
65LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 junit
66LOCAL_SDK_VERSION := 16
67LOCAL_MODULE_TAGS := optional
68include $(BUILD_STATIC_JAVA_LIBRARY)
69
70# A mockito target that doesn't pull in junit. This is used to work around
71# issues caused by multiple copies of junit in the classpath, usually when a test
72# using mockito is run using android.test.runner.
73include $(CLEAR_VARS)
74LOCAL_MODULE := mockito-target-minus-junit4
75LOCAL_STATIC_JAVA_LIBRARIES := mockito-api dexmaker dexmaker-mockmaker objenesis-target
76LOCAL_JAVA_LIBRARIES := junit
77LOCAL_SDK_VERSION := 16
78LOCAL_MODULE_TAGS := optional
79LOCAL_JAVA_LANGUAGE_VERSION := 1.7
80include $(BUILD_STATIC_JAVA_LIBRARY)
81
82
83###################################################################
84# Host build
85###################################################################
86
87# Builds the Mockito source code, but does not include any run-time
88# dependencies.
89ifeq ($(HOST_OS),linux)
90include $(CLEAR_VARS)
91LOCAL_SRC_FILES := $(target_src_files)
92LOCAL_JAVA_LIBRARIES := \
93    junit-hostdex \
94    objenesis-hostdex
95LOCAL_MODULE := mockito-api-hostdex
96LOCAL_MODULE_TAGS := optional
97include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
98endif # HOST_OS == linux
99
100# Host prebuilt dependencies.
101# ============================================================
102include $(CLEAR_VARS)
103
104LOCAL_PREBUILT_JAVA_LIBRARIES := \
105    mockito-byte-buddy-host:lib/byte-buddy-1.6.9$(COMMON_JAVA_PACKAGE_SUFFIX) \
106    mockito-byte-buddy-agent-host:lib/byte-buddy-agent-1.6.9$(COMMON_JAVA_PACKAGE_SUFFIX) \
107
108include $(BUILD_HOST_PREBUILT)
109
110###################################################
111# Clean up temp vars
112###################################################
113explicit_target_excludes :=
114target_src_files :=
115