Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff999725 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge changes I6a4060a7,I7743fbda,I88eb24f8

* changes:
  Unnest independent dexpreopt conditionals
  Indent dex_preopt_odex_install.mk
  Revert "Build: Do not treat org.apache.http.legacy.boot as boot classpath"
parents 471656df c18757e3
Loading
Loading
Loading
Loading
+306 −304
Original line number Diff line number Diff line
@@ -9,52 +9,62 @@ LOCAL_UNCOMPRESS_DEX := false
ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
  ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
    LOCAL_UNCOMPRESS_DEX := true
else
  endif

  ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
    LOCAL_UNCOMPRESS_DEX := true
  endif  # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
endif  # LOCAL_PRIVILEGED_MODULE
  endif
endif  # DONT_UNCOMPRESS_PRIV_APPS_DEXS

# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
ifneq (true,$(WITH_DEXPREOPT))
  LOCAL_DEX_PREOPT :=
else # WITH_DEXPREOPT=true
  ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty
ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
      ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img.
        ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty
          # If we have product-specific config for this module?
          ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
            LOCAL_DEX_PREOPT := false
          else
  LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
          endif
        else # LOCAL_APK_LIBRARIES not empty
          LOCAL_DEX_PREOPT := nostripping
        endif # LOCAL_APK_LIBRARIES not empty
      else

  ifeq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Not installed to system.img.
    # Default to nostripping for non system preopt (enables preopt).
    # Don't strip in case the oat/vdex version in system ROM doesn't match the one in other
    # partitions. It needs to be able to fall back to the APK for that case.
        # Also only enable preopt for non tests.
        ifeq (,$(filter $(LOCAL_MODULE_TAGS),tests))
    LOCAL_DEX_PREOPT := nostripping
  endif
      endif # Installed to system.img.
    endif # LOCAL_DEX_PREOPT undefined
  endif # TARGET_BUILD_APPS empty
endif # WITH_DEXPREOPT=true

  ifneq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES not empty
    LOCAL_DEX_PREOPT := nostripping
  endif
endif

ifeq (false,$(LOCAL_DEX_PREOPT))
  LOCAL_DEX_PREOPT :=
endif

# Only enable preopt for non tests.
ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
  LOCAL_DEX_PREOPT :=
endif

# If we have product-specific config for this module?
ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
  LOCAL_DEX_PREOPT :=
endif

# Disable preopt for TARGET_BUILD_APPS
ifneq (,$(TARGET_BUILD_APPS))
  LOCAL_DEX_PREOPT :=
endif

# Disable preopt if not WITH_DEXPREOPT
ifneq (true,$(WITH_DEXPREOPT))
  LOCAL_DEX_PREOPT :=
endif

ifdef LOCAL_UNINSTALLABLE_MODULE
  LOCAL_DEX_PREOPT :=
endif

ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) # contains no java code
  LOCAL_DEX_PREOPT :=
endif

# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
# Also preopt system server jars since selinux prevents system server from loading anything from
# /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
@@ -69,7 +79,6 @@ endif
endif

ifeq ($(LOCAL_DEX_PREOPT),true)

  # Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
  ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
    LOCAL_DEX_PREOPT := nostripping
@@ -87,7 +96,6 @@ endif # BOARD_USES_SYSTEM_OTHER_ODEX
  # but that requires to inspect the source file, which is too early at this point (as we
  # don't know if the source file will actually be used).
  # See dexpreopt-remove-classes.dex.

endif  # LOCAL_DEX_PREOPT

built_odex :=
@@ -108,8 +116,6 @@ LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
endif

ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE


  # If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
  # profile class listing. TODO: Use product specific directory here.
  my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
@@ -150,6 +156,7 @@ $(my_built_profile): $(dex_preopt_profile_src_file)
  ifeq (true,$(my_profile_is_text_listing))
    # The profile is a test listing of classes (used for framework jars).
    # We need to generate the actual binary profile before being able to compile.
    $(my_built_profile):
	$(hide) mkdir -p $(dir $@)
	ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
		--create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
@@ -189,11 +196,6 @@ ifdef LOCAL_DEX_PREOPT

  dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))

# Filter org.apache.http.legacy.boot.
ifeq ($(dexpreopt_boot_jar_module),org.apache.http.legacy.boot)
dexpreopt_boot_jar_module :=
endif

  ifdef dexpreopt_boot_jar_module
    # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
    # We use this installed_odex trick to get boot.art installed.