1 # 2 # Copyright (C) 2017 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 # This build rule allows TradeFed test config file to be created based on 18 # following inputs: 19 # is_native: If the test is a native test. 20 # full_android_manifest: Name of the AndroidManifest file for the test. 21 # Output: 22 # autogen_test_config_file: Path to the test config file generated. 23 24 autogen_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config 25 ifeq (true,$(is_native)) 26 ifeq ($(LOCAL_NATIVE_BENCHMARK),true) 27 autogen_test_config_template := $(NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE) 28 else 29 ifeq ($(LOCAL_IS_HOST_MODULE),true) 30 autogen_test_config_template := $(NATIVE_HOST_TEST_CONFIG_TEMPLATE) 31 else 32 autogen_test_config_template := $(NATIVE_TEST_CONFIG_TEMPLATE) 33 endif 34 endif 35 # Auto generating test config file for native test 36 $(autogen_test_config_file): PRIVATE_MODULE_NAME := $(LOCAL_MODULE) 37 $(autogen_test_config_file) : $(autogen_test_config_template) 38 @echo "Auto generating test config $(notdir $@)" 39 $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE_NAME)&g;s&{EXTRA_OPTIONS}&&g' $< > $@ 40 my_auto_generate_config := true 41 else 42 # Auto generating test config file for instrumentation test 43 ifneq (,$(full_android_manifest)) 44 $(autogen_test_config_file): PRIVATE_AUTOGEN_TEST_CONFIG_SCRIPT := $(AUTOGEN_TEST_CONFIG_SCRIPT) 45 $(autogen_test_config_file): PRIVATE_TEST_CONFIG_ANDROID_MANIFEST := $(full_android_manifest) 46 $(autogen_test_config_file): PRIVATE_EMPTY_TEST_CONFIG := $(EMPTY_TEST_CONFIG) 47 $(autogen_test_config_file): PRIVATE_TEMPLATE := $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE) 48 $(autogen_test_config_file) : $(full_android_manifest) $(EMPTY_TEST_CONFIG) $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE) $(AUTOGEN_TEST_CONFIG_SCRIPT) 49 @echo "Auto generating test config $(notdir $@)" 50 @rm -f $@ 51 $(hide) $(PRIVATE_AUTOGEN_TEST_CONFIG_SCRIPT) $@ $(PRIVATE_TEST_CONFIG_ANDROID_MANIFEST) $(PRIVATE_EMPTY_TEST_CONFIG) $(PRIVATE_TEMPLATE) 52 my_auto_generate_config := true 53 endif # ifneq (,$(full_android_manifest)) 54 endif # ifneq (true,$(is_native)) 55 56 ifeq (true,$(my_auto_generate_config)) 57 LOCAL_INTERMEDIATE_TARGETS += $(autogen_test_config_file) 58 $(LOCAL_BUILT_MODULE): $(autogen_test_config_file) 59 ALL_MODULES.$(my_register_name).auto_test_config := true 60 $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_autogen := true 61 else 62 autogen_test_config_file := 63 endif 64 65 my_auto_generate_config := 66