From 7adbf97d110ebe137579e1078e3846aa4f3c6c2c Mon Sep 17 00:00:00 2001 From: Jeffrey Chyan Date: Wed, 7 Jul 2010 13:42:19 -0500 Subject: [PATCH] Allow explicit warnings for projects Enabled compiler warnings by default and then modified javac command to include warnings only if a project's warning flag, LOCAL_WARNINGS_ENABLE, is set to true. Change-Id: I5111d16a862f3afaaf1dcba2f2c2b7fc072613f1 --- core/clear_vars.mk | 1 + core/definitions.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 0fe3c8bce5..4520956606 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -92,6 +92,7 @@ LOCAL_NO_EMMA_INSTRUMENT:= LOCAL_NO_EMMA_COMPILE:= LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom LOCAL_PROGUARD_FLAGS:= +LOCAL_WARNINGS_ENABLE:= # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to # iterate over thousands of entries every time. diff --git a/core/definitions.mk b/core/definitions.mk index 83d472bc5f..7e2d1fbfe5 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1238,7 +1238,7 @@ endef ifeq ($(HOST_OS),windows) xlint_unchecked := else -#xlint_unchecked := -Xlint:unchecked +xlint_unchecked := -Xlint:unchecked endif # emit-line, , @@ -1308,7 +1308,8 @@ $(hide) tr ' ' '\n' < $(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list $(hide) $(TARGET_JAVAC) -encoding ascii $(PRIVATE_BOOTCLASSPATH) \ $(addprefix -classpath ,$(strip \ $(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \ - $(PRIVATE_JAVACFLAGS) $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) $(xlint_unchecked) \ + $(PRIVATE_JAVACFLAGS) $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \ + $(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \ -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \ \@$(dir $(PRIVATE_CLASS_INTERMEDIATES_DIR))/java-source-list-uniq \ || ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 )