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