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