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
15LOCAL_PATH := $(call my-dir)
16
17vti-global-config-prod-zip :=
18vti-global-config-test-zip :=
19
20dirs := $(strip \
21  $(wildcard test/vti/test_serving/configs/global/prod) \
22  $(wildcard vendor/google_vts/configs/global/prod))
23ifdef dirs
24vti-global-config-prod-zip := $(HOST_OUT)/vti-global-config/vti-global-config-prod.zip
25$(vti-global-config-prod-zip): $(SOONG_ZIP) $(call find-files-in-subdirs,.,"*.*_config", $(dirs))
26	@echo "build vti config package: $@"
27	$(hide) mkdir -p $(dir $@)
28	$(hide) rm -f $@
29	$(hide) find test/vti/test_serving/configs/global/prod/ -name '*.*_config' | sort > $@.list
30	$(hide) find vendor/google_vts/configs/global/prod/ -name '*.*_config' | sort > $@.list.vendor
31	$(hide) $(SOONG_ZIP) -d -o $@ -C test/vti/test_serving/configs/global -l $@.list \
32	    -C vendor/google_vts/configs/global -l $@.list.vendor
33	$(hide) rm -f $@.list $@.list.vendor
34endif
35
36dirs := $(strip \
37    $(wildcard test/vti/test_serving/configs/global/test) \
38    $(wildcard vendor/google_vts/configs/global/test))
39ifdef dirs
40vti-global-config-test-zip := $(HOST_OUT)/vti-global-config/vti-global-config-test.zip
41$(vti-global-config-test-zip): $(SOONG_ZIP) $(call find-files-in-subdirs,.,"*.*_config", $(dirs))
42	@echo "build vti config package: $@"
43	$(hide) mkdir -p $(dir $@)
44	$(hide) rm -f $@
45	$(hide) find test/vti/test_serving/configs/global/test/ -name '*.*_config' | sort > $@.list
46	$(hide) find vendor/google_vts/configs/global/test/ -name '*.*_config' | sort > $@.list.vendor
47	$(hide) $(SOONG_ZIP) -d -o $@ -C test/vti/test_serving/configs/global -l $@.list \
48	    -C vendor/google_vts/configs/global -l $@.list.vendor
49	$(hide) rm -f $@.list $@.list.vendor
50endif
51
52.PHONY: vti-global-config
53vti-global-config: $(vti-global-config-prod-zip) $(vti-global-config-test-zip)
54$(call dist-for-goals, vti-global-config, $(vti-global-config-prod-zip) $(vti-global-config-test-zip))
55
56.PHONY: vti-config
57vti-config: vti-global-config
58
59.PHONY: vti
60vti: vti-config
61
62.PHONY: vts
63vts: vti-config
64