Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 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 | |
Dan Willemsen | cd8a057 | 2016-09-16 17:11:36 -0700 | [diff] [blame] | 19 | include art/build/Android.common_path.mk |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 20 | |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 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 := \ |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 26 | $(LOCAL_PATH)/src/style.css |
| 27 | |
| 28 | LOCAL_STATIC_JAVA_LIBRARIES := perflib-prebuilt guavalib trove-prebuilt |
| 29 | LOCAL_IS_HOST_MODULE := true |
| 30 | LOCAL_MODULE_TAGS := optional |
| 31 | LOCAL_MODULE := ahat |
Richard Uhler | 69272db | 2016-08-05 16:26:57 -0700 | [diff] [blame] | 32 | |
| 33 | # Let users with Java 7 run ahat (b/28303627) |
| 34 | LOCAL_JAVA_LANGUAGE_VERSION := 1.7 |
| 35 | |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 36 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 37 | |
| 38 | # --- ahat script ---------------- |
| 39 | include $(CLEAR_VARS) |
| 40 | LOCAL_IS_HOST_MODULE := true |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 41 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 42 | LOCAL_MODULE := ahat |
Dan Willemsen | fa8598d | 2016-02-29 21:09:08 -0800 | [diff] [blame] | 43 | LOCAL_SRC_FILES := ahat |
| 44 | include $(BUILD_PREBUILT) |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 45 | |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 46 | # --- ahat-tests.jar -------------- |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 47 | include $(CLEAR_VARS) |
| 48 | LOCAL_SRC_FILES := $(call all-java-files-under, test) |
| 49 | LOCAL_JAR_MANIFEST := test/manifest.txt |
Paul Duffin | 932b19a | 2016-11-28 16:34:59 +0000 | [diff] [blame] | 50 | LOCAL_STATIC_JAVA_LIBRARIES := ahat junit-host |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 51 | LOCAL_IS_HOST_MODULE := true |
| 52 | LOCAL_MODULE_TAGS := tests |
| 53 | LOCAL_MODULE := ahat-tests |
| 54 | include $(BUILD_HOST_JAVA_LIBRARY) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 55 | AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE) |
Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 56 | |
Richard Uhler | ec78c78 | 2016-05-13 14:19:37 -0700 | [diff] [blame] | 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. |
| 60 | AHAT_TEST_DUMP_PROGUARD_CONFIG := $(intermediates.COMMON)/config.pro |
| 61 | AHAT_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 | |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 67 | # --- ahat-test-dump.jar -------------- |
| 68 | include $(CLEAR_VARS) |
| 69 | LOCAL_MODULE := ahat-test-dump |
| 70 | LOCAL_MODULE_TAGS := tests |
| 71 | LOCAL_SRC_FILES := $(call all-java-files-under, test-dump) |
Richard Uhler | ec78c78 | 2016-05-13 14:19:37 -0700 | [diff] [blame] | 72 | LOCAL_ADDITIONAL_DEPENDENCIES := $(AHAT_TEST_DUMP_PROGUARD_CONFIG) |
| 73 | LOCAL_JACK_FLAGS := --config-proguard $(AHAT_TEST_DUMP_PROGUARD_CONFIG) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 74 | include $(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. |
| 79 | AHAT_TEST_DUMP_JAR := $(LOCAL_BUILT_MODULE) |
| 80 | AHAT_TEST_DUMP_HPROF := $(intermediates.COMMON)/test-dump.hprof |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 81 | AHAT_TEST_DUMP_BASE_HPROF := $(intermediates.COMMON)/test-dump-base.hprof |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 82 | |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 83 | # Run ahat-test-dump.jar to generate test-dump.hprof and test-dump-base.hprof |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 84 | AHAT_TEST_DUMP_DEPENDENCIES := \ |
Richard Uhler | c5a0004 | 2016-07-01 13:10:56 -0700 | [diff] [blame] | 85 | $(ART_HOST_EXECUTABLES) \ |
| 86 | $(ART_HOST_SHARED_LIBRARY_DEPENDENCIES) \ |
| 87 | $(HOST_OUT_EXECUTABLES)/art \ |
Richard Uhler | 6928649 | 2016-09-20 10:41:47 +0100 | [diff] [blame] | 88 | $(HOST_CORE_IMG_OUT_BASE)$(CORE_IMG_SUFFIX) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 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 | |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 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 | |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 102 | .PHONY: ahat-test |
| 103 | ahat-test: PRIVATE_AHAT_TEST_DUMP_HPROF := $(AHAT_TEST_DUMP_HPROF) |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 104 | ahat-test: PRIVATE_AHAT_TEST_DUMP_BASE_HPROF := $(AHAT_TEST_DUMP_BASE_HPROF) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 105 | ahat-test: PRIVATE_AHAT_TEST_JAR := $(AHAT_TEST_JAR) |
Richard Uhler | ec78c78 | 2016-05-13 14:19:37 -0700 | [diff] [blame] | 106 | ahat-test: PRIVATE_AHAT_PROGUARD_MAP := $(AHAT_TEST_DUMP_PROGUARD_MAP) |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 107 | ahat-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) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 109 | |
| 110 | # Clean up local variables. |
| 111 | AHAT_TEST_DUMP_DEPENDENCIES := |
| 112 | AHAT_TEST_DUMP_HPROF := |
| 113 | AHAT_TEST_DUMP_JAR := |
Richard Uhler | ec78c78 | 2016-05-13 14:19:37 -0700 | [diff] [blame] | 114 | AHAT_TEST_DUMP_PROGUARD_CONFIG := |
| 115 | AHAT_TEST_DUMP_PROGUARD_MAP := |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 116 | AHAT_TEST_JAR := |
| 117 | |