Dan Shi | 679cc2a | 2017-11-30 13:20:43 -0800 | [diff] [blame] | 1 | # Copyright (C) 2017 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 | |
Dan Shi | 639c6cc | 2018-04-13 14:39:53 -0700 | [diff] [blame] | 15 | # Create an artifact to include TEST_MAPPING files in source tree. Also include |
| 16 | # a file (out/disabled-presubmit-tests) containing the tests that should be |
| 17 | # skipped in presubmit check. |
Dan Shi | 679cc2a | 2017-11-30 13:20:43 -0800 | [diff] [blame] | 18 | |
| 19 | .PHONY: test_mapping |
| 20 | |
| 21 | intermediates := $(call intermediates-dir-for,PACKAGING,test_mapping) |
| 22 | test_mappings_zip := $(intermediates)/test_mappings.zip |
| 23 | test_mapping_list := $(OUT_DIR)/.module_paths/TEST_MAPPING.list |
Dan Shi | 639c6cc | 2018-04-13 14:39:53 -0700 | [diff] [blame] | 24 | $(test_mappings_zip) : PRIVATE_all_disabled_presubmit_tests := $(ALL_DISABLED_PRESUBMIT_TESTS) |
Colin Cross | 01475b4 | 2023-03-23 20:37:34 -0700 | [diff] [blame^] | 25 | $(test_mappings_zip) : PRIVATE_test_mapping_list := $(test_mapping_list) |
Dan Shi | 679cc2a | 2017-11-30 13:20:43 -0800 | [diff] [blame] | 26 | |
Colin Cross | 01475b4 | 2023-03-23 20:37:34 -0700 | [diff] [blame^] | 27 | $(test_mappings_zip) : .KATI_DEPFILE := $(test_mappings_zip).d |
| 28 | $(test_mappings_zip) : $(test_mapping_list) $(SOONG_ZIP) |
Dan Shi | 639c6cc | 2018-04-13 14:39:53 -0700 | [diff] [blame] | 29 | @echo "Building artifact to include TEST_MAPPING files and tests to skip in presubmit check." |
| 30 | rm -rf $@ $(dir $@)/disabled-presubmit-tests |
| 31 | echo $(sort $(PRIVATE_all_disabled_presubmit_tests)) | tr " " "\n" > $(dir $@)/disabled-presubmit-tests |
Colin Cross | 01475b4 | 2023-03-23 20:37:34 -0700 | [diff] [blame^] | 32 | $(SOONG_ZIP) -o $@ -C . -l $(PRIVATE_test_mapping_list) -C $(dir $@) -f $(dir $@)/disabled-presubmit-tests |
| 33 | echo "$@ : " $$(cat $(PRIVATE_test_mapping_list)) > $@.d |
| 34 | rm -f $(dir $@)/disabled-presubmit-tests |
Dan Shi | 679cc2a | 2017-11-30 13:20:43 -0800 | [diff] [blame] | 35 | |
| 36 | test_mapping : $(test_mappings_zip) |
| 37 | |
| 38 | $(call dist-for-goals, dist_files test_mapping,$(test_mappings_zip)) |
Bob Badour | 3a0f0c1 | 2022-04-05 10:43:45 -0700 | [diff] [blame] | 39 | |
| 40 | $(call declare-1p-target,$(test_mappings_zip),) |