blob: 2879077a247127e0f7a07c58a4bbbe57e5295aff [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
Colin Crossa48b5672019-10-21 18:31:07 +000019include $(CLEAR_VARS)
20
21# makefile rules to copy jars to HOST_OUT/tradefed
22# so tradefed.sh can automatically add to classpath
23deps := $(call copy-many-files,\
24 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed.jar)
25
Joseph Murphyb927bf62019-09-30 19:17:00 -070026isodeps := $(call copy-many-files,\
27 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-isolation,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed-isolation.jar)
28
Colin Crossa48b5672019-10-21 18:31:07 +000029# this dependency ensures the above rule will be executed if jar is installed
Joseph Murphyb927bf62019-09-30 19:17:00 -070030$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(deps) $(isodeps)
Colin Crossa48b5672019-10-21 18:31:07 +000031# The copy rule for loganalysis is in tools/loganalysis/Android.mk
32$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(HOST_OUT)/tradefed/loganalysis.jar
33
Omari Stephens966291b2013-03-06 21:09:21 -080034#######################################################
Omari Stephens6aeef7c2011-10-19 17:14:47 -070035
36# Create a simple alias to build all the TF-related targets
37# Note that this is incompatible with `make dist`. If you want to make
38# the distribution, you must run `tapas` with the individual target names.
mikehoranc80dc532017-11-14 14:30:06 -080039.PHONY: tradefed-core
Joseph Murphyb927bf62019-09-30 19:17:00 -070040tradefed-core: tradefed tradefed-isolation atest_tradefed.sh tradefed-contrib tf-contrib-tests script_help.sh tradefed.sh
mikehoranc80dc532017-11-14 14:30:06 -080041
Omari Stephens6aeef7c2011-10-19 17:14:47 -070042.PHONY: tradefed-all
Julien Desprez9036ca62019-07-01 09:25:38 -070043tradefed-all: tradefed-core tradefed-tests tradefed_win loganalysis-tests
Omari Stephens6aeef7c2011-10-19 17:14:47 -070044
Omari Stephens64043d82012-01-27 18:14:56 -080045########################################################
Omari Stephens06bcef12015-05-06 16:26:49 -070046# Zip up the built files and dist it as tradefed.zip
Omari Stephens64043d82012-01-27 18:14:56 -080047
Joseph Murphyb927bf62019-09-30 19:17:00 -070048tradefed_dist_host_jars := tradefed tradefed-tests loganalysis loganalysis-tests tf-remote-client tradefed-contrib tf-contrib-tests tradefed-isolation
Julien Desprez9036ca62019-07-01 09:25:38 -070049tradefed_dist_host_exes := tradefed.sh tradefed_win.bat script_help.sh run_tf_cmd.sh atest_tradefed.sh
David Hu6fb582f2012-12-19 18:49:19 -080050tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil
Omari Stephens64043d82012-01-27 18:14:56 -080051
Dan Willemsenc133acc2019-01-23 21:48:58 -080052# Generate a src:dest list of copies to perform.
53# The source should always be an intermediate / source location, not the
54# installed location, as that will force installation, and cause this zip to be
55# regenerated too often during incremental builds.
56tradefed_dist_copy_pairs := $(foreach m, $(tradefed_dist_host_jars), $(call intermediates-dir-for,JAVA_LIBRARIES,$(m),HOST,COMMON)/javalib.jar:$(m).jar)
57tradefed_dist_copy_pairs += $(foreach m, $(tradefed_dist_host_exes), $(LOCAL_PATH)/$(m):$(m))
58tradefed_dist_copy_pairs += $(foreach m, $(tradefed_dist_test_apks), $(call intermediates-dir-for,APPS,$(m))/package.apk:$(m).apk)
59
60tradefed_dist_host_jars :=
61tradefed_dist_host_exes :=
62tradefed_dist_test_apks :=
Omari Stephens64043d82012-01-27 18:14:56 -080063
64tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON)
65tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip
Dan Willemsenc133acc2019-01-23 21:48:58 -080066$(tradefed_dist_zip) : PRIVATE_COPY_PAIRS := $(tradefed_dist_copy_pairs)
67$(tradefed_dist_zip) : $(SOONG_ZIP) $(foreach f,$(tradefed_dist_copy_pairs),$(call word-colon,1,$(f)))
68 rm -rf $(dir $@)/tmp && mkdir -p $(dir $@)/tmp
69 $(foreach f,$(PRIVATE_COPY_PAIRS), \
70 cp -f $(call word-colon,1,$(f)) $(dir $@)/tmp/$(call word-colon,2,$(f)) &&) true
71 echo $(BUILD_NUMBER_FROM_FILE) > $(dir $@)/tmp/version.txt
72 $(SOONG_ZIP) -o $@ -C $(dir $@)/tmp -f $(dir $@)/tmp/version.txt \
73 $(foreach f,$(PRIVATE_COPY_PAIRS),-f $(dir $@)/tmp/$(call word-colon,2,$(f)))
Omari Stephens64043d82012-01-27 18:14:56 -080074
Julien Desprezc4ae1de2018-09-05 10:51:31 -070075$(call dist-for-goals, tradefed, $(tradefed_dist_zip))
Dan Willemsenc133acc2019-01-23 21:48:58 -080076
77tradefed_dist_copy_pairs :=
78tradefed_dist_intermediates :=
79tradefed_dist_zip :=
80
81# Build all sub-directories
82include $(call all-makefiles-under,$(LOCAL_PATH))