blob: 2de8e2eaf9a8f0ecd7365ef31bae148a8666f60d [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
Brett Chabot6ce689e2014-03-11 13:12:21 -070029LOCAL_STATIC_JAVA_LIBRARIES := junit kxml2-2.3.0 jline-1.0 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
Jed Estep36738a52016-01-11 18:07:10 -080032LOCAL_JAVA_LIBRARIES := emmalib tools-common-prebuilt loganalysis
Brett Chabotf72f44c2010-01-27 11:09:46 -080033
Julien Desprezaf73ee42015-12-11 14:03:29 +000034LOCAL_JAR_MANIFEST := MANIFEST.mf
35
Brett Chabotf72f44c2010-01-27 11:09:46 -080036include $(BUILD_HOST_JAVA_LIBRARY)
37
Brett Chabot4bd67d52011-02-07 11:54:37 -080038# makefile rules to copy jars to HOST_OUT/tradefed
39# so tradefed.sh can automatically add to classpath
40DEST_JAR := $(HOST_OUT)/tradefed/$(LOCAL_MODULE).jar
41$(DEST_JAR): $(LOCAL_BUILT_MODULE)
42 $(copy-file-to-new-target)
43
44# this dependency ensure the above rule will be executed if jar is built
45$(LOCAL_INSTALLED_MODULE) : $(DEST_JAR)
46
Omari Stephens6aeef7c2011-10-19 17:14:47 -070047#######################################################
Omari Stephens966291b2013-03-06 21:09:21 -080048# intentionally skipping CLEAR_VARS
49
50# Enable the build process to generate javadoc
Ying Wangd786e242014-07-07 16:48:21 -070051# We need to reference symbols in the jar built above.
Omari Stephensd62c4712015-07-24 16:45:15 -070052LOCAL_JAVA_LIBRARIES += tradefed
53LOCAL_IS_HOST_MODULE:=true
54LOCAL_MODULE_CLASS := JAVA_LIBRARIES
55LOCAL_ADDITIONAL_DEPENDENCIES := tradefed
56LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sac
57LOCAL_DROIDDOC_OPTIONS:= \
58 -package \
59 -toroot / \
60 -hdf android.whichdoc online \
61 -hdf sac true \
62 -hdf devices true \
Omari Stephensaabdc0b2015-08-14 18:43:03 -070063 -showAnnotationOverridesVisibility \
Omari Stephensd62c4712015-07-24 16:45:15 -070064 -showAnnotation com.android.tradefed.config.OptionClass \
65 -showAnnotation com.android.tradefed.config.Option \
Omari Stephens966291b2013-03-06 21:09:21 -080066
Omari Stephensd62c4712015-07-24 16:45:15 -070067include $(BUILD_DROIDDOC)
Omari Stephens966291b2013-03-06 21:09:21 -080068
69#######################################################
Omari Stephens6aeef7c2011-10-19 17:14:47 -070070include $(CLEAR_VARS)
71
72# Create a simple alias to build all the TF-related targets
73# Note that this is incompatible with `make dist`. If you want to make
74# the distribution, you must run `tapas` with the individual target names.
75.PHONY: tradefed-all
Omari Stephens6e3c34d2015-04-14 18:40:33 -070076tradefed-all: tradefed tradefed-tests tf-prod-tests tf-prod-metatests tradefed_win script_help verify
Omari Stephens6aeef7c2011-10-19 17:14:47 -070077
Brett Chabot4bd67d52011-02-07 11:54:37 -080078# ====================================
79include $(CLEAR_VARS)
80# copy tradefed.sh script to host dir
81
82LOCAL_MODULE_TAGS := optional
83
Omari Stephens6e3c34d2015-04-14 18:40:33 -070084LOCAL_PREBUILT_EXECUTABLES := tradefed.sh tradefed_win.bat script_help.sh verify.sh
Brett Chabot4bd67d52011-02-07 11:54:37 -080085include $(BUILD_HOST_PREBUILT)
86
Brett Chabotf72f44c2010-01-27 11:09:46 -080087# Build all sub-directories
88include $(call all-makefiles-under,$(LOCAL_PATH))
Omari Stephens64043d82012-01-27 18:14:56 -080089
90########################################################
Omari Stephens06bcef12015-05-06 16:26:49 -070091# Zip up the built files and dist it as tradefed.zip
92ifneq (,$(filter tradefed tradefed-all, $(TARGET_BUILD_APPS)))
Omari Stephens64043d82012-01-27 18:14:56 -080093
Brett Chabot030e8432014-09-24 19:22:39 -070094tradefed_dist_host_jars := tradefed tradefed-tests tf-prod-tests emmalib loganalysis loganalysis-tests tf-remote-client
Omari Stephens64043d82012-01-27 18:14:56 -080095tradefed_dist_host_jar_files := $(foreach m, $(tradefed_dist_host_jars), $(HOST_OUT_JAVA_LIBRARIES)/$(m).jar)
96
Omari Stephens6e3c34d2015-04-14 18:40:33 -070097tradefed_dist_host_exes := tradefed.sh tradefed_win.bat script_help.sh verify.sh
Omari Stephens64043d82012-01-27 18:14:56 -080098tradefed_dist_host_exe_files := $(foreach m, $(tradefed_dist_host_exes), $(BUILD_OUT_EXECUTABLES)/$(m))
99
David Hu6fb582f2012-12-19 18:49:19 -0800100tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil
Ying Wang0f9b11c2014-07-21 14:03:11 -0700101tradefed_dist_test_apk_files := $(foreach m, $(tradefed_dist_test_apks), $(TARGET_OUT_DATA_APPS)/$(m)/$(m).apk)
Omari Stephens64043d82012-01-27 18:14:56 -0800102
103tradefed_dist_files := \
104 $(tradefed_dist_host_jar_files) \
105 $(tradefed_dist_test_apk_files) \
Brett Chabotfee380c2013-02-01 15:25:08 -0800106 $(tradefed_dist_host_exe_files)
Omari Stephens64043d82012-01-27 18:14:56 -0800107
108tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON)
109tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip
110$(tradefed_dist_zip) : $(tradefed_dist_files)
111 @echo "Package: $@"
112 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
113 $(hide) cp -f $^ $(dir $@)
114 $(hide) cd $(dir $@) && zip -q $(notdir $@) $(notdir $^)
115
Colin Cross29197902015-10-05 13:19:12 -0700116$(call dist-for-goals, apps_only, $(tradefed_dist_zip))
Omari Stephens64043d82012-01-27 18:14:56 -0800117
118endif # tradefed in $(TARGET_BUILD_APPS)