1# 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) 16COMPATIBILITY.tradefed_tests_dir := \ 17 $(COMPATIBILITY.tradefed_tests_dir) $(LOCAL_PATH)/res/config $(LOCAL_PATH)/tests/res/config 18 19include $(CLEAR_VARS) 20 21# makefile rules to copy jars to HOST_OUT/tradefed 22# so tradefed.sh can automatically add to classpath 23 24# Output tradefed-no-fwk as "tradefed.jar" for seamlessly replacing the jar. 25deps := $(call copy-many-files,\ 26 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-no-fwk,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed.jar) 27 28fwk_deps := $(call copy-many-files,\ 29 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-test-framework,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed-test-framework.jar) 30 31isodeps := $(call copy-many-files,\ 32 $(call intermediates-dir-for,JAVA_LIBRARIES,tradefed-isolation,HOST)/javalib.jar:$(HOST_OUT)/tradefed/tradefed-isolation.jar) 33 34# this dependency ensures the above rule will be executed if jar is installed 35$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(deps) $(isodeps) $(fwk_deps) 36# The copy rule for loganalysis is in tools/loganalysis/Android.mk 37$(HOST_OUT_JAVA_LIBRARIES)/tradefed.jar : $(HOST_OUT)/tradefed/loganalysis.jar 38 39####################################################### 40 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. 44.PHONY: tradefed-core 45tradefed-core: tradefed tradefed-isolation tradefed-test-framework atest_tradefed.sh tradefed-contrib tf-contrib-tests script_help.sh tradefed.sh 46 47.PHONY: tradefed-all 48tradefed-all: tradefed-core tradefed-tests tradefed_win loganalysis-tests 49 50######################################################## 51# Zip up the built files and dist it as tradefed.zip 52 53# 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 55tradefed_dist_host_exes := tradefed.sh tradefed_win.bat script_help.sh run_tf_cmd.sh atest_tradefed.sh 56tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil 57 58# 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. 62 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) 66tradefed_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 := 72 73tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON) 74tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip 75$(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))) 83 84$(call dist-for-goals, tradefed, $(tradefed_dist_zip)) 85 86tradefed_dist_copy_pairs := 87tradefed_dist_intermediates := 88tradefed_dist_zip := 89 90# Build all sub-directories 91include $(call all-makefiles-under,$(LOCAL_PATH)) 92