Clear resource_export_package outside conditionals
$(resource_export_package) is used by package_internal.mk outside
ifeq ($(need_compile_res),true), but only cleared inside the
conditional. This causes unnecessary dependencies to be added
to an old value of $(resource_export_package). In rare cases,
the dependency can be on itself, causing a dependency loop.
Bug: 71571462
Test: m checkbuild
Change-Id: I9fda7fe3bf9d208ad4ba2f8cdb184034bf43f044
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 6b5dca2..e153a8a 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -363,6 +363,8 @@
$(full_classes_compiled_jar): $(data_binding_stamp)
endif # LOCAL_DATA_BINDING
+resource_export_package :=
+
ifeq ($(need_compile_res),true)
###############################
@@ -429,7 +431,6 @@
$(proguard_options_file): $(R_file_stamp)
-resource_export_package :=
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
# Put this module's resources into a PRODUCT-agnositc package that
# other packages can use to build their own PRODUCT-agnostic R.java (etc.)