Brett Chabot | f72f44c | 2010-01-27 11:09:46 -0800 | [diff] [blame] | 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 | |
| 15 | LOCAL_PATH := $(call my-dir) |
| 16 | |
| 17 | include $(CLEAR_VARS) |
| 18 | |
| 19 | # Only compile source java files in this lib. |
| 20 | LOCAL_SRC_FILES := $(call all-java-files-under, src) |
| 21 | |
Brett Chabot | e278a5b | 2010-06-01 16:20:14 -0700 | [diff] [blame] | 22 | LOCAL_JAVA_RESOURCE_DIRS := res |
| 23 | |
Guang Zhu | 040a43a | 2012-01-25 14:38:16 -0800 | [diff] [blame] | 24 | LOCAL_JAVACFLAGS += -g -Xlint |
Guang Zhu | c5637f7 | 2011-07-24 13:15:24 -0700 | [diff] [blame] | 25 | |
Brett Chabot | 0aebe55 | 2010-09-13 14:26:46 -0700 | [diff] [blame] | 26 | LOCAL_MODULE := tradefed |
Brett Chabot | f72f44c | 2010-01-27 11:09:46 -0800 | [diff] [blame] | 27 | |
Brett Chabot | 36d4f87 | 2010-09-15 18:28:27 -0700 | [diff] [blame] | 28 | LOCAL_MODULE_TAGS := optional |
Omari Stephens | 201dc52 | 2011-11-09 16:46:40 -0800 | [diff] [blame] | 29 | LOCAL_STATIC_JAVA_LIBRARIES := junit kxml2-2.3.0 guavalib jline-1.0 |
Brett Chabot | 0aebe55 | 2010-09-13 14:26:46 -0700 | [diff] [blame] | 30 | LOCAL_JAVA_LIBRARIES := ddmlib-prebuilt |
Brett Chabot | f72f44c | 2010-01-27 11:09:46 -0800 | [diff] [blame] | 31 | |
| 32 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 33 | |
Brett Chabot | 4bd67d5 | 2011-02-07 11:54:37 -0800 | [diff] [blame] | 34 | # makefile rules to copy jars to HOST_OUT/tradefed |
| 35 | # so tradefed.sh can automatically add to classpath |
| 36 | DEST_JAR := $(HOST_OUT)/tradefed/$(LOCAL_MODULE).jar |
| 37 | $(DEST_JAR): $(LOCAL_BUILT_MODULE) |
| 38 | $(copy-file-to-new-target) |
| 39 | |
| 40 | # this dependency ensure the above rule will be executed if jar is built |
| 41 | $(LOCAL_INSTALLED_MODULE) : $(DEST_JAR) |
| 42 | |
Omari Stephens | 6aeef7c | 2011-10-19 17:14:47 -0700 | [diff] [blame] | 43 | ####################################################### |
| 44 | include $(CLEAR_VARS) |
| 45 | |
| 46 | # Create a simple alias to build all the TF-related targets |
| 47 | # Note that this is incompatible with `make dist`. If you want to make |
| 48 | # the distribution, you must run `tapas` with the individual target names. |
| 49 | .PHONY: tradefed-all |
Omari Stephens | cb76e3a | 2012-03-19 20:12:41 -0700 | [diff] [blame] | 50 | tradefed-all: tradefed tradefed-tests tf-prod-tests tf-prod-metatests |
Omari Stephens | 6aeef7c | 2011-10-19 17:14:47 -0700 | [diff] [blame] | 51 | |
Brett Chabot | 4bd67d5 | 2011-02-07 11:54:37 -0800 | [diff] [blame] | 52 | # ==================================== |
| 53 | include $(CLEAR_VARS) |
| 54 | # copy tradefed.sh script to host dir |
| 55 | |
| 56 | LOCAL_MODULE_TAGS := optional |
| 57 | |
| 58 | LOCAL_PREBUILT_EXECUTABLES := tradefed.sh |
| 59 | include $(BUILD_HOST_PREBUILT) |
| 60 | |
Brett Chabot | f72f44c | 2010-01-27 11:09:46 -0800 | [diff] [blame] | 61 | # Build all sub-directories |
| 62 | include $(call all-makefiles-under,$(LOCAL_PATH)) |
Omari Stephens | 64043d8 | 2012-01-27 18:14:56 -0800 | [diff] [blame] | 63 | |
| 64 | ######################################################## |
| 65 | # Zip up the built files and dist it as google-tradefed.zip |
| 66 | ifneq (,$(filter tradefed, $(TARGET_BUILD_APPS))) |
| 67 | |
| 68 | tradefed_dist_host_jars := tradefed tradefed-tests ddmlib-prebuilt tf-prod-tests |
| 69 | tradefed_dist_host_jar_files := $(foreach m, $(tradefed_dist_host_jars), $(HOST_OUT_JAVA_LIBRARIES)/$(m).jar) |
| 70 | |
| 71 | tradefed_dist_host_exes := tradefed.sh |
| 72 | tradefed_dist_host_exe_files := $(foreach m, $(tradefed_dist_host_exes), $(BUILD_OUT_EXECUTABLES)/$(m)) |
| 73 | |
| 74 | tradefed_dist_test_apks := TradeFedUiTestApp TradeFedTestApp |
| 75 | tradefed_dist_test_apk_files := $(foreach m, $(tradefed_dist_test_apks), $(TARGET_OUT_DATA_APPS)/$(m).apk) |
| 76 | |
| 77 | tradefed_dist_files := \ |
| 78 | $(tradefed_dist_host_jar_files) \ |
| 79 | $(tradefed_dist_test_apk_files) \ |
| 80 | $(tradefed_dist_host_exe_files) |
| 81 | |
| 82 | tradefed_dist_intermediates := $(call intermediates-dir-for,PACKAGING,tradefed_dist,HOST,COMMON) |
| 83 | tradefed_dist_zip := $(tradefed_dist_intermediates)/tradefed.zip |
| 84 | $(tradefed_dist_zip) : $(tradefed_dist_files) |
| 85 | @echo "Package: $@" |
| 86 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) |
| 87 | $(hide) cp -f $^ $(dir $@) |
| 88 | $(hide) cd $(dir $@) && zip -q $(notdir $@) $(notdir $^) |
| 89 | |
| 90 | .PHONY: tradefed_dist |
| 91 | tradefed_dist : $(tradefed_dist_zip) |
| 92 | |
| 93 | $(call dist-for-goals, tradefed_dist, $(tradefed_dist_zip)) |
| 94 | dist: tradefed_dist |
| 95 | |
| 96 | endif # tradefed in $(TARGET_BUILD_APPS) |
| 97 | |