1# -*- mode: makefile -*-
2
3LOCAL_PATH := $(call my-dir)
4
5define all-harmony-test-java-files-under
6  $(foreach dir,$(1),$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(dir)/$(2) -name "*.java" 2> /dev/null)))
7endef
8
9harmony_test_dirs := \
10    archive \
11    beans \
12    logging \
13    luni \
14    prefs \
15    sql \
16    support \
17    text \
18
19# TODO: get these working too!
20#    auth \
21#    crypto \
22#    security \
23#    x-net
24
25harmony_test_src_files := \
26    $(call all-harmony-test-java-files-under,$(harmony_test_dirs),src/test/java) \
27    $(call all-harmony-test-java-files-under,$(harmony_test_dirs),src/test/support/java) \
28    $(call all-harmony-test-java-files-under,luni,src/test/api/common) \
29    $(call all-harmony-test-java-files-under,luni,src/test/api/unix) \
30    $(call all-harmony-test-java-files-under,luni,src/test/impl/common) \
31    $(call all-harmony-test-java-files-under,luni,src/test/impl/unix)
32
33# We need to use -maxdepth 4 because there's a non-resource directory called "resources" deeper in the tree.
34define harmony-test-resource-dirs
35  $(shell cd $(LOCAL_PATH) && find . -maxdepth 4 -name resources 2> /dev/null)
36endef
37harmony_test_resource_dirs := \
38    $(call harmony-test-resource-dirs,$(harmony_test_dirs)) \
39    $(call harmony-test-resource-dirs,luni)
40
41harmony_test_javac_flags=-encoding UTF-8
42harmony_test_javac_flags+=-Xmaxwarns 9999999
43
44include $(CLEAR_VARS)
45LOCAL_SRC_FILES := $(harmony_test_src_files)
46LOCAL_JAVA_RESOURCE_DIRS := $(harmony_test_resource_dirs)
47LOCAL_NO_STANDARD_LIBRARIES := true
48LOCAL_JAVA_LIBRARIES := core core-junit
49LOCAL_JAVACFLAGS := $(harmony_test_javac_flags)
50LOCAL_MODULE_TAGS := tests
51LOCAL_MODULE := apache-harmony-tests
52LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
53include $(BUILD_STATIC_JAVA_LIBRARY)
54
55ifeq ($(WITH_HOST_DALVIK),true)
56    include $(CLEAR_VARS)
57    LOCAL_SRC_FILES := $(harmony_test_src_files)
58    LOCAL_JAVA_RESOURCE_DIRS := $(harmony_test_resource_dirs)
59    LOCAL_NO_STANDARD_LIBRARIES := true
60    LOCAL_JAVA_LIBRARIES := core-hostdex core-junit-hostdex
61    LOCAL_JAVACFLAGS := $(harmony_test_javac_flags)
62    LOCAL_MODULE := apache-harmony-tests-hostdex
63    LOCAL_BUILD_HOST_DEX := true
64    include $(BUILD_HOST_JAVA_LIBRARY)
65endif
66