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-targetdex 28 29include $(BUILD_JAVA_LIBRARY) 30 31cts-tf-dalvik-lib.jack := $(full_classes_jack) 32 33private_jill_jarjar_asm := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,jill-jarjar-asm.jar) 34$(private_jill_jarjar_asm) : PRIVATE_JARJAR_RULES := $(LOCAL_PATH)/jill-jarjar-rules.txt 35$(private_jill_jarjar_asm) : $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,jill.jar) | $(JARJAR) 36 @echo JarJar: $@ 37 $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@ 38 39# buildutil java library 40# ============================================================ 41include $(CLEAR_VARS) 42 43# custom variables used to generate test description. do not touch! 44LOCAL_TEST_TYPE := vmHostTest 45LOCAL_JAR_PATH := android.core.vm-tests-tf.jar 46 47LOCAL_SRC_FILES := $(call all-java-files-under, src) 48 49LOCAL_MODULE := cts-tf-dalvik-buildutil 50LOCAL_MODULE_CLASS := JAVA_LIBRARIES 51LOCAL_MODULE_TAGS := optional 52 53LOCAL_JAVA_LIBRARIES := dx dasm cfassembler junit 54LOCAL_JAVA_LIBRARIES += jack 55 56LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR) $(private_jill_jarjar_asm) 57 58include $(BUILD_HOST_JAVA_LIBRARY) 59 60# Buid android.core.vm-tests-tf.jar 61# ============================================================ 62# 63include $(CLEAR_VARS) 64 65LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED)) 66intermediates := $(call intermediates-dir-for,JAVA_LIBRARIES,vm-tests-tf,HOST) 67vmteststf_jar := $(intermediates)/android.core.vm-tests-tf.jar 68vmteststf_dep_jars := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, cts-tf-dalvik-buildutil.jar dasm.jar dx.jar cfassembler.jar junit.jar) 69vmteststf_dep_jars += $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, jack.jar) 70vmteststf_dep_jars += $(private_jill_jarjar_asm) 71 72$(vmteststf_jar): PRIVATE_JACK_VM_ARGS := $(LOCAL_JACK_VM_ARGS) 73$(vmteststf_jar): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS) 74 75ifdef LOCAL_JACK_ENABLED 76 vmteststf_dep_jars += $(cts-tf-dalvik-lib.jack) 77endif 78 79$(vmteststf_jar): PRIVATE_SRC_FOLDER := $(LOCAL_PATH)/src 80$(vmteststf_jar): PRIVATE_INTERMEDIATES_CLASSES := $(call intermediates-dir-for,JAVA_LIBRARIES,cts-tf-dalvik-buildutil,HOST)/classes 81$(vmteststf_jar): PRIVATE_INTERMEDIATES := $(intermediates)/tests 82$(vmteststf_jar): PRIVATE_INTERMEDIATES_DEXCORE_JAR := $(intermediates)/tests/dot/junit/dexcore.jar 83$(vmteststf_jar): PRIVATE_INTERMEDIATES_MAIN_FILES := $(intermediates)/main_files 84$(vmteststf_jar): PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES := $(intermediates)/hostjunit_files 85$(vmteststf_jar): PRIVATE_CLASS_PATH := $(subst $(space),:,$(vmteststf_dep_jars)):$(HOST_JDK_TOOLS_JAR) 86ifndef LOCAL_JACK_ENABLED 87$(vmteststf_jar) : $(vmteststf_dep_jars) $(JACK_JAR) $(JILL_JAR) $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar 88 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) 89 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) 90 # generated and compile the host side junit tests 91 @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)" 92 $(hide) java -cp $(PRIVATE_CLASS_PATH) util.build.BuildDalvikSuite $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \ 93 $(HOST_OUT_JAVA_LIBRARIES)/cts-tf-dalvik-buildutil.jar:$(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar \ 94 $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO 95 @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)" 96 $(hide) jar -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar \ 97 $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class) 98 $(hide) $(DX) -JXms16M -JXmx768M --dex --output=$(PRIVATE_INTERMEDIATES_DEXCORE_JAR) \ 99 $(if $(NO_OPTIMIZE_DX), --no-optimize) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar 100 $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../android.core.vm-tests-tf.jar . 101 $(hide) cd $(dir $@) && zip -q -r android.core.vm-tests-tf.jar tests 102else # LOCAL_JACK_ENABLED 103$(vmteststf_jar) : $(vmteststf_dep_jars) $(JACK_JAR) $(JILL_JAR) $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)/classes.jack $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar 104 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) 105 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) 106 # generated and compile the host side junit tests 107 @echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)" 108 $(hide) java -cp $(PRIVATE_CLASS_PATH) util.build.JackBuildDalvikSuite $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \ 109 $(call intermediates-dir-for,JAVA_LIBRARIES,core-libart,,COMMON)/classes.jack:$(cts-tf-dalvik-lib.jack):$(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar \ 110 $(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO 111 @echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)" 112 $(hide) jar -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar \ 113 $(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class) 114 $(hide) $(JILL) --output $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar 115 $(hide) mkdir -p $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp 116 $(hide) $(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) --output-dex $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp \ 117 $(if $(NO_OPTIMIZE_DX), -D jack.dex.optimize "false") --import $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jack 118 $(hide) cd $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp && zip -q -r $(abspath $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) . 119 $(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../android.core.vm-tests-tf.jar . 120 $(hide) cd $(dir $@) && zip -q -r android.core.vm-tests-tf.jar tests 121endif # LOCAL_JACK_ENABLED 122 123# Clean up temp vars 124intermediates := 125vmteststf_jar := 126vmteststf_dep_jars := 127