Home | History | Annotate | Download | only in junit
      1 # Copyright (C) 2009 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 # include definition of core-junit-files
     20 include $(LOCAL_PATH)/Common.mk
     21 
     22 # note: ideally this should be junit-host, but leave as is for now to avoid
     23 # changing all its dependencies
     24 include $(CLEAR_VARS)
     25 LOCAL_SRC_FILES := $(call all-java-files-under, src)
     26 LOCAL_MODULE := junit
     27 LOCAL_MODULE_TAGS := optional
     28 LOCAL_STATIC_JAVA_LIBRARIES := hamcrest-host
     29 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
     30 include $(BUILD_HOST_JAVA_LIBRARY)
     31 
     32 # ----------------------------------
     33 # build a junit-targetdex jar
     34 
     35 include $(CLEAR_VARS)
     36 LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions)
     37 LOCAL_SRC_FILES += $(core-junit-files)
     38 LOCAL_SRC_FILES += $(junit-runner-files)
     39 LOCAL_MODULE := junit-targetdex # TODO: lose the suffix here and rename "junit" to "junit-hostdex"
     40 LOCAL_NO_STANDARD_LIBRARIES := true
     41 LOCAL_JAVA_LIBRARIES := core-libart
     42 LOCAL_MODULE_TAGS := tests
     43 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/junit
     44 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
     45 include $(BUILD_JAVA_LIBRARY)
     46 
     47 # ----------------------------------
     48 # build a junit-hostdex jar
     49 
     50 ifeq ($(HOST_OS),linux)
     51 include $(CLEAR_VARS)
     52 LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions)
     53 LOCAL_SRC_FILES += $(core-junit-files)
     54 LOCAL_SRC_FILES += $(junit-runner-files)
     55 LOCAL_MODULE := junit-hostdex
     56 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
     57 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
     58 endif # HOST_OS == linux
     59 
     60 # ----------------------------------
     61 # build a core-junit target jar that is built into Android system image
     62 
     63 # TODO: remove extensions once core-tests is no longer dependent on it
     64 include $(CLEAR_VARS)
     65 LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions)
     66 LOCAL_SRC_FILES += $(core-junit-files)
     67 LOCAL_NO_STANDARD_LIBRARIES := true
     68 LOCAL_JAVA_LIBRARIES := core-libart
     69 LOCAL_MODULE_TAGS := optional
     70 LOCAL_MODULE := core-junit
     71 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
     72 include $(BUILD_JAVA_LIBRARY)
     73 
     74 # ----------------------------------
     75 # build a core-junit-hostdex jar that contains exactly the same classes
     76 # as core-junit.
     77 
     78 ifeq ($(HOST_OS),linux)
     79 include $(CLEAR_VARS)
     80 # TODO: remove extensions once apache-harmony/luni/ is no longer dependent
     81 # on it
     82 LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions)
     83 LOCAL_SRC_FILES += $(core-junit-files)
     84 LOCAL_MODULE_TAGS := optional
     85 LOCAL_MODULE := core-junit-hostdex
     86 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
     87 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
     88 endif # HOST_OS == linux
     89 
     90 #-------------------------------------------------------
     91 # build a junit-runner jar for the host JVM
     92 # (like the junit classes in the frameworks/base android.test.runner.jar)
     93 
     94 include $(CLEAR_VARS)
     95 LOCAL_SRC_FILES := $(junit-runner-files)
     96 LOCAL_MODULE := junit-runner
     97 LOCAL_NO_STANDARD_LIBRARIES := true
     98 LOCAL_JAVA_LIBRARIES := core-libart core-junit
     99 LOCAL_MODULE_TAGS := optional
    100 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
    101 include $(BUILD_STATIC_JAVA_LIBRARY)
    102 
    103 #-------------------------------------------------------
    104 # build a junit-runner for the host dalvikvm
    105 # (like the junit classes in the frameworks/base android.test.runner.jar)
    106 
    107 include $(CLEAR_VARS)
    108 LOCAL_SRC_FILES := $(junit-runner-files)
    109 LOCAL_MODULE := junit-runner-hostdex
    110 LOCAL_MODULE_TAGS := optional
    111 LOCAL_NO_STANDARD_LIBRARIES := true
    112 LOCAL_JAVA_LIBRARIES := core-libart-hostdex core-junit-hostdex
    113 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
    114 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
    115 
    116 #-------------------------------------------------------
    117 # build a junit4-target jar representing the
    118 # classes in external/junit that are not in the core public API 4
    119 # Note: 'core' here means excluding the classes that are contained
    120 # in the optional library android.test.runner. Developers who
    121 # build against this jar shouldn't have to also include android.test.runner
    122 
    123 include $(CLEAR_VARS)
    124 LOCAL_SRC_FILES := $(junit4-target-src)
    125 LOCAL_MODULE := junit4-target
    126 LOCAL_MODULE_TAGS := optional
    127 LOCAL_SDK_VERSION := 4
    128 LOCAL_STATIC_JAVA_LIBRARIES := hamcrest
    129 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
    130 include $(BUILD_STATIC_JAVA_LIBRARY)
    131 
    132 #-------------------------------------------------------
    133 # Same as above, but does not statically link in dependencies
    134 
    135 include $(CLEAR_VARS)
    136 LOCAL_SRC_FILES := $(junit4-target-src)
    137 LOCAL_MODULE := junit4-target-nodeps
    138 LOCAL_MODULE_TAGS := optional
    139 LOCAL_SDK_VERSION := 4
    140 LOCAL_JAVA_LIBRARIES := hamcrest
    141 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk
    142 include $(BUILD_STATIC_JAVA_LIBRARY)
    143