1##############################################
2# Compile Robolectric robolectric
3##############################################
4LOCAL_PATH := $(call my-dir)
5include $(CLEAR_VARS)
6
7LOCAL_MODULE := Robolectric_robolectric
8LOCAL_MODULE_CLASS := JAVA_LIBRARIES
9LOCAL_IS_HOST_MODULE := true
10
11intermediates := $(call local-intermediates-dir)
12
13LOCAL_JAVA_LIBRARIES := \
14  Robolectric_shadows_framework \
15  Robolectric_annotations \
16  Robolectric_shadowapi \
17  Robolectric_resources \
18  Robolectric_sandbox \
19  Robolectric_junit \
20  Robolectric_utils \
21  robolectric-host-android_all \
22  robolectric-host-androidx-test-ext-junit \
23  robolectric-host-androidx-test-monitor \
24  robolectric-host-monitor-1.0.2-alpha1 \
25  robolectric-maven-ant-tasks-2.1.3 \
26  robolectric-bouncycastle-1.46 \
27  robolectric-asm-commons-6.0 \
28  robolectric-guava-25.1-jre \
29  robolectric-xstream-1.4.8 \
30  robolectric-asm-tree-6.0 \
31  robolectric-junit-4.12 \
32  robolectric-ant-1.8.0 \
33  robolectric-asm-6.0 \
34  jsr305
35
36LOCAL_SRC_FILES := $(call all-java-files-under, src/main/java)
37
38$(intermediates)/robolectric-version.properties:
39	$(hide) echo -n "robolectric.version=4.0-SNAPSHOT" >$@
40
41LOCAL_JAVA_RESOURCE_FILES := $(intermediates)/robolectric-version.properties
42
43include $(BUILD_HOST_JAVA_LIBRARY)
44
45##############################################
46# Compile Robolectric robolectric tests
47##############################################
48include $(CLEAR_VARS)
49
50LOCAL_MODULE := Robolectric_robolectric_tests
51
52LOCAL_SRC_FILES := $(call all-java-files-under, src/test/java)
53
54LOCAL_JAVA_RESOURCE_DIRS := src/test/resources
55
56LOCAL_JAVA_LIBRARIES := \
57  Robolectric_shadows_framework \
58  Robolectric_annotations \
59  Robolectric_robolectric \
60  Robolectric_resources \
61  Robolectric_shadowapi \
62  Robolectric_sandbox \
63  Robolectric_junit \
64  Robolectric_utils \
65  robolectric-host-androidx-test-ext-junit \
66  robolectric-host-androidx-test-monitor \
67  robolectric-host-monitor-1.0.2-alpha1 \
68  robolectric-host-androidx-test-core \
69  robolectric-maven-ant-tasks-2.1.3 \
70  robolectric-mockito-core-2.16.0 \
71  robolectric-bouncycastle-1.46 \
72  robolectric-hamcrest-core-1.3 \
73  robolectric-sqlite4java-0.282 \
74  robolectric-host-android_all \
75  robolectric-guava-25.1-jre \
76  robolectric-junit-4.12 \
77  robolectric-truth-0.42 \
78  robolectric-ant-1.8.0 \
79  jsr305
80
81include $(BUILD_HOST_JAVA_LIBRARY)
82
83##############################################
84# Execute Robolectric robolectric tests
85##############################################
86include $(CLEAR_VARS)
87
88LOCAL_MODULE := Run_robolectric_robolectric_tests
89
90test_source_directory := $(LOCAL_PATH)/src/test/java
91
92test_resources_directory := $(LOCAL_PATH)/src/test/resources
93
94test_runtime_libraries := \
95  Robolectric_robolectric_tests \
96  Robolectric_shadows_framework \
97  Robolectric_annotations \
98  Robolectric_robolectric \
99  Robolectric_resources \
100  Robolectric_shadowapi \
101  Robolectric_sandbox \
102  Robolectric_junit \
103  Robolectric_utils \
104  robolectric-host-androidx-test-ext-junit \
105  robolectric-host-androidx-test-monitor \
106  robolectric-host-monitor-1.0.2-alpha1 \
107  robolectric-host-androidx-test-core \
108  robolectric-byte-buddy-agent-1.6.5 \
109  robolectric-maven-ant-tasks-2.1.3 \
110  robolectric-mockito-core-2.16.0 \
111  robolectric-bouncycastle-1.46 \
112  robolectric-hamcrest-core-1.3 \
113  robolectric-sqlite4java-0.282 \
114  robolectric-byte-buddy-1.6.5 \
115  robolectric-host-android_all \
116  robolectric-asm-commons-6.0 \
117  robolectric-diffutils-1.3.0 \
118  robolectric-guava-25.1-jre \
119  robolectric-objenesis-2.5 \
120  robolectric-xstream-1.4.8 \
121  robolectric-asm-tree-6.0 \
122  robolectric-junit-4.12 \
123  robolectric-icu4j-53.1 \
124  robolectric-truth-0.42 \
125  robolectric-ant-1.8.0 \
126  robolectric-asm-6.0 \
127  jsr305
128
129include external/robolectric-shadows/run_robolectric_module_tests.mk
130
131###########################################
132# HACK: specify these *TARGET* jars needed to compile robolectric as though they are prebuilt *HOST* java libraries
133###########################################
134robolectric_target_to_host_jars := \
135  robolectric-host-android_all:$(call intermediates-dir-for, JAVA_LIBRARIES, robolectric_android-all-stub,,COMMON)/classes-with-res.jar \
136  robolectric-host-androidx-test-core:$(call java-lib-files, androidx.test.core) \
137  robolectric-host-androidx-test-ext-junit:$(call java-lib-files, androidx.test.ext.junit) \
138  robolectric-host-androidx-test-monitor:$(call java-lib-files, androidx.test.monitor) \
139  robolectric-host-androidx-test-runner:$(call java-lib-files, androidx.test.runner) \
140  robolectric-host-androidx:$(call java-lib-files, androidx.fragment_fragment) \
141  robolectric-host-android-support-v4:$(call java-lib-files, android-support-v4) \
142  robolectric-host-android-support-multidex:$(call java-lib-files, android-support-multidex) \
143  robolectric-host-org_apache_http_legacy:$(call java-lib-files, org.apache.http.legacy.stubs) \
144  robolectric-host-monitor-1.0.2-alpha1:$(call java-lib-files, robolectric-monitor-1.0.2-alpha1)
145
146$(foreach p,$(robolectric_target_to_host_jars),\
147  $(eval include $(CLEAR_VARS)) \
148  $(eval LOCAL_MODULE := $(call word-colon,1,$(p))-prebuilt) \
149  $(eval LOCAL_MODULE_CLASS := JAVA_LIBRARIES) \
150  $(eval LOCAL_IS_HOST_MODULE := true) \
151  $(eval LOCAL_PREBUILT_MODULE_FILE := $(call word-colon,2,$(p))) \
152  $(eval include $(BUILD_PREBUILT)) \
153  $(eval include $(CLEAR_VARS)) \
154  $(eval LOCAL_MODULE := $(call word-colon,1,$(p))) \
155  $(eval LOCAL_STATIC_JAVA_LIBRARIES := $(call word-colon,1,$(p))-prebuilt) \
156  $(eval include $(BUILD_HOST_JAVA_LIBRARY)))
157