Do not depend on make intermediates for soong generated module

This change modifies the dependencies in make so that for soong
generated modules the output file of the module does not depend on the
make intermediates. This makes the dependencies of the output files of
the soong modules identical between soong only build and soong plus make
build.

Test: m --no-soong-only && CI
Bug: 413097935
Change-Id: I89787694a87ccdfdf0b6bbf2e1dbfbcc8bd4fbff
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 8db46e2..835caa3 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -505,12 +505,8 @@
 
 my_installed_symlinks :=
 
-ifneq (,$(LOCAL_SOONG_INSTALLED_MODULE))
-  # Soong already generated the copy rule, but make the installed location depend on the Make
-  # copy of the intermediates for now, as some rules that collect intermediates may expect
-  # them to exist.
-  $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
-else ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+ifeq (,$(LOCAL_SOONG_INSTALLED_MODULE))
+ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
   $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
   $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
 	@echo "Install: $@"
@@ -530,6 +526,7 @@
   $(my_all_targets) : | $(my_installed_symlinks)
 
 endif # !LOCAL_UNINSTALLABLE_MODULE
+endif # !LOCAL_SOONG_INSTALLED_MODULE
 
 # Add dependencies on LOCAL_SOONG_INSTALL_SYMLINKS if we're installing any kind of module, not just
 # ones that set LOCAL_SOONG_INSTALLED_MODULE. This is so we can have a soong module that only
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 8c3882f..ea701f4 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -28,7 +28,6 @@
 ifdef LOCAL_SOONG_CLASSES_JAR
   $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
   $(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
-  $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar)))
 
   ifneq ($(TURBINE_ENABLED),false)
     ifdef LOCAL_SOONG_HEADER_JAR
@@ -116,9 +115,7 @@
     endif # is_boot_jar
 
     $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
-    $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(common_javalib.jar)))
     ifdef LOCAL_SOONG_CLASSES_JAR
-      $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar)))
       ifneq ($(TURBINE_ENABLED),false)
         $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_header_jar)))
       endif