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 17LOCAL_PATH := $(call my-dir) 18 19include art/build/Android.common_test.mk 20 21# --- ahat.jar ---------------- 22include $(CLEAR_VARS) 23LOCAL_SRC_FILES := $(call all-java-files-under, src) 24LOCAL_JAR_MANIFEST := src/manifest.txt 25LOCAL_JAVA_RESOURCE_FILES := \ 26 $(LOCAL_PATH)/src/help.html \ 27 $(LOCAL_PATH)/src/style.css 28 29LOCAL_STATIC_JAVA_LIBRARIES := perflib-prebuilt guavalib trove-prebuilt 30LOCAL_IS_HOST_MODULE := true 31LOCAL_MODULE_TAGS := optional 32LOCAL_MODULE := ahat 33include $(BUILD_HOST_JAVA_LIBRARY) 34 35# --- ahat script ---------------- 36include $(CLEAR_VARS) 37LOCAL_IS_HOST_MODULE := true 38LOCAL_MODULE_CLASS := EXECUTABLES 39LOCAL_MODULE := ahat 40LOCAL_SRC_FILES := ahat 41include $(BUILD_PREBUILT) 42 43# --- ahat-tests.jar -------------- 44include $(CLEAR_VARS) 45LOCAL_SRC_FILES := $(call all-java-files-under, test) 46LOCAL_JAR_MANIFEST := test/manifest.txt 47LOCAL_STATIC_JAVA_LIBRARIES := ahat junit 48LOCAL_IS_HOST_MODULE := true 49LOCAL_MODULE_TAGS := tests 50LOCAL_MODULE := ahat-tests 51include $(BUILD_HOST_JAVA_LIBRARY) 52AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE) 53 54# --- ahat-test-dump.jar -------------- 55include $(CLEAR_VARS) 56LOCAL_MODULE := ahat-test-dump 57LOCAL_MODULE_TAGS := tests 58LOCAL_SRC_FILES := $(call all-java-files-under, test-dump) 59include $(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. 64AHAT_TEST_DUMP_JAR := $(LOCAL_BUILT_MODULE) 65AHAT_TEST_DUMP_HPROF := $(intermediates.COMMON)/test-dump.hprof 66 67# Run ahat-test-dump.jar to generate test-dump.hprof 68AHAT_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 80ahat-test: PRIVATE_AHAT_TEST_DUMP_HPROF := $(AHAT_TEST_DUMP_HPROF) 81ahat-test: PRIVATE_AHAT_TEST_JAR := $(AHAT_TEST_JAR) 82ahat-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. 86AHAT_TEST_DUMP_DEPENDENCIES := 87AHAT_TEST_DUMP_HPROF := 88AHAT_TEST_DUMP_JAR := 89AHAT_TEST_JAR := 90 91