• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_path.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/style.css
27
28LOCAL_STATIC_JAVA_LIBRARIES := perflib-prebuilt guavalib trove-prebuilt
29LOCAL_IS_HOST_MODULE := true
30LOCAL_MODULE_TAGS := optional
31LOCAL_MODULE := ahat
32
33# Let users with Java 7 run ahat (b/28303627)
34LOCAL_JAVA_LANGUAGE_VERSION := 1.7
35
36include $(BUILD_HOST_JAVA_LIBRARY)
37
38# --- ahat script ----------------
39include $(CLEAR_VARS)
40LOCAL_IS_HOST_MODULE := true
41LOCAL_MODULE_CLASS := EXECUTABLES
42LOCAL_MODULE := ahat
43LOCAL_SRC_FILES := ahat
44include $(BUILD_PREBUILT)
45
46# --- ahat-tests.jar --------------
47include $(CLEAR_VARS)
48LOCAL_SRC_FILES := $(call all-java-files-under, test)
49LOCAL_JAR_MANIFEST := test/manifest.txt
50LOCAL_STATIC_JAVA_LIBRARIES := ahat junit-host
51LOCAL_IS_HOST_MODULE := true
52LOCAL_MODULE_TAGS := tests
53LOCAL_MODULE := ahat-tests
54include $(BUILD_HOST_JAVA_LIBRARY)
55AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE)
56
57# Rule to generate the proguard configuration for the test-dump program.
58# We copy the configuration to the intermediates directory because jack will
59# output the proguard map in that same directory.
60AHAT_TEST_DUMP_PROGUARD_CONFIG := $(intermediates.COMMON)/config.pro
61AHAT_TEST_DUMP_PROGUARD_MAP := $(intermediates.COMMON)/proguard.map
62$(AHAT_TEST_DUMP_PROGUARD_CONFIG): PRIVATE_AHAT_PROGUARD_CONFIG_IN := $(LOCAL_PATH)/test-dump/config.pro
63$(AHAT_TEST_DUMP_PROGUARD_CONFIG): PRIVATE_AHAT_PROGUARD_CONFIG := $(AHAT_TEST_DUMP_PROGUARD_CONFIG)
64$(AHAT_TEST_DUMP_PROGUARD_CONFIG): $(LOCAL_PATH)/test-dump/config.pro
65	cp $(PRIVATE_AHAT_PROGUARD_CONFIG_IN) $(PRIVATE_AHAT_PROGUARD_CONFIG)
66
67# --- ahat-test-dump.jar --------------
68include $(CLEAR_VARS)
69LOCAL_MODULE := ahat-test-dump
70LOCAL_MODULE_TAGS := tests
71LOCAL_SRC_FILES := $(call all-java-files-under, test-dump)
72LOCAL_ADDITIONAL_DEPENDENCIES := $(AHAT_TEST_DUMP_PROGUARD_CONFIG)
73LOCAL_JACK_FLAGS := --config-proguard $(AHAT_TEST_DUMP_PROGUARD_CONFIG)
74include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
75
76# Determine the location of the test-dump.jar and test-dump.hprof files.
77# These use variables set implicitly by the include of
78# BUILD_HOST_DALVIK_JAVA_LIBRARY above.
79AHAT_TEST_DUMP_JAR := $(LOCAL_BUILT_MODULE)
80AHAT_TEST_DUMP_HPROF := $(intermediates.COMMON)/test-dump.hprof
81AHAT_TEST_DUMP_BASE_HPROF := $(intermediates.COMMON)/test-dump-base.hprof
82
83# Run ahat-test-dump.jar to generate test-dump.hprof and test-dump-base.hprof
84AHAT_TEST_DUMP_DEPENDENCIES := \
85  $(ART_HOST_EXECUTABLES) \
86  $(ART_HOST_SHARED_LIBRARY_DEPENDENCIES) \
87  $(HOST_OUT_EXECUTABLES)/art \
88  $(HOST_CORE_IMG_OUT_BASE)$(CORE_IMG_SUFFIX)
89
90$(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art
91$(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR)
92$(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_DEPENDENCIES := $(AHAT_TEST_DUMP_DEPENDENCIES)
93$(AHAT_TEST_DUMP_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
94	$(PRIVATE_AHAT_TEST_ART) -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@
95
96$(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art
97$(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR)
98$(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DUMP_DEPENDENCIES := $(AHAT_TEST_DUMP_DEPENDENCIES)
99$(AHAT_TEST_DUMP_BASE_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
100	$(PRIVATE_AHAT_TEST_ART) -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@ --base
101
102.PHONY: ahat-test
103ahat-test: PRIVATE_AHAT_TEST_DUMP_HPROF := $(AHAT_TEST_DUMP_HPROF)
104ahat-test: PRIVATE_AHAT_TEST_DUMP_BASE_HPROF := $(AHAT_TEST_DUMP_BASE_HPROF)
105ahat-test: PRIVATE_AHAT_TEST_JAR := $(AHAT_TEST_JAR)
106ahat-test: PRIVATE_AHAT_PROGUARD_MAP := $(AHAT_TEST_DUMP_PROGUARD_MAP)
107ahat-test: $(AHAT_TEST_JAR) $(AHAT_TEST_DUMP_HPROF) $(AHAT_TEST_DUMP_BASE_HPROF)
108	java -enableassertions -Dahat.test.dump.hprof=$(PRIVATE_AHAT_TEST_DUMP_HPROF) -Dahat.test.dump.base.hprof=$(PRIVATE_AHAT_TEST_DUMP_BASE_HPROF) -Dahat.test.dump.map=$(PRIVATE_AHAT_PROGUARD_MAP) -jar $(PRIVATE_AHAT_TEST_JAR)
109
110# Clean up local variables.
111AHAT_TEST_DUMP_DEPENDENCIES :=
112AHAT_TEST_DUMP_HPROF :=
113AHAT_TEST_DUMP_JAR :=
114AHAT_TEST_DUMP_PROGUARD_CONFIG :=
115AHAT_TEST_DUMP_PROGUARD_MAP :=
116AHAT_TEST_JAR :=
117
118