1# Copyright (C) 2020 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)
16include $(CLEAR_VARS)
17
18ifeq (,$(wildcard $(LOCAL_PATH)/../../core))
19.PHONY: tradefed-core
20tradefed-core: tradefed atest_tradefed.sh
21.PHONY: tradefed-all
22tradefed-all: tradefed atest_tradefed.sh
23
24tradefed_dist_host_jars := tradefed
25tradefed_dist_artifacts := tradefed-tests.jar tradefed-test-framework.jar loganalysis.jar tradefed-contrib.jar tf-contrib-tests.jar tradefed-isolation.jar tradefed.sh tradefed_win.bat script_help.sh atest_tradefed.sh TradeFedUiTestApp.apk TradeFedTestApp.apk version.txt
26
27tradefed_dist_copy_pairs := $(foreach m, $(tradefed_dist_host_jars), $(call intermediates-dir-for,JAVA_LIBRARIES,$(m),HOST,COMMON)/javalib.jar:$(m).jar)
28tradefed_dist_copy_pairs += $(foreach m, $(tradefed_dist_artifacts), $(LOCAL_PATH)/../filegroups/tradefed/$(m):$(m))
29
30tradefed_dist_artifacts :=
31
32tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON)
33tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip
34$(tradefed_dist_zip) : PRIVATE_COPY_PAIRS := $(tradefed_dist_copy_pairs)
35$(tradefed_dist_zip) : $(SOONG_ZIP) $(foreach f,$(tradefed_dist_copy_pairs),$(call word-colon,1,$(f)))
36	rm -rf $(dir $@)/tmp && mkdir -p $(dir $@)/tmp
37	$(foreach f,$(PRIVATE_COPY_PAIRS), \
38	  cp -f $(call word-colon,1,$(f)) $(dir $@)/tmp/$(call word-colon,2,$(f)) &&) true
39	$(SOONG_ZIP) -o $@ -C $(dir $@)/tmp \
40	  $(foreach f,$(PRIVATE_COPY_PAIRS),-f $(dir $@)/tmp/$(call word-colon,2,$(f)))
41
42$(call dist-for-goals, tradefed, $(tradefed_dist_zip))
43
44tradefed_dist_copy_pairs :=
45tradefed_dist_intermediates :=
46tradefed_dist_zip :=
47endif
48
49# Build all sub-directories
50include $(call all-makefiles-under,$(LOCAL_PATH))
51