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
15ifneq ($(wildcard test/sts/README-autorepro.md),)
16test_suite_name := autorepro
17test_suite_tradefed := sts-tradefed
18test_suite_readme := test/sts/README-autorepro.md
19autorepro_zip := $(HOST_OUT)/$(test_suite_name)/autorepro.zip
20
21include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
22
23autorepro_plugin_skel := $(call intermediates-dir-for,ETC,autorepro-plugin-skel.zip)/autorepro-plugin-skel.zip
24
25$(autorepro_zip): AUTOREPRO_ZIP := $(compatibility_zip)
26$(autorepro_zip): AUTOREPRO_PLUGIN_SKEL := $(autorepro_plugin_skel)
27$(autorepro_zip): $(MERGE_ZIPS) $(ZIP2ZIP) $(compatibility_zip) $(autorepro_plugin_skel)
28	rm -f $@ $(AUTOREPRO_ZIP)_filtered
29	$(ZIP2ZIP) -i $(AUTOREPRO_ZIP) -o $(AUTOREPRO_ZIP)_filtered \
30		-x android-autorepro/tools/sts-tradefed-tests.jar \
31		'android-autorepro/tools/*:autorepro/src/main/resources/sts-tradefed-tools/'
32	$(MERGE_ZIPS) $@ $(AUTOREPRO_ZIP)_filtered $(AUTOREPRO_PLUGIN_SKEL)
33	rm -f $(AUTOREPRO_ZIP)_filtered
34
35.PHONY: autorepro
36autorepro: $(autorepro_zip)
37$(call dist-for-goals, autorepro, $(autorepro_zip))
38
39endif
40