blob: 007f72c059326789f49e388cdf45f32ab3a5f3b0 [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
Julien Desprez3126a432020-05-26 08:40:47 -070023
24# Output tradefed-no-fwk as "tradefed.jar" for seamlessly replacing the jar.
Colin Crossa48b5672019-10-21 18:31:07 +000025deps := $(call copy-many-files,\
Julien Desprez3126a432020-05-26 08:40:47 -070026 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-no-fwk,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed.jar)
Colin Crossa48b5672019-10-21 18:31:07 +000027
Julien Desprez0f1927b2020-05-18 13:32:20 -070028fwk_deps := $(call copy-many-files,\
Julien Desprez3126a432020-05-26 08:40:47 -070029 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-test-framework,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed-test-framework.jar)
Julien Desprez0f1927b2020-05-18 13:32:20 -070030
Joseph Murphyb927bf62019-09-30 19:17:00 -070031isodeps := $(call copy-many-files,\
32 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-isolation,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed-isolation.jar)
33
Colin Crossa48b5672019-10-21 18:31:07 +000034# this dependency ensures the above rule will be executed if jar is installed
Julien Desprez0f1927b2020-05-18 13:32:20 -070035$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(deps) $(isodeps) $(fwk_deps)
Colin Crossa48b5672019-10-21 18:31:07 +000036# The copy rule for loganalysis is in tools/loganalysis/Android.mk
37$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(HOST_OUT)/tradefed/loganalysis.jar
38
Omari Stephens966291b2013-03-06 21:09:21 -080039#######################################################
Omari Stephens6aeef7c2011-10-19 17:14:47 -070040
41# Create a simple alias to build all the TF-related targets
42# Note that this is incompatible with `make dist`. If you want to make
43# the distribution, you must run `tapas` with the individual target names.
mikehoranc80dc532017-11-14 14:30:06 -080044.PHONY: tradefed-core
Julien Desprez0f1927b2020-05-18 13:32:20 -070045tradefed-core: tradefed tradefed-isolation tradefed-test-framework atest_tradefed.sh tradefed-contrib tf-contrib-tests script_help.sh tradefed.sh
mikehoranc80dc532017-11-14 14:30:06 -080046
Omari Stephens6aeef7c2011-10-19 17:14:47 -070047.PHONY: tradefed-all
Julien Desprez9036ca62019-07-01 09:25:38 -070048tradefed-all: tradefed-core tradefed-tests tradefed_win loganalysis-tests
Omari Stephens6aeef7c2011-10-19 17:14:47 -070049
Omari Stephens64043d82012-01-27 18:14:56 -080050########################################################
Omari Stephens06bcef12015-05-06 16:26:49 -070051# Zip up the built files and dist it as tradefed.zip
Omari Stephens64043d82012-01-27 18:14:56 -080052
Julien Desprez7e50f052020-05-29 11:37:48 -070053# Do not include "tradefed" in here, it's created below from tradefed-no-fwk
54tradefed_dist_host_jars := tradefed-test-framework tradefed-tests loganalysis loganalysis-tests tf-remote-client tradefed-contrib tf-contrib-tests tradefed-isolation
Julien Desprez9036ca62019-07-01 09:25:38 -070055tradefed_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 -080056tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil
Omari Stephens64043d82012-01-27 18:14:56 -080057
Dan Willemsenc133acc2019-01-23 21:48:58 -080058# Generate a src:dest list of copies to perform.
59# The source should always be an intermediate / source location, not the
60# installed location, as that will force installation, and cause this zip to be
61# regenerated too often during incremental builds.
Julien Desprez7e50f052020-05-29 11:37:48 -070062
63# Copy tradefed-no-fwk to tradefed.jar to be an inplace replacement
64tradefed_dist_copy_pairs := $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-no-fwk,HOST,COMMON)/javalib.jar:tradefed.jar
65tradefed_dist_copy_pairs += $(foreach m, $(tradefed_dist_host_jars), $(call intermediates-dir-for,JAVA_LIBRARIES,$(m),HOST,COMMON)/javalib.jar:$(m).jar)
Dan Willemsenc133acc2019-01-23 21:48:58 -080066tradefed_dist_copy_pairs += $(foreach m, $(tradefed_dist_host_exes), $(LOCAL_PATH)/$(m):$(m))
67tradefed_dist_copy_pairs += $(foreach m, $(tradefed_dist_test_apks), $(call intermediates-dir-for,APPS,$(m))/package.apk:$(m).apk)
68
69tradefed_dist_host_jars :=
70tradefed_dist_host_exes :=
71tradefed_dist_test_apks :=
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
Dan Willemsenc133acc2019-01-23 21:48:58 -080075$(tradefed_dist_zip) : PRIVATE_COPY_PAIRS := $(tradefed_dist_copy_pairs)
76$(tradefed_dist_zip) : $(SOONG_ZIP) $(foreach f,$(tradefed_dist_copy_pairs),$(call word-colon,1,$(f)))
77 rm -rf $(dir $@)/tmp && mkdir -p $(dir $@)/tmp
78 $(foreach f,$(PRIVATE_COPY_PAIRS), \
79 cp -f $(call word-colon,1,$(f)) $(dir $@)/tmp/$(call word-colon,2,$(f)) &&) true
80 echo $(BUILD_NUMBER_FROM_FILE) > $(dir $@)/tmp/version.txt
81 $(SOONG_ZIP) -o $@ -C $(dir $@)/tmp -f $(dir $@)/tmp/version.txt \
82 $(foreach f,$(PRIVATE_COPY_PAIRS),-f $(dir $@)/tmp/$(call word-colon,2,$(f)))
Omari Stephens64043d82012-01-27 18:14:56 -080083
Julien Desprezc4ae1de2018-09-05 10:51:31 -070084$(call dist-for-goals, tradefed, $(tradefed_dist_zip))
Dan Willemsenc133acc2019-01-23 21:48:58 -080085
86tradefed_dist_copy_pairs :=
87tradefed_dist_intermediates :=
88tradefed_dist_zip :=
89
90# Build all sub-directories
91include $(call all-makefiles-under,$(LOCAL_PATH))