diff --git a/core/build-system.html b/core/build-system.html index 43bae03b6..ce5e869cd 100644 --- a/core/build-system.html +++ b/core/build-system.html @@ -704,6 +704,11 @@ automatically generated and then linked in when your module is built. See the Custom Tools template makefile for an example.

+

LOCAL_JAVACFLAGS

+

If you have additional flags to pass into the javac compiler, add +them here. For example:

+

LOCAL_JAVACFLAGS += -Xlint:deprecation

+

LOCAL_JAVA_LIBRARIES

When linking Java apps and libraries, LOCAL_JAVA_LIBRARIES specifies which sets of java classes to include. Currently there are diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 58c1800a0..6107808b3 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -51,6 +51,7 @@ LOCAL_PREBUILT_JAVA_LIBRARIES:= LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:= LOCAL_PREBUILT_STRIP_COMMENTS:= LOCAL_INTERMEDIATE_SOURCES:= +LOCAL_JAVACFLAGS:= LOCAL_JAVA_LIBRARIES:= LOCAL_NO_STANDARD_LIBRARIES:= LOCAL_CLASSPATH:= diff --git a/core/definitions.mk b/core/definitions.mk index 3401eb7eb..d45e8dd0d 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -671,6 +671,7 @@ define dump-module-variables @echo PRIVATE_ARFLAGS=$(PRIVATE_ARFLAGS); @echo PRIVATE_AAPT_FLAGS=$(PRIVATE_AAPT_FLAGS); @echo PRIVATE_DX_FLAGS=$(PRIVATE_DX_FLAGS); +@echo PRIVATE_JAVACFLAGS=$(PRIVATE_JAVACFLAGS); @echo PRIVATE_JAVA_LIBRARIES=$(PRIVATE_JAVA_LIBRARIES); @echo PRIVATE_ALL_SHARED_LIBRARIES=$(PRIVATE_ALL_SHARED_LIBRARIES); @echo PRIVATE_ALL_STATIC_LIBRARIES=$(PRIVATE_ALL_STATIC_LIBRARIES); @@ -1308,7 +1309,7 @@ $(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)))) \ - $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) $(xlint_unchecked) \ + $(PRIVATE_JAVACFLAGS) $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) $(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 ) @@ -1446,7 +1447,7 @@ $(call dump-words-to-file,$(sort\ $(PRIVATE_JAVA_SOURCES)),\ $(PRIVATE_INTERMEDIATES_DIR)/java-source-list-uniq) $(hide) $(HOST_JAVAC) -encoding ascii -g \ - $(xlint_unchecked) \ + $(PRIVATE_JAVACFLAGS) $(xlint_unchecked) \ $(addprefix -classpath ,$(strip \ $(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \ -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR)\ diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 92b5ff661..197711596 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -25,5 +25,6 @@ LOCAL_BUILT_MODULE_STEM := javalib.jar include $(BUILD_SYSTEM)/base_rules.mk +$(LOCAL_BUILT_MODULE): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(LOCAL_BUILT_MODULE): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) $(transform-host-java-to-package) diff --git a/core/java.mk b/core/java.mk index ddb87377b..65c4c8a16 100644 --- a/core/java.mk +++ b/core/java.mk @@ -135,6 +135,7 @@ ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar) # This intentionally depends on java_sources, not all_java_sources. # Deps for generated source files must be handled separately, # via deps on the target that generates the sources. +$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(full_classes_compiled_jar): $(java_sources) $(full_java_lib_deps) $(transform-java-to-classes.jar)