1# 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 17# 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 27LOCAL_JAVA_LIBRARIES := junit 28-include cts/error_prone_rules_tests.mk 29include $(BUILD_JAVA_LIBRARY) 30 31cts-tf-dalvik-lib.jack := $(full_classes_jack) 32 33# buildutil java library 34# ============================================================ 35include $(CLEAR_VARS) 36 37# custom variables used by cts/tools/utils/CollectAllTests.java to generate test description. do not touch! 38LOCAL_TEST_TYPE := vmHostTest 39LOCAL_JAR_PATH := android.core.vm-tests-tf.jar 40 41LOCAL_SRC_FILES := $(call all-java-files-under, src) 42 43LOCAL_MODULE := cts-tf-dalvik-buildutil 44LOCAL_MODULE_CLASS := JAVA_LIBRARIES 45LOCAL_MODULE_TAGS := optional 46 47LOCAL_JAVA_LIBRARIES := dx dasm cfassembler junit-host jsr305lib 48 49LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR) 50 51include $(BUILD_HOST_JAVA_LIBRARY) 52 53# Buid android.core.vm-tests-tf.jar 54# ============================================================ 55# 56include $(CLEAR_VARS) 57 58include $(BUILD_SYSTEM)/configure_local_jack.mk 59 60LOCAL_MODULE := vm-tests-tf 61LOCAL_MODULE_CLASS := JAVA_LIBRARIES 62LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX) 63LOCAL_IS_HOST_MODULE := true 64LOCAL_BUILT_MODULE_STEM := javalib.jar 65intermediates := $(call local-intermediates-dir) 66# Install the module as $(intermediates)/android.core.vm-tests-tf.jar. 67LOCAL_INSTALLED_MODULE_STEM := android.core.vm-tests-tf.jar 68LOCAL_MODULE_PATH := $(intermediates) 69 70# Tag this module as a cts test artifact 71LOCAL_COMPATIBILITY_SUITE := cts vts general-tests 72 73include $(BUILD_SYSTEM)/base_rules.mk 74 75vmteststf_dep_jars := \ 76 $(HOST_JDK_TOOLS_JAR) \ 77 $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, cts-tf-dalvik-buildutil.jar dasm.jar dx.jar cfassembler.jar junit-host.jar) 78 79$(LOCAL_BUILT_MODULE): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS) 80 81ifdef LOCAL_JACK_ENABLED 82 vmteststf_dep_jars += $(cts-tf-dalvik-lib.jack) 83endif 84 85$(LOCAL_BUILT_MODULE): PRIVATE_SRC_FOLDER := $(LOCAL_PATH)/src 86$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_CLASSES := $(call intermediates-dir-for,JAVA_LIBRARIES,cts-tf-dalvik-buildutil,HOST)/classes 87$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES := $(intermediates)/tests 88$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_DEXCORE_JAR := $(intermediates)/tests/dot/junit/dexcore.jar 89$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_MAIN_FILES := $(intermediates)/main_files 90$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES := $(intermediates)/hostjunit_files 91$(LOCAL_BUILT_MODULE): PRIVATE_CLASS_PATH := $(call normalize-path-list, $(vmteststf_dep_jars)) 92$(LOCAL_BUILT_MODULE): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION) 93ifndef LOCAL_JACK_ENABLED 94$(LOCAL_BUILT_MODULE) : $(vmteststf_dep_jars) $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar 95 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) 96 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) 97 # generated and compile the host side junit tests 98 @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)" 99 $(hide) $(JAVA) \ 100 $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports jdk.jartool/sun.tools.jar=ALL-UNNAMED) \ 101 -cp $(PRIVATE_CLASS_PATH) util.build.BuildDalvikSuite $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \ 102 $(HOST_OUT_JAVA_LIBRARIES)/cts-tf-dalvik-buildutil.jar:$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar \ 103 $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO 104 @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)" 105 $(hide) $(JAR) -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar \ 106 $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class) 107 $(hide) $(DX) -JXms16M -JXmx768M --dex --output=$(PRIVATE_INTERMEDIATES_DEXCORE_JAR) \ 108 $(if $(NO_OPTIMIZE_DX), --no-optimize) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar 109 $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../$(notdir $@).jar . 110 $(hide) cd $(dir $@) && zip -q -r $(notdir $@) tests 111else # LOCAL_JACK_ENABLED 112oj_jack := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)/classes.jack 113libart_jack := $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)/classes.jack 114$(LOCAL_BUILT_MODULE): PRIVATE_DALVIK_SUITE_CLASSPATH := $(oj_jack):$(libart_jack):$(cts-tf-dalvik-lib.jack):$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar 115$(LOCAL_BUILT_MODULE) : $(vmteststf_dep_jars) $(JACK) $(oj_jack) $(libart_jack) $(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar | setup-jack-server 116 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) 117 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) 118 # generated and compile the host side junit tests 119 @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)" 120 $(hide) JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JAVA) -cp $(PRIVATE_CLASS_PATH) util.build.JackBuildDalvikSuite $(JACK) $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \ 121 $(PRIVATE_DALVIK_SUITE_CLASSPATH) \ 122 $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO 123 @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)" 124 $(hide) $(JAR) -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar \ 125 $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class) 126 $(hide) $(call call-jack) --import $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar --output-jack $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack 127 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp 128 $(hide) $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) --output-dex $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp \ 129 $(if $(NO_OPTIMIZE_DX), -D jack.dex.optimize "false") --import $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack 130 $(hide) cd $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp && zip -q -r $(abspath $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) . 131 $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../$(notdir $@) . 132 $(hide) cd $(dir $@) && zip -q -r $(notdir $@) tests 133oj_jack := 134libart_jack := 135endif # LOCAL_JACK_ENABLED 136 137# Clean up temp vars 138intermediates := 139vmteststf_dep_jars := 140 141include $(call all-makefiles-under,$(LOCAL_PATH)) 142