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    beans \
11    logging \
12    luni \
13    sql \
14    support \
15
16# TODO: get these working too!
17#    crypto \
18#    security \
19#    x-net
20
21harmony_test_src_files := \
22    $(call all-harmony-test-java-files-under,$(harmony_test_dirs),src/test/java) \
23    $(call all-harmony-test-java-files-under,$(harmony_test_dirs),src/test/support/java) \
24    $(call all-harmony-test-java-files-under,luni,src/test/api/common) \
25    $(call all-harmony-test-java-files-under,luni,src/test/api/unix) \
26    $(call all-harmony-test-java-files-under,luni,src/test/impl/common) \
27    $(call all-harmony-test-java-files-under,luni,src/test/impl/unix)
28
29# We need to use -maxdepth 4 because there's a non-resource directory called "resources" deeper in the tree.
30define harmony-test-resource-dirs
31  $(foreach dir,$(1),$(patsubst %,./%,$(shell cd $(LOCAL_PATH) && find $(dir) -maxdepth 4 -name resources 2> /dev/null)))
32endef
33
34harmony_test_resource_dirs := $(call harmony-test-resource-dirs,$(harmony_test_dirs))
35
36harmony_test_javac_flags:=-Xmaxwarns 9999999
37
38include $(CLEAR_VARS)
39LOCAL_SRC_FILES := $(harmony_test_src_files)
40LOCAL_JAVA_RESOURCE_DIRS := $(harmony_test_resource_dirs)
41LOCAL_NO_STANDARD_LIBRARIES := true
42LOCAL_JAVA_LIBRARIES := core-oj core-libart core-junit
43LOCAL_JAVACFLAGS := $(harmony_test_javac_flags)
44LOCAL_MODULE := apache-harmony-tests
45LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
46LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
47include $(BUILD_STATIC_JAVA_LIBRARY)
48
49ifeq ($(HOST_OS),linux)
50include $(CLEAR_VARS)
51LOCAL_SRC_FILES := $(harmony_test_src_files)
52LOCAL_JAVA_RESOURCE_DIRS := $(harmony_test_resource_dirs)
53LOCAL_NO_STANDARD_LIBRARIES := true
54LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex core-junit-hostdex
55LOCAL_JAVACFLAGS := $(harmony_test_javac_flags)
56LOCAL_MODULE := apache-harmony-tests-hostdex
57LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
58include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
59endif  # HOST_OS == linux
60
61include $(call all-makefiles-under,$(LOCAL_PATH))
62