1# Copyright (C) 2022 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.PHONY: automotive-general-tests 16 17automotive_general_tests_tools := \ 18 $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar \ 19 $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \ 20 $(HOST_OUT_JAVA_LIBRARIES)/vts-tradefed.jar \ 21 22intermediates_dir := $(call intermediates-dir-for,PACKAGING,automotive-general-tests) 23automotive_general_tests_zip := $(PRODUCT_OUT)/automotive-general-tests.zip 24# Create an artifact to include a list of test config files in automotive-general-tests. 25automotive_general_tests_list_zip := $(PRODUCT_OUT)/automotive-general-tests_list.zip 26 27# Filter shared entries between automotive-general-tests and automotive-tests's HOST_SHARED_LIBRARY.FILES, 28# to avoid warning about overriding commands. 29my_host_shared_lib_for_automotive_general_tests := \ 30 $(foreach m,$(filter $(COMPATIBILITY.automotive-tests.HOST_SHARED_LIBRARY.FILES),\ 31 $(COMPATIBILITY.automotive-general-tests.HOST_SHARED_LIBRARY.FILES)),$(call word-colon,2,$(m))) 32my_automotive_general_tests_shared_lib_files := \ 33 $(filter-out $(COMPATIBILITY.automotive-tests.HOST_SHARED_LIBRARY.FILES),\ 34 $(COMPATIBILITY.automotive-general-tests.HOST_SHARED_LIBRARY.FILES)) 35 36my_host_shared_lib_for_automotive_general_tests += $(call copy-many-files,$(my_automotive_general_tests_shared_lib_files)) 37 38# Create an artifact to include all test config files in automotive-general-tests. 39automotive_general_tests_configs_zip := $(PRODUCT_OUT)/automotive-general-tests_configs.zip 40# Create an artifact to include all shared librariy files in automotive-general-tests. 41automotive_general_tests_host_shared_libs_zip := $(PRODUCT_OUT)/automotive-general-tests_host-shared-libs.zip 42 43$(automotive_general_tests_zip) : PRIVATE_automotive_general_tests_list_zip := $(automotive_general_tests_list_zip) 44$(automotive_general_tests_zip) : .KATI_IMPLICIT_OUTPUTS := $(automotive_general_tests_list_zip) $(automotive_general_tests_configs_zip) $(automotive_general_tests_host_shared_libs_zip) 45$(automotive_general_tests_zip) : PRIVATE_TOOLS := $(automotive_general_tests_tools) 46$(automotive_general_tests_zip) : PRIVATE_INTERMEDIATES_DIR := $(intermediates_dir) 47$(automotive_general_tests_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_automotive_general_tests) 48$(automotive_general_tests_zip) : PRIVATE_automotive_general_tests_configs_zip := $(automotive_general_tests_configs_zip) 49$(automotive_general_tests_zip) : PRIVATE_general_host_shared_libs_zip := $(automotive_general_tests_host_shared_libs_zip) 50$(automotive_general_tests_zip) : $(COMPATIBILITY.automotive-general-tests.FILES) $(automotive_general_tests_tools) $(my_host_shared_lib_for_automotive_general_tests) $(SOONG_ZIP) 51 rm -rf $(PRIVATE_INTERMEDIATES_DIR) 52 rm -f $@ $(PRIVATE_automotive_general_tests_list_zip) 53 mkdir -p $(PRIVATE_INTERMEDIATES_DIR) $(PRIVATE_INTERMEDIATES_DIR)/tools 54 echo $(sort $(COMPATIBILITY.automotive-general-tests.FILES)) | tr " " "\n" > $(PRIVATE_INTERMEDIATES_DIR)/list 55 grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/host.list || true 56 grep $(TARGET_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/target.list || true 57 grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list > $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list || true 58 grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list > $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list || true 59 $(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \ 60 echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/host.list; \ 61 echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list; \ 62 done 63 grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list > $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list || true 64 cp -fp $(PRIVATE_TOOLS) $(PRIVATE_INTERMEDIATES_DIR)/tools/ 65 $(SOONG_ZIP) -d -o $@ \ 66 -P host -C $(PRIVATE_INTERMEDIATES_DIR) -D $(PRIVATE_INTERMEDIATES_DIR)/tools \ 67 -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host.list \ 68 -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target.list 69 $(SOONG_ZIP) -d -o $(PRIVATE_automotive_general_tests_configs_zip) \ 70 -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list \ 71 -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list 72 $(SOONG_ZIP) -d -o $(PRIVATE_general_host_shared_libs_zip) \ 73 -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list 74 grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_INTERMEDIATES_DIR)/automotive-general-tests_list 75 grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_INTERMEDIATES_DIR)/automotive-general-tests_list 76 $(SOONG_ZIP) -d -o $(PRIVATE_automotive_general_tests_list_zip) -C $(PRIVATE_INTERMEDIATES_DIR) -f $(PRIVATE_INTERMEDIATES_DIR)/automotive-general-tests_list 77 78automotive-general-tests: $(automotive_general_tests_zip) 79$(call dist-for-goals, automotive-general-tests, $(automotive_general_tests_zip) $(automotive_general_tests_list_zip) $(automotive_general_tests_configs_zip) $(automotive_general_tests_host_shared_libs_zip)) 80 81$(call declare-1p-container,$(automotive_general_tests_zip),) 82$(call declare-container-license-deps,$(automotive_general_tests_zip),$(COMPATIBILITY.automotive-general-tests.FILES) $(automotive_general_tests_tools) $(my_host_shared_lib_for_automotive_general_tests),$(PRODUCT_OUT)/:/) 83 84intermediates_dir := 85automotive_general_tests_tools := 86automotive_general_tests_zip := 87automotive_general_tests_list_zip := 88automotive_general_tests_configs_zip := 89automotive_general_tests_host_shared_libs_zip := 90