blob: 5f4a996f4a72f106615a851130b1507560878d97 [file] [log] [blame]
Brett Chabotf72f44c2010-01-27 11:09:46 -08001# Copyright (C) 2010 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
17include $(CLEAR_VARS)
18
19# Only compile source java files in this lib.
20LOCAL_SRC_FILES := $(call all-java-files-under, src)
21
Brett Chabote278a5b2010-06-01 16:20:14 -070022LOCAL_JAVA_RESOURCE_DIRS := res
23
Guang Zhu040a43a2012-01-25 14:38:16 -080024LOCAL_JAVACFLAGS += -g -Xlint
Guang Zhuc5637f72011-07-24 13:15:24 -070025
Brett Chabot0aebe552010-09-13 14:26:46 -070026LOCAL_MODULE := tradefed
Brett Chabotf72f44c2010-01-27 11:09:46 -080027
Brett Chabot36d4f872010-09-15 18:28:27 -070028LOCAL_MODULE_TAGS := optional
Guang Zhu1217e1a2013-11-25 12:38:36 -080029LOCAL_STATIC_JAVA_LIBRARIES := junit kxml2-2.3.0 guavalib jline-1.0 json-prebuilt tf-remote-client
Brett Chabotfee380c2013-02-01 15:25:08 -080030# emmalib is only a runtime dependency if generating code coverage reporters,
31# not a compile time dependency
Brett Chabotcf521272013-11-07 17:00:13 -080032LOCAL_JAVA_LIBRARIES := ddmlib-prebuilt emmalib tools-common-prebuilt tf-remote-client
Brett Chabotf72f44c2010-01-27 11:09:46 -080033
34include $(BUILD_HOST_JAVA_LIBRARY)
35
Brett Chabot4bd67d52011-02-07 11:54:37 -080036# makefile rules to copy jars to HOST_OUT/tradefed
37# so tradefed.sh can automatically add to classpath
38DEST_JAR := $(HOST_OUT)/tradefed/$(LOCAL_MODULE).jar
39$(DEST_JAR): $(LOCAL_BUILT_MODULE)
40 $(copy-file-to-new-target)
41
42# this dependency ensure the above rule will be executed if jar is built
43$(LOCAL_INSTALLED_MODULE) : $(DEST_JAR)
44
Omari Stephens6aeef7c2011-10-19 17:14:47 -070045#######################################################
Omari Stephens966291b2013-03-06 21:09:21 -080046# intentionally skipping CLEAR_VARS
47
48# Enable the build process to generate javadoc
49LOCAL_IS_HOST_MODULE:=true
50LOCAL_MODULE_CLASS := JAVA_LIBRARIES
51LOCAL_ADDITIONAL_DEPENDENCIES := tradefed
52LOCAL_CLASSPATH := $(HOST_OUT)/framework/\*
Dirk Dougherty3c546112013-04-17 15:25:52 -070053LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sac
Robert Lyb36ff412013-03-14 10:08:45 -070054LOCAL_DROIDDOC_OPTIONS:= \
Omari Stephens8ace5632013-04-12 19:40:37 -070055 -package \
Robert Lyb36ff412013-03-14 10:08:45 -070056 -toroot / \
57 -hdf android.whichdoc online \
58 -hdf sac true \
59 -hdf devices true \
Omari Stephens966291b2013-03-06 21:09:21 -080060
61include $(BUILD_DROIDDOC)
62
63#######################################################
Omari Stephens6aeef7c2011-10-19 17:14:47 -070064include $(CLEAR_VARS)
65
66# Create a simple alias to build all the TF-related targets
67# Note that this is incompatible with `make dist`. If you want to make
68# the distribution, you must run `tapas` with the individual target names.
69.PHONY: tradefed-all
Omari Stephenscb76e3a2012-03-19 20:12:41 -070070tradefed-all: tradefed tradefed-tests tf-prod-tests tf-prod-metatests
Omari Stephens6aeef7c2011-10-19 17:14:47 -070071
Brett Chabot4bd67d52011-02-07 11:54:37 -080072# ====================================
73include $(CLEAR_VARS)
74# copy tradefed.sh script to host dir
75
76LOCAL_MODULE_TAGS := optional
77
78LOCAL_PREBUILT_EXECUTABLES := tradefed.sh
79include $(BUILD_HOST_PREBUILT)
80
Brett Chabotf72f44c2010-01-27 11:09:46 -080081# Build all sub-directories
82include $(call all-makefiles-under,$(LOCAL_PATH))
Omari Stephens64043d82012-01-27 18:14:56 -080083
84########################################################
85# Zip up the built files and dist it as google-tradefed.zip
86ifneq (,$(filter tradefed, $(TARGET_BUILD_APPS)))
87
Brett Chabotcf521272013-11-07 17:00:13 -080088tradefed_dist_host_jars := tradefed tradefed-tests ddmlib-prebuilt tf-prod-tests emmalib loganalysis loganalysis-tests tf-remote-client
Omari Stephens64043d82012-01-27 18:14:56 -080089tradefed_dist_host_jar_files := $(foreach m, $(tradefed_dist_host_jars), $(HOST_OUT_JAVA_LIBRARIES)/$(m).jar)
90
91tradefed_dist_host_exes := tradefed.sh
92tradefed_dist_host_exe_files := $(foreach m, $(tradefed_dist_host_exes), $(BUILD_OUT_EXECUTABLES)/$(m))
93
David Hu6fb582f2012-12-19 18:49:19 -080094tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil
Omari Stephens64043d82012-01-27 18:14:56 -080095tradefed_dist_test_apk_files := $(foreach m, $(tradefed_dist_test_apks), $(TARGET_OUT_DATA_APPS)/$(m).apk)
96
97tradefed_dist_files := \
98 $(tradefed_dist_host_jar_files) \
99 $(tradefed_dist_test_apk_files) \
Brett Chabotfee380c2013-02-01 15:25:08 -0800100 $(tradefed_dist_host_exe_files)
Omari Stephens64043d82012-01-27 18:14:56 -0800101
102tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON)
103tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip
104$(tradefed_dist_zip) : $(tradefed_dist_files)
105 @echo "Package: $@"
106 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
107 $(hide) cp -f $^ $(dir $@)
108 $(hide) cd $(dir $@) && zip -q $(notdir $@) $(notdir $^)
109
110.PHONY: tradefed_dist
111tradefed_dist : $(tradefed_dist_zip)
112
113$(call dist-for-goals, tradefed_dist, $(tradefed_dist_zip))
114dist: tradefed_dist
115
116endif # tradefed in $(TARGET_BUILD_APPS)