1# Copyright (C) 2015 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
15LOCAL_PATH := $(call my-dir)
16
17# Include definitions of DAGGER2_PROCESSOR_CLASSES/LIBRARIES
18include external/dagger2/dagger2_annotation_processor.mk
19
20# build caliper host jar
21# ============================================================
22
23include $(CLEAR_VARS)
24
25LOCAL_MODULE := caliper-host
26LOCAL_MODULE_TAGS := optional
27LOCAL_MODULE_CLASS := JAVA_LIBRARIES
28LOCAL_SRC_FILES := $(call all-java-files-under, caliper/src/main/java/)
29LOCAL_JAVA_RESOURCE_DIRS := caliper/src/main/resources
30LOCAL_IS_HOST_MODULE := true
31
32LOCAL_STATIC_JAVA_LIBRARIES := \
33  apache-commons-math-host \
34  caliper-gson-host \
35  caliper-java-allocation-instrumenter-host \
36  caliper-jersey-client-host \
37  caliper-jersey-core-host \
38  caliper-joda-time-host \
39  caliper-jsr311-api-host \
40  dagger2-host \
41  dagger2-inject-host \
42  guavalib
43
44# Use Dagger2 annotation processor
45PROCESSOR_LIBRARIES := $(DAGGER2_PROCESSOR_LIBRARIES)
46PROCESSOR_CLASSES := $(DAGGER2_PROCESSOR_CLASSES)
47include external/dagger2/java_annotation_processors.mk
48
49LOCAL_JAVA_LANGUAGE_VERSION := 1.7
50include $(BUILD_HOST_JAVA_LIBRARY)
51
52# Remember the location of the generated files, this is needed for when
53# building for target
54caliper_host_generated_sources_dir := $(local-generated-sources-dir)/annotation_processor_output
55
56# build caliper target api jar
57# ============================================================
58# This contains just those classes needed for benchmarks to compile.
59
60include $(CLEAR_VARS)
61
62LOCAL_MODULE := caliper-api-target
63LOCAL_MODULE_TAGS := optional
64LOCAL_MODULE_CLASS := JAVA_LIBRARIES
65LOCAL_SRC_FILES := \
66  caliper/src/main/java/com/google/caliper/AfterExperiment.java \
67  caliper/src/main/java/com/google/caliper/BeforeExperiment.java \
68  caliper/src/main/java/com/google/caliper/Param.java \
69  caliper/src/main/java/com/google/caliper/All.java \
70  caliper/src/main/java/com/google/caliper/Benchmark.java
71
72LOCAL_JAVA_LANGUAGE_VERSION := 1.7
73include $(BUILD_JAVA_LIBRARY)
74
75# build caliper tests
76# ============================================================
77# vogar --expectations $ANDROID_BUILD_TOP/external/caliper/expectations/knownfailures.txt \
78        --test-only \
79        --classpath $ANDROID_BUILD_TOP/out/host/common/obj/JAVA_LIBRARIES/caliper-tests_intermediates/javalib.jar \
80        com.google.caliper
81
82include $(CLEAR_VARS)
83
84LOCAL_MODULE := caliper-tests
85LOCAL_MODULE_TAGS := optional
86LOCAL_MODULE_CLASS := JAVA_LIBRARIES
87LOCAL_SRC_FILES := $(call all-java-files-under, caliper/src/test/java/)
88LOCAL_JAVA_RESOURCE_DIRS := caliper/src/test/resources
89LOCAL_IS_HOST_MODULE := true
90
91LOCAL_STATIC_JAVA_LIBRARIES := \
92  caliper-host \
93  junit \
94  mockito-host
95
96# Use Dagger2 annotation processor
97PROCESSOR_LIBRARIES := $(DAGGER2_PROCESSOR_LIBRARIES)
98PROCESSOR_CLASSES := $(DAGGER2_PROCESSOR_CLASSES)
99include external/dagger2/java_annotation_processors.mk
100
101LOCAL_JAVA_LANGUAGE_VERSION := 1.7
102include $(BUILD_HOST_JAVA_LIBRARY)
103
104# build caliper examples
105# ============================================================
106
107include $(CLEAR_VARS)
108
109LOCAL_MODULE := caliper-examples
110LOCAL_MODULE_TAGS := optional
111LOCAL_MODULE_CLASS := JAVA_LIBRARIES
112LOCAL_SRC_FILES := $(call all-java-files-under, examples/src/main/java/)
113LOCAL_IS_HOST_MODULE := true
114
115LOCAL_STATIC_JAVA_LIBRARIES := \
116  caliper-host \
117  junit \
118  mockito-host
119
120LOCAL_JAVA_LANGUAGE_VERSION := 1.7
121include $(BUILD_HOST_JAVA_LIBRARY)
122
123# Build host dependencies.
124# ============================================================
125include $(CLEAR_VARS)
126
127LOCAL_PREBUILT_JAVA_LIBRARIES := \
128    caliper-gson-host:lib/gson-2.2.2$(COMMON_JAVA_PACKAGE_SUFFIX) \
129    caliper-java-allocation-instrumenter-host:lib/java-allocation-instrumenter-2.0$(COMMON_JAVA_PACKAGE_SUFFIX) \
130    caliper-jersey-client-host:lib/jersey-client-1.11$(COMMON_JAVA_PACKAGE_SUFFIX) \
131    caliper-jersey-core-host:lib/jersey-core-1.11$(COMMON_JAVA_PACKAGE_SUFFIX) \
132    caliper-joda-time-host:lib/joda-time-2.1$(COMMON_JAVA_PACKAGE_SUFFIX) \
133    caliper-jsr311-api-host:lib/jsr311-api-1.1.1$(COMMON_JAVA_PACKAGE_SUFFIX)
134
135include $(BUILD_HOST_PREBUILT)
136