Home | History | Annotate | Download | only in vm-tests-tf
      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 # buildutil java library
     18 # ============================================================
     19 include $(CLEAR_VARS)
     20 
     21 # custom variables used to generate test description. do not touch!
     22 LOCAL_TEST_TYPE := vmHostTest
     23 LOCAL_JAR_PATH := android.core.vm-tests-tf.jar
     24 
     25 LOCAL_SRC_FILES := $(call all-java-files-under, src)
     26 
     27 LOCAL_MODULE := cts-tf-dalvik-buildutil
     28 LOCAL_MODULE_CLASS := JAVA_LIBRARIES
     29 LOCAL_MODULE_TAGS := optional
     30 
     31 LOCAL_JAVA_LIBRARIES := dx dasm cfassembler junit
     32 LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
     33 
     34 include $(BUILD_HOST_JAVA_LIBRARY)
     35 
     36 # Buid android.core.vm-tests-tf.jar
     37 # ============================================================
     38 #
     39 intermediates := $(call intermediates-dir-for,JAVA_LIBRARIES,vm-tests-tf,HOST)
     40 vmteststf_jar := $(intermediates)/android.core.vm-tests-tf.jar
     41 vmteststf_dep_jars := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, cts-tf-dalvik-buildutil.jar dasm.jar dx.jar cfassembler.jar junit.jar)
     42 $(vmteststf_jar): PRIVATE_SRC_FOLDER := $(LOCAL_PATH)/src
     43 $(vmteststf_jar): PRIVATE_LIB_FOLDER := $(LOCAL_PATH)/lib
     44 $(vmteststf_jar): PRIVATE_INTERMEDIATES_CLASSES := $(call intermediates-dir-for,JAVA_LIBRARIES,cts-tf-dalvik-buildutil,HOST)/classes
     45 $(vmteststf_jar): PRIVATE_INTERMEDIATES := $(intermediates)/tests
     46 $(vmteststf_jar): PRIVATE_INTERMEDIATES_DEXCORE_JAR := $(intermediates)/tests/dot/junit/dexcore.jar
     47 $(vmteststf_jar): PRIVATE_INTERMEDIATES_MAIN_FILES := $(intermediates)/main_files
     48 $(vmteststf_jar): PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES := $(intermediates)/hostjunit_files
     49 $(vmteststf_jar): PRIVATE_CLASS_PATH := $(subst $(space),:,$(vmteststf_dep_jars)):$(HOST_JDK_TOOLS_JAR)
     50 $(vmteststf_jar) : $(vmteststf_dep_jars) $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar
     51 	$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
     52 	$(hide) mkdir -p $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/dot/junit $(dir $(PRIVATE_INTERMEDIATES_DEXCORE_JAR))
     53 	# generated and compile the host side junit tests
     54 	@echo "Write generated Main_*.java files to $(PRIVATE_INTERMEDIATES_MAIN_FILES)"
     55 	$(hide) java -cp $(PRIVATE_CLASS_PATH) util.build.BuildDalvikSuite $(PRIVATE_SRC_FOLDER) $(PRIVATE_INTERMEDIATES) \
     56 		$(HOST_OUT_JAVA_LIBRARIES)/cts-tf-dalvik-buildutil.jar:$(PRIVATE_LIB_FOLDER)/junit.jar:$(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar \
     57 		$(PRIVATE_INTERMEDIATES_MAIN_FILES) $(PRIVATE_INTERMEDIATES_CLASSES) $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES) $$RUN_VM_TESTS_RTO
     58 	@echo "Generate $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)"
     59 	$(hide) jar -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar \
     60 		$(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class)
     61 	$(hide) $(DX) -JXms16M -JXmx768M --dex --output=$(PRIVATE_INTERMEDIATES_DEXCORE_JAR) \
     62 		$(if $(NO_OPTIMIZE_DX), --no-optimize) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar
     63 	$(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../android.core.vm-tests-tf.jar .
     64 	$(hide) cd $(dir $@) && zip -q -r android.core.vm-tests-tf.jar tests
     65 
     66 # Clean up temp vars
     67 intermediates :=
     68 vmteststf_jar :=
     69 vmteststf_dep_jars :=
     70