blob: 4bcaeb69a1ce5c85620a8b88e4e8e427a7805c58 [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 := \
17 $(COMPATIBILITY.tradefed_tests_dir) $(LOCAL_PATH)/res/config $(LOCAL_PATH)/tests/res/config $(LOCAL_PATH)/prod-tests/res/config
Brett Chabotf72f44c2010-01-27 11:09:46 -080018
19include $(CLEAR_VARS)
Julien Desprez71489f32017-03-03 12:46:34 +000020# Module to compile protos for tradefed
21LOCAL_MODULE := tradefed-protos
22LOCAL_SRC_FILES := $(call all-proto-files-under, proto)
23LOCAL_JAVA_LIBRARIES := host-libprotobuf-java-full
Julien Desprez9ae83662018-05-18 12:50:50 -070024LOCAL_PROTOC_OPTIMIZE_TYPE := full
25LOCAL_PROTOC_FLAGS := \
26 -Iexternal/protobuf/src
Julien Desprez71489f32017-03-03 12:46:34 +000027LOCAL_SOURCE_FILES_ALL_GENERATED := true
28LOCAL_MODULE_TAGS := optional
29
jdesprez301915c2018-01-26 08:12:50 -080030# If the real one isn't present, use the prebuilt platformprotos library.
31ifeq ($(wildcard frameworks/base/Android.mk),)
32 LOCAL_STATIC_JAVA_LIBRARIES += platformprotos-prebuilt
33else
34 LOCAL_STATIC_JAVA_LIBRARIES += platformprotos
35endif
36
Julien Desprez71489f32017-03-03 12:46:34 +000037include $(BUILD_HOST_JAVA_LIBRARY)
38
39include $(CLEAR_VARS)
Brett Chabotf72f44c2010-01-27 11:09:46 -080040
41# Only compile source java files in this lib.
Julien Desprez71489f32017-03-03 12:46:34 +000042LOCAL_SRC_FILES := $(call all-java-files-under, src)
Brett Chabotf72f44c2010-01-27 11:09:46 -080043
Brett Chabote278a5b2010-06-01 16:20:14 -070044LOCAL_JAVA_RESOURCE_DIRS := res
45
Guang Zhu040a43a2012-01-25 14:38:16 -080046LOCAL_JAVACFLAGS += -g -Xlint
Tobias Thierer956f00d2017-11-15 21:09:41 +000047ifdef TARGET_OPENJDK9
Tobias Thierer531deef2017-10-31 17:22:40 +000048LOCAL_JAVACFLAGS += --add-modules=java.xml.bind
49endif
50
Kevin Cheng75b65bd2017-04-06 16:18:43 -070051-include tools/tradefederation/core/error_prone_rules.mk
Guang Zhuc5637f72011-07-24 13:15:24 -070052
Brett Chabot0aebe552010-09-13 14:26:46 -070053LOCAL_MODULE := tradefed
Brett Chabotf72f44c2010-01-27 11:09:46 -080054
jdesprez7509fca2018-04-02 16:36:56 -070055LOCAL_STATIC_JAVA_LIBRARIES := junit-host junit-params-host kxml2-2.3.0 jline-1.0 tf-remote-client commons-compress-prebuilt host-libprotobuf-java-full tradefed-protos error_prone_annotations-2.0.18 longevity-host-lib gson-prebuilt-jar guice
Mike Maf92c3402017-12-18 19:42:35 -080056
Brett Chabotfee380c2013-02-01 15:25:08 -080057# emmalib is only a runtime dependency if generating code coverage reporters,
58# not a compile time dependency
Andreas Gampe19154902018-05-15 10:07:07 -070059LOCAL_JAVA_LIBRARIES := loganalysis tools-common-prebuilt
Brett Chabotf72f44c2010-01-27 11:09:46 -080060
Julien Desprezaf73ee42015-12-11 14:03:29 +000061LOCAL_JAR_MANIFEST := MANIFEST.mf
62
Brett Chabotf72f44c2010-01-27 11:09:46 -080063include $(BUILD_HOST_JAVA_LIBRARY)
64
Brett Chabot4bd67d52011-02-07 11:54:37 -080065# makefile rules to copy jars to HOST_OUT/tradefed
66# so tradefed.sh can automatically add to classpath
67DEST_JAR := $(HOST_OUT)/tradefed/$(LOCAL_MODULE).jar
68$(DEST_JAR): $(LOCAL_BUILT_MODULE)
69 $(copy-file-to-new-target)
70
Allen Haira9135322016-08-15 17:41:09 -070071$(HOST_OUT)/tradefed/%.jar : $(HOST_OUT_JAVA_LIBRARIES)/%.jar
72 $(copy-file-to-new-target)
73
Brett Chabot4bd67d52011-02-07 11:54:37 -080074# this dependency ensure the above rule will be executed if jar is built
75$(LOCAL_INSTALLED_MODULE) : $(DEST_JAR)
Allen Haira9135322016-08-15 17:41:09 -070076$(LOCAL_INSTALLED_MODULE) : $(foreach m, $(LOCAL_JAVA_LIBRARIES), $(HOST_OUT)/tradefed/$(m).jar)
Brett Chabot4bd67d52011-02-07 11:54:37 -080077
Omari Stephens6aeef7c2011-10-19 17:14:47 -070078#######################################################
Omari Stephens966291b2013-03-06 21:09:21 -080079# intentionally skipping CLEAR_VARS
Omari Stephens966291b2013-03-06 21:09:21 -080080# Enable the build process to generate javadoc
Ying Wangd786e242014-07-07 16:48:21 -070081# We need to reference symbols in the jar built above.
Billy Lambertabb7685c2017-02-24 11:12:32 -080082
Billy Lamberta7a37a842017-09-22 10:50:58 -070083# ==== tradefed-docs: devsite-compatible reference docs for source.android.com
Billy Lambertabb7685c2017-02-24 11:12:32 -080084LOCAL_JAVA_LIBRARIES += tradefed
85LOCAL_IS_HOST_MODULE := true
86LOCAL_MODULE_CLASS := JAVA_LIBRARIES
jdespreze9beeac2017-04-25 11:07:14 -070087LOCAL_ADDITIONAL_DEPENDENCIES := tradefed
Billy Lambertabb7685c2017-02-24 11:12:32 -080088LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := external/doclava/res/assets/templates-sdk
89LOCAL_DROIDDOC_OPTIONS := \
90 -hdf sac true \
91 -hdf devices true \
92 -hdf android.whichdoc online \
93 -hdf css.path /reference/assets/css/doclava-devsite.css \
94 -hdf book.root toc \
Billy Lamberta379e06f2017-08-03 13:22:15 -070095 -hdf book.path /reference/tradefed/_book.yaml \
96 -yaml _book.yaml \
Billy Lambertabb7685c2017-02-24 11:12:32 -080097 -apidocsdir reference/tradefed/ \
98 -werror \
99 -package \
100 -devsite \
101
102include $(BUILD_DROIDDOC)
103
Omari Stephens966291b2013-03-06 21:09:21 -0800104#######################################################
Omari Stephens6aeef7c2011-10-19 17:14:47 -0700105include $(CLEAR_VARS)
106
107# Create a simple alias to build all the TF-related targets
108# Note that this is incompatible with `make dist`. If you want to make
109# the distribution, you must run `tapas` with the individual target names.
mikehoranc80dc532017-11-14 14:30:06 -0800110.PHONY: tradefed-core
111tradefed-core: tradefed atest_tradefed tf-prod-tests tf-prod-metatests tradefed-contrib script_help
112
Omari Stephens6aeef7c2011-10-19 17:14:47 -0700113.PHONY: tradefed-all
mikehoranc80dc532017-11-14 14:30:06 -0800114tradefed-all: tradefed-core tradefed-tests tradefed_win verify loganalysis-tests
Omari Stephens6aeef7c2011-10-19 17:14:47 -0700115
Brett Chabot4bd67d52011-02-07 11:54:37 -0800116# ====================================
117include $(CLEAR_VARS)
118# copy tradefed.sh script to host dir
119
120LOCAL_MODULE_TAGS := optional
121
Simran Basif4bdb122017-08-23 13:13:53 -0700122LOCAL_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 -0800123include $(BUILD_HOST_PREBUILT)
124
Brett Chabotf72f44c2010-01-27 11:09:46 -0800125# Build all sub-directories
126include $(call all-makefiles-under,$(LOCAL_PATH))
Omari Stephens64043d82012-01-27 18:14:56 -0800127
128########################################################
Omari Stephens06bcef12015-05-06 16:26:49 -0700129# Zip up the built files and dist it as tradefed.zip
130ifneq (,$(filter tradefed tradefed-all, $(TARGET_BUILD_APPS)))
Omari Stephens64043d82012-01-27 18:14:56 -0800131
Julien Desprez71eca6b2018-04-16 14:32:24 -0700132tradefed_dist_host_jars := tradefed tradefed-tests tf-prod-tests tf-prod-metatests emmalib jack-jacoco-reporter loganalysis loganalysis-tests tf-remote-client tradefed-contrib
Omari Stephens64043d82012-01-27 18:14:56 -0800133tradefed_dist_host_jar_files := $(foreach m, $(tradefed_dist_host_jars), $(HOST_OUT_JAVA_LIBRARIES)/$(m).jar)
134
Simran Basif4bdb122017-08-23 13:13:53 -0700135tradefed_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 -0800136tradefed_dist_host_exe_files := $(foreach m, $(tradefed_dist_host_exes), $(BUILD_OUT_EXECUTABLES)/$(m))
137
David Hu6fb582f2012-12-19 18:49:19 -0800138tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp DeviceSetupUtil
Ying Wang0f9b11c2014-07-21 14:03:11 -0700139tradefed_dist_test_apk_files := $(foreach m, $(tradefed_dist_test_apks), $(TARGET_OUT_DATA_APPS)/$(m)/$(m).apk)
Omari Stephens64043d82012-01-27 18:14:56 -0800140
141tradefed_dist_files := \
142 $(tradefed_dist_host_jar_files) \
143 $(tradefed_dist_test_apk_files) \
Brett Chabotfee380c2013-02-01 15:25:08 -0800144 $(tradefed_dist_host_exe_files)
Omari Stephens64043d82012-01-27 18:14:56 -0800145
146tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON)
147tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip
148$(tradefed_dist_zip) : $(tradefed_dist_files)
149 @echo "Package: $@"
150 $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
151 $(hide) cp -f $^ $(dir $@)
152 $(hide) cd $(dir $@) && zip -q $(notdir $@) $(notdir $^)
153
Colin Cross29197902015-10-05 13:19:12 -0700154$(call dist-for-goals, apps_only, $(tradefed_dist_zip))
Omari Stephens64043d82012-01-27 18:14:56 -0800155
156endif # tradefed in $(TARGET_BUILD_APPS)