diff --git a/core/base_rules.mk b/core/base_rules.mk index 242b53d556..668271e374 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -381,7 +381,7 @@ endif # java_resource_file_groups ## PRIVATE java vars ###################################### -ifneq ($(strip $(all_java_sources)$(all_res_assets)),) +ifneq ($(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES),) full_static_java_libs := \ $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ diff --git a/core/definitions.mk b/core/definitions.mk index 154c026e60..e950d38a6f 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1445,7 +1445,8 @@ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \ fi $(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \ | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq -$(hide) $(1) -encoding UTF-8 \ +$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \ + $(1) -encoding UTF-8 \ $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \ $(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \ $(2) \ @@ -1455,7 +1456,8 @@ $(hide) $(1) -encoding UTF-8 \ -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \ $(PRIVATE_JAVACFLAGS) \ \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \ - || ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) + || ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) \ +fi $(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list $(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq $(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \ diff --git a/core/java.mk b/core/java.mk index 0cc0762084..47f7b416f9 100644 --- a/core/java.mk +++ b/core/java.mk @@ -5,7 +5,7 @@ # Make sure there's something to build. # It's possible to build a package that doesn't contain any classes. -ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets))) +ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES))) $(error $(LOCAL_PATH): Target java module does not define any source or resource files) endif @@ -220,7 +220,7 @@ $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON) # If the module includes java code (i.e., it's not framework-res), compile it. full_classes_jar := built_dex := -ifneq (,$(strip $(all_java_sources))) +ifneq (,$(strip $(all_java_sources)$(full_static_java_libs))) # If LOCAL_BUILT_MODULE_STEM wasn't overridden by our caller, # full_classes_jar will be the same module as LOCAL_BUILT_MODULE.