Home | History | Annotate | Download | only in mockito
      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 
     17 LOCAL_PATH := $(call my-dir)
     18 
     19 ###################################################################
     20 # Host build
     21 ###################################################################
     22 
     23 include $(CLEAR_VARS)
     24 
     25 LOCAL_SRC_FILES := \
     26     $(call all-java-files-under, src) \
     27     $(call all-java-files-under, cglib-and-asm/src)
     28 
     29 LOCAL_JAVA_LIBRARIES := junit objenesis-host ant
     30 LOCAL_MODULE := mockito-host
     31 LOCAL_MODULE_TAGS := optional
     32 LOCAL_JAVA_LANGUAGE_VERSION := 1.7
     33 include $(BUILD_HOST_JAVA_LIBRARY)
     34 
     35 
     36 ###################################################################
     37 # Target build
     38 ###################################################################
     39 
     40 # Builds the Mockito source code, but does not include any run-time
     41 # dependencies. Most projects should use mockito-target instead, which includes
     42 # everything needed to run Mockito tests.
     43 include $(CLEAR_VARS)
     44 
     45 # Exclude source used to dynamically create classes since target builds use 
     46 # dexmaker instead and including it causes conflicts.
     47 explicit_target_excludes := \
     48     src/org/mockito/internal/creation/AbstractMockitoMethodProxy.java \
     49     src/org/mockito/internal/creation/AcrossJVMSerializationFeature.java \
     50     src/org/mockito/internal/creation/CglibMockMaker.java \
     51     src/org/mockito/internal/creation/DelegatingMockitoMethodProxy.java \
     52     src/org/mockito/internal/creation/MethodInterceptorFilter.java \
     53     src/org/mockito/internal/creation/MockitoMethodProxy.java \
     54     src/org/mockito/internal/creation/SerializableMockitoMethodProxy.java \
     55     src/org/mockito/internal/invocation/realmethod/FilteredCGLIBProxyRealMethod.java \
     56     src/org/mockito/internal/invocation/realmethod/CGLIBProxyRealMethod.java \
     57     src/org/mockito/internal/invocation/realmethod/HasCGLIBMethodProxy.java
     58 
     59 target_src_files := \
     60     $(call all-java-files-under, src)
     61 target_src_files := \
     62     $(filter-out src/org/mockito/internal/creation/cglib/%, $(target_src_files))
     63 target_src_files := \
     64     $(filter-out src/org/mockito/internal/creation/jmock/%, $(target_src_files))
     65 target_src_files := \
     66     $(filter-out $(explicit_target_excludes), $(target_src_files))
     67 
     68 LOCAL_SRC_FILES := $(target_src_files)
     69 LOCAL_JAVA_LIBRARIES := junit4-target objenesis-target
     70 LOCAL_MODULE := mockito-api
     71 LOCAL_SDK_VERSION := 10
     72 LOCAL_MODULE_TAGS := optional
     73 include $(BUILD_STATIC_JAVA_LIBRARY)
     74 
     75 # Main target for dependent projects. Bundles all the run-time dependencies
     76 # needed to run Mockito tests on the device.
     77 include $(CLEAR_VARS)
     78 
     79 LOCAL_MODULE := mockito-target
     80 LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 junit4-target
     81 LOCAL_SDK_VERSION := 10
     82 LOCAL_MODULE_TAGS := optional
     83 include $(BUILD_STATIC_JAVA_LIBRARY)
     84 
     85 # A mockito target that doesn't pull in junit4-target. This is used to work around
     86 # issues caused by multiple copies of junit4 in the classpath, usually when a test
     87 # using mockito is run using android.test.runner.
     88 include $(CLEAR_VARS)
     89 LOCAL_MODULE := mockito-target-minus-junit4
     90 LOCAL_STATIC_JAVA_LIBRARIES := mockito-api dexmaker dexmaker-mockmaker objenesis-target
     91 LOCAL_JAVA_LIBRARIES := junit4-target
     92 LOCAL_SDK_VERSION := 10
     93 LOCAL_MODULE_TAGS := optional
     94 include $(BUILD_STATIC_JAVA_LIBRARY)
     95 
     96 
     97 ###################################################################
     98 # Host build
     99 ###################################################################
    100 
    101 # Builds the Mockito source code, but does not include any run-time
    102 # dependencies. Since host modules are not compiled against the SDK,
    103 # an explicit inclusion of core-junit-hostdex is needed in contrast
    104 # with the target module above.
    105 ifeq ($(HOST_OS),linux)
    106 include $(CLEAR_VARS)
    107 LOCAL_SRC_FILES := $(target_src_files)
    108 LOCAL_JAVA_LIBRARIES := core-junit-hostdex junit4-target-hostdex \
    109     objenesis-hostdex
    110 LOCAL_MODULE := mockito-api-hostdex
    111 LOCAL_MODULE_TAGS := optional
    112 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
    113 endif # HOST_OS == linux
    114 
    115 
    116 ###################################################
    117 # Clean up temp vars
    118 ###################################################
    119 explicit_target_excludes :=
    120 target_src_files :=
    121