Rename ART release APEX to com.android.art.

Test: Build & boot on AOSP master
Test: `m` on AOSP master, flipping
  PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD between true and false, and
  check out/target/product/bonito/symbols/apex/com.android.art.
Test: art/build/apex/runtests.sh
Test: art/tools/buildbot-build.sh {--host,--target}
Test: art/tools/run-gtests.sh
Test: m test-art-host-gtest
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Test: m build-art-target-golem
Bug: 169639321
Change-Id: Ic4bb8d6f9988ce99bba326b9c635bd3c01ed74ab
Merged-In: Ic4bb8d6f9988ce99bba326b9c635bd3c01ed74ab
diff --git a/Android.mk b/Android.mk
index 5b829f9..a5c6804 100644
--- a/Android.mk
+++ b/Android.mk
@@ -287,8 +287,8 @@
 include $(CLEAR_VARS)
 
 # The ART APEX comes in three flavors:
-# - the release module (`com.android.art.release`), containing
-#   only "release" artifacts;
+# - the release module (`com.android.art`), containing only "release"
+#   artifacts;
 # - the debug module (`com.android.art.debug`), containing both
 #   "release" and "debug" artifacts, as well as additional tools;
 # - the testing module (`com.android.art.testing`), containing
@@ -339,16 +339,16 @@
 endif
 include $(BUILD_PHONY_PACKAGE)
 
-# Create canonical name -> file name symlink in the symbol directory
-# The symbol files for the debug or release variant are installed to
-# $(TARGET_OUT_UNSTRIPPED)/$(TARGET_ART_APEX) directory. However,
-# since they are available via /apex/com.android.art at runtime
-# regardless of which variant is installed, create a symlink so that
+# Create canonical name -> file name symlink in the symbol directory for the
+# debug APEX. The symbol files for it are installed to
+# $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art.debug. However, since it's
+# available via /apex/com.android.art at runtime, create a symlink so that
 # $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art is linked to
-# $(TARGET_OUT_UNSTRIPPED)/apex/$(TARGET_ART_APEX).
-# Note that installation of the symlink is triggered by the apex_manifest.pb
-# file which is the file that is guaranteed to be created regardless of the
-# value of TARGET_FLATTEN_APEX.
+# $(TARGET_OUT_UNSTRIPPED)/apex/$(TARGET_ART_APEX). We skip this for the release
+# APEX which has com.android.art as $(TARGET_ART_APEX). Note that installation
+# of the symlink is triggered by the apex_manifest.pb file which is the file
+# that is guaranteed to be created regardless of the value of
+# TARGET_FLATTEN_APEX.
 ifeq ($(TARGET_FLATTEN_APEX),true)
 art_apex_manifest_file := $(PRODUCT_OUT)/system/apex/$(TARGET_ART_APEX)/apex_manifest.pb
 else
@@ -359,8 +359,13 @@
 $(art_apex_manifest_file): $(art_apex_symlink_timestamp)
 $(art_apex_manifest_file): PRIVATE_LINK_NAME := $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art
 $(art_apex_symlink_timestamp):
+ifeq ($(TARGET_ART_APEX),com.android.art)
+	$(hide) if [ -L $(PRIVATE_LINK_NAME) ]; then rm -f $(PRIVATE_LINK_NAME); fi
+else
 	$(hide) mkdir -p $(dir $(PRIVATE_LINK_NAME))
+	$(hide) rm -rf $(PRIVATE_LINK_NAME)
 	$(hide) ln -sf $(TARGET_ART_APEX) $(PRIVATE_LINK_NAME)
+endif
 	$(hide) touch $@
 $(art_apex_symlink_timestamp): .KATI_SYMLINK_OUTPUTS := $(PRIVATE_LINK_NAME)
 
@@ -377,16 +382,16 @@
 
 # Base requirements.
 LOCAL_REQUIRED_MODULES := \
-    dalvikvm.com.android.art.release \
-    dex2oat.com.android.art.release \
-    dexoptanalyzer.com.android.art.release \
-    libart.com.android.art.release \
-    libart-compiler.com.android.art.release \
-    libopenjdkjvm.com.android.art.release \
-    libopenjdkjvmti.com.android.art.release \
-    profman.com.android.art.release \
-    libadbconnection.com.android.art.release \
-    libperfetto_hprof.com.android.art.release \
+    dalvikvm.com.android.art \
+    dex2oat.com.android.art \
+    dexoptanalyzer.com.android.art \
+    libart.com.android.art \
+    libart-compiler.com.android.art \
+    libopenjdkjvm.com.android.art \
+    libopenjdkjvmti.com.android.art \
+    profman.com.android.art \
+    libadbconnection.com.android.art \
+    libperfetto_hprof.com.android.art \
 
 # Potentially add in debug variants:
 #
@@ -709,8 +714,6 @@
 	sed -i '/libdexfiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt
 	sed -i '/libprofiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt
 	sed -i '/libartbased.so/d' $(TARGET_OUT)/etc/public.libraries.txt
-	# The 'art' script will look for a 'com.android.art' directory.
-	ln -sf com.android.art.release $(TARGET_OUT)/apex/com.android.art
 
 ########################################################################
 # Phony target for building what go/lem requires on host.