Add -Werror to compile warning free projects.
* Add -Werror if LOCAL_PATH is in the WARNING_DISALLOWED project list,
or not in the WARNING_ALLOWED project list.
Test: Build for major targets.
Change-Id: I12235ee1ca1c1837530693699e705e1955275565
diff --git a/core/binary.mk b/core/binary.mk
index 4dcb152..c682d4e 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1596,6 +1596,16 @@
my_cflags += -DANDROID_STRICT
endif
+# Add -Werror if LOCAL_PATH is in the WARNING_DISALLOWED project list,
+# or not in the WARNING_ALLOWED project list.
+ifneq (,$(strip $(call find_warning_disallowed_projects,$(LOCAL_PATH))))
+ my_cflags_no_override += -Werror
+else
+ ifeq (,$(strip $(call find_warning_allowed_projects,$(LOCAL_PATH))))
+ my_cflags_no_override += -Werror
+ endif
+endif
+
# Disable clang-tidy if it is not found.
ifeq ($(PATH_TO_CLANG_TIDY),)
my_tidy_enabled := false