Home | History | Annotate | Download | only in ahat
      1 #
      2 # Copyright (C) 2015 The Android Open Source Project
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #      http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 #
     16 
     17 LOCAL_PATH := $(call my-dir)
     18 
     19 include art/build/Android.common_test.mk
     20 
     21 # --- ahat.jar ----------------
     22 include $(CLEAR_VARS)
     23 LOCAL_SRC_FILES := $(call all-java-files-under, src)
     24 LOCAL_JAR_MANIFEST := src/manifest.txt
     25 LOCAL_JAVA_RESOURCE_FILES := \
     26   $(LOCAL_PATH)/src/help.html \
     27   $(LOCAL_PATH)/src/style.css
     28 
     29 LOCAL_STATIC_JAVA_LIBRARIES := perflib-prebuilt guavalib trove-prebuilt
     30 LOCAL_IS_HOST_MODULE := true
     31 LOCAL_MODULE_TAGS := optional
     32 LOCAL_MODULE := ahat
     33 include $(BUILD_HOST_JAVA_LIBRARY)
     34 
     35 # --- ahat script ----------------
     36 include $(CLEAR_VARS)
     37 LOCAL_IS_HOST_MODULE := true
     38 LOCAL_MODULE_CLASS := EXECUTABLES
     39 LOCAL_MODULE := ahat
     40 LOCAL_SRC_FILES := ahat
     41 include $(BUILD_PREBUILT)
     42 
     43 # --- ahat-tests.jar --------------
     44 include $(CLEAR_VARS)
     45 LOCAL_SRC_FILES := $(call all-java-files-under, test)
     46 LOCAL_JAR_MANIFEST := test/manifest.txt
     47 LOCAL_STATIC_JAVA_LIBRARIES := ahat junit
     48 LOCAL_IS_HOST_MODULE := true
     49 LOCAL_MODULE_TAGS := tests
     50 LOCAL_MODULE := ahat-tests
     51 include $(BUILD_HOST_JAVA_LIBRARY)
     52 AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE)
     53 
     54 # --- ahat-test-dump.jar --------------
     55 include $(CLEAR_VARS)
     56 LOCAL_MODULE := ahat-test-dump
     57 LOCAL_MODULE_TAGS := tests
     58 LOCAL_SRC_FILES := $(call all-java-files-under, test-dump)
     59 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
     60 
     61 # Determine the location of the test-dump.jar and test-dump.hprof files.
     62 # These use variables set implicitly by the include of
     63 # BUILD_HOST_DALVIK_JAVA_LIBRARY above.
     64 AHAT_TEST_DUMP_JAR := $(LOCAL_BUILT_MODULE)
     65 AHAT_TEST_DUMP_HPROF := $(intermediates.COMMON)/test-dump.hprof
     66 
     67 # Run ahat-test-dump.jar to generate test-dump.hprof
     68 AHAT_TEST_DUMP_DEPENDENCIES := \
     69 	$(ART_HOST_EXECUTABLES) \
     70 	$(HOST_OUT_EXECUTABLES)/art \
     71 	$(HOST_CORE_IMG_OUT_BASE)-optimizing-pic$(CORE_IMG_SUFFIX)
     72 
     73 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art
     74 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR)
     75 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_DEPENDENCIES := $(AHAT_TEST_DUMP_DEPENDENCIES)
     76 $(AHAT_TEST_DUMP_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
     77 	$(PRIVATE_AHAT_TEST_ART) -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@
     78 
     79 .PHONY: ahat-test
     80 ahat-test: PRIVATE_AHAT_TEST_DUMP_HPROF := $(AHAT_TEST_DUMP_HPROF)
     81 ahat-test: PRIVATE_AHAT_TEST_JAR := $(AHAT_TEST_JAR)
     82 ahat-test: $(AHAT_TEST_JAR) $(AHAT_TEST_DUMP_HPROF)
     83 	java -Dahat.test.dump.hprof=$(PRIVATE_AHAT_TEST_DUMP_HPROF) -jar $(PRIVATE_AHAT_TEST_JAR)
     84 
     85 # Clean up local variables.
     86 AHAT_TEST_DUMP_DEPENDENCIES :=
     87 AHAT_TEST_DUMP_HPROF :=
     88 AHAT_TEST_DUMP_JAR :=
     89 AHAT_TEST_JAR :=
     90 
     91