blob: 0285108952be17f48e5e5ff754ea9a783274b136 [file] [log] [blame]
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -07001# Copyright (C) 2011 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
15LOCAL_PATH := $(call my-dir)
16
Yohann Roussel10461422014-09-25 10:13:32 +020017# test dex library
18# ============================================================
19include $(CLEAR_VARS)
20
21# custom variables used to generate test description. do not touch!
22LOCAL_SRC_FILES := $(call all-java-files-under, src/dot)
23
24LOCAL_MODULE := cts-tf-dalvik-lib
25LOCAL_MODULE_CLASS := JAVA_LIBRARIES
26LOCAL_MODULE_TAGS := optional
Paul Duffin679403a2016-12-01 13:31:31 +000027LOCAL_JAVA_LIBRARIES := junit
jdesprez03a03be2017-05-05 15:07:59 -070028-include cts/error_prone_rules_tests.mk
Yohann Roussel71044b32015-01-26 13:47:48 +010029include $(BUILD_JAVA_LIBRARY)
Yohann Roussel10461422014-09-25 10:13:32 +020030
31cts-tf-dalvik-lib.jack := $(full_classes_jack)
Colin Crossb0b36692017-08-01 17:15:20 -070032cts-tf-dalvik-lib.jar := $(full_classes_jar)
Yohann Roussel10461422014-09-25 10:13:32 +020033
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -070034# buildutil java library
35# ============================================================
36include $(CLEAR_VARS)
37
Stuart Scott140f7972016-02-19 16:54:54 -080038# custom variables used by cts/tools/utils/CollectAllTests.java to generate test description. do not touch!
39LOCAL_TEST_TYPE := vmHostTest
40LOCAL_JAR_PATH := android.core.vm-tests-tf.jar
41
Ying Wang80925b52012-08-21 11:45:29 -070042LOCAL_SRC_FILES := $(call all-java-files-under, src)
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -070043
44LOCAL_MODULE := cts-tf-dalvik-buildutil
45LOCAL_MODULE_CLASS := JAVA_LIBRARIES
46LOCAL_MODULE_TAGS := optional
47
Paul Duffin53e62bc2016-11-23 15:54:01 +000048LOCAL_JAVA_LIBRARIES := dx dasm cfassembler junit-host jsr305lib
Yohann Roussel10461422014-09-25 10:13:32 +020049
Yohann Rousselb8654bf2016-02-16 12:47:32 +010050LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -070051
52include $(BUILD_HOST_JAVA_LIBRARY)
53
Ying Wang80925b52012-08-21 11:45:29 -070054# Buid android.core.vm-tests-tf.jar
55# ============================================================
56#
Yohann Roussel01d7b562015-02-02 17:47:40 +010057include $(CLEAR_VARS)
Yohann Roussel10461422014-09-25 10:13:32 +020058
Colin Cross63cd6af2017-01-18 13:46:00 -080059include $(BUILD_SYSTEM)/configure_local_jack.mk
60
Ying Wangb18d9212016-02-19 11:40:08 -080061LOCAL_MODULE := vm-tests-tf
62LOCAL_MODULE_CLASS := JAVA_LIBRARIES
63LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
64LOCAL_IS_HOST_MODULE := true
65LOCAL_BUILT_MODULE_STEM := javalib.jar
66intermediates := $(call local-intermediates-dir)
67# Install the module as $(intermediates)/android.core.vm-tests-tf.jar.
68LOCAL_INSTALLED_MODULE_STEM := android.core.vm-tests-tf.jar
69LOCAL_MODULE_PATH := $(intermediates)
70
Stuart Scott2ff78ae2016-02-18 19:25:52 -080071# Tag this module as a cts test artifact
nickrosef1efbc62017-07-05 12:38:06 -070072LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
Ying Wangb18d9212016-02-19 11:40:08 -080073
74include $(BUILD_SYSTEM)/base_rules.mk
75
Tobias Thierer2ee79712017-05-09 22:01:38 +010076vmteststf_dep_jars := \
77 $(HOST_JDK_TOOLS_JAR) \
78 $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, cts-tf-dalvik-buildutil.jar dasm.jar dx.jar cfassembler.jar junit-host.jar)
Yohann Roussel10461422014-09-25 10:13:32 +020079
Ying Wangb18d9212016-02-19 11:40:08 -080080$(LOCAL_BUILT_MODULE): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS)
Yohann Roussel10461422014-09-25 10:13:32 +020081
Colin Cross63cd6af2017-01-18 13:46:00 -080082ifdef LOCAL_JACK_ENABLED
83 vmteststf_dep_jars += $(cts-tf-dalvik-lib.jack)
Colin Crossb0b36692017-08-01 17:15:20 -070084else
85 vmteststf_dep_jars += $(cts-tf-dalvik-lib.jar)
Colin Cross63cd6af2017-01-18 13:46:00 -080086endif
Yohann Roussel10461422014-09-25 10:13:32 +020087
Ying Wangb18d9212016-02-19 11:40:08 -080088$(LOCAL_BUILT_MODULE): PRIVATE_SRC_FOLDER := $(LOCAL_PATH)/src
89$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_CLASSES := $(call intermediates-dir-for,JAVA_LIBRARIES,cts-tf-dalvik-buildutil,HOST)/classes
90$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES := $(intermediates)/tests
91$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_DEXCORE_JAR := $(intermediates)/tests/dot/junit/dexcore.jar
92$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_MAIN_FILES := $(intermediates)/main_files
93$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES := $(intermediates)/hostjunit_files
Tobias Thierer2ee79712017-05-09 22:01:38 +010094$(LOCAL_BUILT_MODULE): PRIVATE_CLASS_PATH := $(call normalize-path-list, $(vmteststf_dep_jars))
Yohann Roussel450354f2016-02-22 15:57:11 +010095$(LOCAL_BUILT_MODULE): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
Colin Cross63cd6af2017-01-18 13:46:00 -080096ifndef LOCAL_JACK_ENABLED
Colin Crossb0b36692017-08-01 17:15:20 -070097oj_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)/classes.jar
98libart_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)/classes.jar
99$(LOCAL_BUILT_MODULE): PRIVATE_DALVIK_SUITE_CLASSPATH := $(oj_jar):$(libart_jar):$(cts-tf-dalvik-lib.jar):$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar:
Guang Zhufea6cde2017-04-06 16:32:01 -0700100$(LOCAL_BUILT_MODULE) : $(vmteststf_dep_jars) $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar
Colin Cross63cd6af2017-01-18 13:46:00 -0800101 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
102 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR))
103 # generated and compile the host side junit tests
104 @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)"
Colin Cross95fa0512017-06-30 14:19:12 -0700105 $(hide) $(JAVA) \
Tobias Thierercbcdff22017-05-22 15:38:36 +0100106 $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports jdk.jartool/sun.tools.jar=ALL-UNNAMED) \
107 -cp $(PRIVATE_CLASS_PATH) util.build.BuildDalvikSuite $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \
Colin Crossb0b36692017-08-01 17:15:20 -0700108 $(PRIVATE_DALVIK_SUITE_CLASSPATH) \
Colin Cross63cd6af2017-01-18 13:46:00 -0800109 $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO
110 @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)"
Colin Crossb0b36692017-08-01 17:15:20 -0700111 $(hide) $(JAR) -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar \
Colin Cross63cd6af2017-01-18 13:46:00 -0800112 $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class)
Colin Crossb0b36692017-08-01 17:15:20 -0700113 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp
114 $(hide) $(DX) -JXms16M -JXmx768M --dex --output=$(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp \
115 $(if $(NO_OPTIMIZE_DX), --no-optimize) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar
116 $(hide) cd $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp && zip -q -r $(abspath $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) .
117 $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../$(notdir $@) .
Colin Cross63cd6af2017-01-18 13:46:00 -0800118 $(hide) cd $(dir $@) && zip -q -r $(notdir $@) tests
Colin Crossb0b36692017-08-01 17:15:20 -0700119oj_jar :=
120libart_jar :=
Colin Cross63cd6af2017-01-18 13:46:00 -0800121else # LOCAL_JACK_ENABLED
Narayan Kamath8dc7ffb2015-12-24 14:16:11 +0000122oj_jack := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)/classes.jack
Shinichiro Hamaji2e850142015-11-30 17:17:59 +0900123libart_jack := $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)/classes.jack
Julien Desprez26d92f22016-11-11 12:11:33 +0000124$(LOCAL_BUILT_MODULE): PRIVATE_DALVIK_SUITE_CLASSPATH := $(oj_jack):$(libart_jack):$(cts-tf-dalvik-lib.jack):$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar
125$(LOCAL_BUILT_MODULE) : $(vmteststf_dep_jars) $(JACK) $(oj_jack) $(libart_jack) $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar | setup-jack-server
Yohann Roussel10461422014-09-25 10:13:32 +0200126 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
127 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR))
128 # generated and compile the host side junit tests
129 @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)"
Colin Cross95fa0512017-06-30 14:19:12 -0700130 $(hide) JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JAVA) -cp $(PRIVATE_CLASS_PATH) util.build.JackBuildDalvikSuite $(JACK) $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \
Shinichiro Hamaji2e850142015-11-30 17:17:59 +0900131 $(PRIVATE_DALVIK_SUITE_CLASSPATH) \
Yohann Roussel10461422014-09-25 10:13:32 +0200132 $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO
133 @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)"
Colin Cross95fa0512017-06-30 14:19:12 -0700134 $(hide) $(JAR) -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar \
Yohann Roussel10461422014-09-25 10:13:32 +0200135 $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class)
Yohann Roussel450354f2016-02-22 15:57:11 +0100136 $(hide) $(call call-jack) --import $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar --output-jack $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack
Yohann Roussel10461422014-09-25 10:13:32 +0200137 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp
Yohann Roussel0acccbb2015-07-02 12:12:30 +0200138 $(hide) $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) --output-dex $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp \
Yohann Roussel10461422014-09-25 10:13:32 +0200139 $(if $(NO_OPTIMIZE_DX), -D jack.dex.optimize "false") --import $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack
140 $(hide) cd $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp && zip -q -r $(abspath $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) .
Ying Wangb18d9212016-02-19 11:40:08 -0800141 $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../$(notdir $@) .
142 $(hide) cd $(dir $@) && zip -q -r $(notdir $@) tests
Narayan Kamath8dc7ffb2015-12-24 14:16:11 +0000143oj_jack :=
Shinichiro Hamaji2e850142015-11-30 17:17:59 +0900144libart_jack :=
Colin Cross63cd6af2017-01-18 13:46:00 -0800145endif # LOCAL_JACK_ENABLED
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700146
Ying Wang80925b52012-08-21 11:45:29 -0700147# Clean up temp vars
148intermediates :=
Ying Wang80925b52012-08-21 11:45:29 -0700149vmteststf_dep_jars :=
Stuart Scott140f7972016-02-19 16:54:54 -0800150
Yohann Roussel450354f2016-02-22 15:57:11 +0100151include $(call all-makefiles-under,$(LOCAL_PATH))