Home | History | Annotate | Download | only in build
      1 # Copyright 2012 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 #
     16 # Builds a package and defines a rule to generate the associated test
     17 # package XML needed by CTS.
     18 #
     19 # Replace "include $(BUILD_PACKAGE)" with "include $(BUILD_CTS_GTEST_PACKAGE)"
     20 #
     21 
     22 # Disable by default so "m cts" will work in emulator builds
     23 LOCAL_DEX_PREOPT := false
     24 LOCAL_PROGUARD_ENABLED := disabled
     25 
     26 include $(BUILD_PACKAGE)
     27 
     28 cts_package_apk := $(CTS_TESTCASES_OUT)/$(LOCAL_PACKAGE_NAME).apk
     29 cts_package_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_PACKAGE_NAME).xml
     30 cts_test_list := $(LOCAL_PATH)/$(LOCAL_MODULE)_list.txt
     31 
     32 $(cts_package_apk): PRIVATE_PACKAGE := $(LOCAL_PACKAGE_NAME)
     33 $(cts_package_apk): $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/package.apk | $(ACP)
     34 	$(hide) mkdir -p $(CTS_TESTCASES_OUT)
     35 	$(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(PRIVATE_PACKAGE))/package.apk $@
     36 
     37 $(cts_package_xml): PRIVATE_PATH := $(LOCAL_PATH)
     38 $(cts_package_xml): PRIVATE_TEST_PACKAGE := android.$(notdir $(LOCAL_PATH))
     39 $(cts_package_xml): PRIVATE_EXECUTABLE := $(LOCAL_MODULE)
     40 $(cts_package_xml): PRIVATE_MANIFEST := $(LOCAL_PATH)/AndroidManifest.xml
     41 $(cts_package_xml): PRIVATE_TEST_LIST := $(cts_test_list)
     42 $(cts_package_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES))  $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR) $(cts_test_list)
     43 	$(hide) echo Generating test description for wrapped native package $(PRIVATE_EXECUTABLE)
     44 	$(hide) mkdir -p $(CTS_TESTCASES_OUT)
     45 	$(hide) cat $(PRIVATE_TEST_LIST) | \
     46 			$(CTS_NATIVE_TEST_SCANNER) -t $(PRIVATE_TEST_PACKAGE) | \
     47 			$(CTS_XML_GENERATOR) -t wrappednative \
     48 						-m $(PRIVATE_MANIFEST) \
     49 						-n $(PRIVATE_EXECUTABLE) \
     50 						-p $(PRIVATE_TEST_PACKAGE) \
     51 						-e $(CTS_EXPECTATIONS) \
     52 						-o $@
     53