diff --git a/core/product_config.mk b/core/product_config.mk index c1c08d1491..11ffadea00 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -146,6 +146,11 @@ load_all_product_makefiles := true endif endif +ifneq ($(ALLOW_RULES_IN_PRODUCT_CONFIG),) +_product_config_saved_KATI_ALLOW_RULES := $(.KATI_ALLOW_RULES) +.KATI_ALLOW_RULES := $(ALLOW_RULES_IN_PRODUCT_CONFIG) +endif + ifeq ($(load_all_product_makefiles),true) # Import all product makefiles. $(call import-products, $(all_product_makefiles)) @@ -172,6 +177,11 @@ $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\ ) endif +ifneq ($(ALLOW_RULES_IN_PRODUCT_CONFIG),) +.KATI_ALLOW_RULES := $(_saved_KATI_ALLOW_RULES) +_product_config_saved_KATI_ALLOW_RULES := +endif + ifneq ($(filter dump-products, $(MAKECMDGOALS)),) $(dump-products) endif diff --git a/tools/product_config/src/com/android/build/config/OutputChecker.java b/tools/product_config/src/com/android/build/config/OutputChecker.java index 228f9f13a5..d982dba7ed 100644 --- a/tools/product_config/src/com/android/build/config/OutputChecker.java +++ b/tools/product_config/src/com/android/build/config/OutputChecker.java @@ -38,7 +38,11 @@ public class OutputChecker { "PRODUCTS\\..*\\.PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST", // This is generated by this tool, but comes later in the make build system. - "INTERNAL_PRODUCT"); + "INTERNAL_PRODUCT", + + // This can be set temporarily by product_config.mk + ".KATI_ALLOW_RULES" + ); private final FlatConfig mConfig; private final TreeMap mVariables; diff --git a/tools/product_config/test.sh b/tools/product_config/test.sh index a910df8016..ee9ed5cb3b 100755 --- a/tools/product_config/test.sh +++ b/tools/product_config/test.sh @@ -52,14 +52,16 @@ failed_baseline_checks= for product in $products ; do for variant in $variants ; do echo - echo Checking to see if $product-$variant works with make - TARGET_PRODUCT=$product TARGET_BUILD_VARIANT=$variant build/soong/soong_ui.bash --dumpvar-mode TARGET_PRODUCT &> /dev/null + echo "Checking: lunch $product-$variant" + + TARGET_PRODUCT=$product \ + TARGET_BUILD_VARIANT=$variant \ + build/soong/soong_ui.bash --dumpvar-mode TARGET_PRODUCT &> /dev/null exit_status=$? if_signal_exit $exit_status if [ $exit_status -ne 0 ] ; then - echo Combo fails with make, skipping product-config test run for $product-$variant + echo "*** Combo fails with make, skipping product-config test run for $product-$variant" else - echo Running product-config for $product-$variant rm -rf out/config/$product-$variant TARGET_PRODUCT=$product TARGET_BUILD_VARIANT=$variant product-config \ --ckati_bin $CKATI_BIN \ @@ -69,6 +71,28 @@ for product in $products ; do if [ $exit_status -ne 0 ] ; then failed_baseline_checks="$failed_baseline_checks $product-$variant" fi + if [ "$CHECK_FOR_RULES" != "" ] ; then + # This is a little bit of sleight of hand for good output formatting at the + # expense of speed. We've already run the command once without + # ALLOW_RULES_IN_PRODUCT_CONFIG, so we know it passes there. We run it again + # with ALLOW_RULES_IN_PRODUCT_CONFIG=error to see if it fails, but that will + # cause it to only print the first error. But we want to see all of them, + # so if it fails we run it a third time with ALLOW_RULES_IN_PRODUCT_CONFIG=warning, + # so we can see all the warnings. + TARGET_PRODUCT=$product \ + TARGET_BUILD_VARIANT=$variant \ + ALLOW_RULES_IN_PRODUCT_CONFIG=error \ + build/soong/soong_ui.bash --dumpvar-mode TARGET_PRODUCT &> /dev/null + exit_status=$? + if_signal_exit $exit_status + if [ $exit_status -ne 0 ] ; then + TARGET_PRODUCT=$product \ + TARGET_BUILD_VARIANT=$variant \ + ALLOW_RULES_IN_PRODUCT_CONFIG=warning \ + build/soong/soong_ui.bash --dumpvar-mode TARGET_PRODUCT > /dev/null + failed_rule_checks="$failed_rule_checks $product-$variant" + fi + fi fi done done @@ -88,3 +112,9 @@ for combo in $failed_baseline_checks ; do echo " ... $combo" done +echo -n "Rules checks " +if [ "$failed_rule_checks" = "" ] ; then echo PASSED ; else echo FAILED ; fi +for combo in $failed_rule_checks ; do + echo " ... $combo" +done +