Merge "Catch nonexistent BOARD_SEPOLICY_UNION policy files."
diff --git a/Android.mk b/Android.mk
index a3463bb..10b3ca3 100644
--- a/Android.mk
+++ b/Android.mk
@@ -50,6 +50,15 @@
) \
)
+# Quick edge case error detection for BOARD_SEPOLICY_UNION.
+# This ensures that a requested union file exists somewhere
+# in one of the listed BOARD_SEPOLICY_DIRS.
+$(foreach pf, $(BOARD_SEPOLICY_UNION), \
+ $(if $(filter 0, $(words $(wildcard $(addsuffix /$(pf), $(BOARD_SEPOLICY_DIRS))))), \
+ $(error No sepolicy file found for $(pf) in $(BOARD_SEPOLICY_DIRS)), \
+ ) \
+)
+
# Builds paths for all requested policy files w.r.t
# both BOARD_SEPOLICY_REPLACE and BOARD_SEPOLICY_UNION
# product variables.