blob: 122e0946af21e8eda9d05a7ce9ee7bfa0e766185 [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)
Dan Shi1564c7b2017-12-12 14:03:43 -080016COMPATIBILITY.tradefed_tests_dir := \
Julien Desprez29010242018-10-23 10:42:48 -070017 $(COMPATIBILITY.tradefed_tests_dir) $(LOCAL_PATH)/res/config $(LOCAL_PATH)/tests/res/config
Brett Chabotf72f44c2010-01-27 11:09:46 -080018
19include $(CLEAR_VARS)
Brett Chabotf72f44c2010-01-27 11:09:46 -080020
Brett Chabot4bd67d52011-02-07 11:54:37 -080021# makefile rules to copy jars to HOST_OUT/tradefed
22# so tradefed.sh can automatically add to classpath
Dan Willemsen462bb7c2018-06-16 10:51:49 -070023deps := $(call copy-many-files,\
Nan Zhangd4bde952018-07-18 16:58:43 -070024 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed.jar \
Dan Willemsen462bb7c2018-06-16 10:51:49 -070025 $(HOST_OUT_JAVA_LIBRARIES)/tools-common-prebuilt.jar:$(HOST_OUT)/tradefed/tools-common-prebuilt.jar)
Brett Chabot4bd67d52011-02-07 11:54:37 -080026
Dan Willemsen462bb7c2018-06-16 10:51:49 -070027# this dependency ensures the above rule will be executed if jar is installed
Nan Zhangd4bde952018-07-18 16:58:43 -070028$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(deps)
Dan Willemsen462bb7c2018-06-16 10:51:49 -070029# The copy rule for loganalysis is in tools/loganalysis/Android.mk
Nan Zhangd4bde952018-07-18 16:58:43 -070030$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(HOST_OUT)/tradefed/loganalysis.jar
Billy Lambertabb7685c2017-02-24 11:12:32 -080031
Omari Stephens966291b2013-03-06 21:09:21 -080032#######################################################
Omari Stephens6aeef7c2011-10-19 17:14:47 -070033include $(CLEAR_VARS)
34
35# Create a simple alias to build all the TF-related targets
36# Note that this is incompatible with `make dist`. If you want to make
37# the distribution, you must run `tapas` with the individual target names.
mikehoranc80dc532017-11-14 14:30:06 -080038.PHONY: tradefed-core
Julien Desprez29010242018-10-23 10:42:48 -070039tradefed-core: tradefed atest_tradefed tradefed-contrib tf-contrib-tests script_help
mikehoranc80dc532017-11-14 14:30:06 -080040
Omari Stephens6aeef7c2011-10-19 17:14:47 -070041.PHONY: tradefed-all
mikehoranc80dc532017-11-14 14:30:06 -080042tradefed-all: tradefed-core tradefed-tests tradefed_win verify loganalysis-tests
Omari Stephens6aeef7c2011-10-19 17:14:47 -070043
Brett Chabot4bd67d52011-02-07 11:54:37 -080044# ====================================
45include $(CLEAR_VARS)
46# copy tradefed.sh script to host dir
47
48LOCAL_MODULE_TAGS := optional
49
Simran Basif4bdb122017-08-23 13:13:53 -070050LOCAL_PREBUILT_EXECUTABLES := tradefed.sh tradefed_win.bat script_help.sh verify.sh run_tf_cmd.sh atest_tradefed.sh
Brett Chabot4bd67d52011-02-07 11:54:37 -080051include $(BUILD_HOST_PREBUILT)
52
Brett Chabotf72f44c2010-01-27 11:09:46 -080053# Build all sub-directories
54include $(call all-makefiles-under,$(LOCAL_PATH))
Omari Stephens64043d82012-01-27 18:14:56 -080055
56########################################################
Omari Stephens06bcef12015-05-06 16:26:49 -070057# Zip up the built files and dist it as tradefed.zip
Omari Stephens64043d82012-01-27 18:14:56 -080058
Julien Despreza344f672018-11-30 08:53:45 -080059tradefed_dist_host_jars := tradefed tradefed-tests loganalysis loganalysis-tests tf-remote-client tradefed-contrib tf-contrib-tests tools-common-prebuilt
Omari Stephens64043d82012-01-27 18:14:56 -080060tradefed_dist_host_jar_files := $(foreach m, $(tradefed_dist_host_jars), $(HOST_OUT_JAVA_LIBRARIES)/$(m).jar)
61
Simran Basif4bdb122017-08-23 13:13:53 -070062tradefed_dist_host_exes := tradefed.sh tradefed_win.bat script_help.sh verify.sh run_tf_cmd.sh atest_tradefed.sh
Omari Stephens64043d82012-01-27 18:14:56 -080063tradefed_dist_host_exe_files := $(foreach m, $(tradefed_dist_host_exes), $(BUILD_OUT_EXECUTABLES)/$(m))
64
David Hu6fb582f2012-12-19 18:49:19 -080065tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil
Ying Wang0f9b11c2014-07-21 14:03:11 -070066tradefed_dist_test_apk_files := $(foreach m, $(tradefed_dist_test_apks), $(TARGET_OUT_DATA_APPS)/$(m)/$(m).apk)
Omari Stephens64043d82012-01-27 18:14:56 -080067
68tradefed_dist_files := \
69 $(tradefed_dist_host_jar_files) \
70 $(tradefed_dist_test_apk_files) \
Brett Chabotfee380c2013-02-01 15:25:08 -080071 $(tradefed_dist_host_exe_files)
Omari Stephens64043d82012-01-27 18:14:56 -080072
73tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON)
74tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip
75$(tradefed_dist_zip) : $(tradefed_dist_files)
76 @echo "Package: $@"
77 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
78 $(hide) cp -f $^ $(dir $@)
Julien Desprezdda1d752018-07-26 11:23:17 -070079 $(hide) echo $(BUILD_NUMBER_FROM_FILE) > $(dir $@)/version.txt
80 $(hide) cd $(dir $@) && zip -q $(notdir $@) $(notdir $^) version.txt
Omari Stephens64043d82012-01-27 18:14:56 -080081
Julien Desprezc4ae1de2018-09-05 10:51:31 -070082$(call dist-for-goals, tradefed, $(tradefed_dist_zip))