Merge "Use symlinks in the build graph for jni libs" am: 7d44f2d01d
am: 13f8dc992e
Change-Id: I51e3fcab757299acb45a8cd3393cead8ee14f7f9
This commit is contained in:
@@ -2628,17 +2628,15 @@ $(foreach t,$(1),\
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
# Define a rule to create a symlink to a file.
|
# Define a rule to create a symlink to a file.
|
||||||
# $(1): full path to source
|
# $(1): any dependencies
|
||||||
# $(2): source (may be relative)
|
# $(2): source (may be relative)
|
||||||
# $(3): full path to destination
|
# $(3): full path to destination
|
||||||
define symlink-file
|
define symlink-file
|
||||||
$(eval $(_symlink-file))
|
$(eval $(_symlink-file))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Order-only dependency because make/ninja will follow the link when checking
|
|
||||||
# the timestamp, so the file must exist
|
|
||||||
define _symlink-file
|
define _symlink-file
|
||||||
$(3): | $(1)
|
$(3): $(1)
|
||||||
@echo "Symlink: $$@ -> $(2)"
|
@echo "Symlink: $$@ -> $(2)"
|
||||||
@mkdir -p $(dir $$@)
|
@mkdir -p $(dir $$@)
|
||||||
@rm -rf $$@
|
@rm -rf $$@
|
||||||
|
@@ -49,29 +49,21 @@ else ifneq ($(my_jni_shared_libraries),) # not my_embed_jni
|
|||||||
my_shared_library_path := $(call get_non_asan_path,\
|
my_shared_library_path := $(call get_non_asan_path,\
|
||||||
$($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
|
$($(my_2nd_arch_prefix)TARGET_OUT$(partition_tag)_SHARED_LIBRARIES))
|
||||||
my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
|
my_installed_library := $(addprefix $(my_shared_library_path)/, $(my_jni_filenames))
|
||||||
# Do not use order-only dependency, because we want to rebuild the image if an jni is updated.
|
|
||||||
$(LOCAL_INSTALLED_MODULE) : $(my_installed_library)
|
|
||||||
|
|
||||||
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
|
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_installed_library)
|
||||||
|
|
||||||
# Create symlink in the app specific lib path
|
# Create symlink in the app specific lib path
|
||||||
# Skip creating this symlink when running the second part of a target sanitization build.
|
# Skip creating this symlink when running the second part of a target sanitization build.
|
||||||
ifeq ($(filter address,$(SANITIZE_TARGET)),)
|
ifeq ($(filter address,$(SANITIZE_TARGET)),)
|
||||||
ifdef LOCAL_POST_INSTALL_CMD
|
|
||||||
# Add a shell command separator
|
|
||||||
LOCAL_POST_INSTALL_CMD += ;
|
|
||||||
endif
|
|
||||||
|
|
||||||
my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
|
my_symlink_target_dir := $(patsubst $(PRODUCT_OUT)%,%,\
|
||||||
$(my_shared_library_path))
|
$(my_shared_library_path))
|
||||||
LOCAL_POST_INSTALL_CMD += \
|
$(foreach lib,$(my_jni_filenames),\
|
||||||
mkdir -p $(my_app_lib_path) \
|
$(call symlink-file, \
|
||||||
$(foreach lib, $(my_jni_filenames), ;ln -sf $(my_symlink_target_dir)/$(lib) $(my_app_lib_path)/$(lib))
|
$(my_shared_library_path)/$(lib), \
|
||||||
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
$(my_symlink_target_dir)/$(lib), \
|
||||||
else
|
$(my_app_lib_path)/$(lib)) \
|
||||||
ifdef LOCAL_POST_INSTALL_CMD
|
$(eval $$(LOCAL_INSTALLED_MODULE) : $$(my_app_lib_path)/$$(lib)) \
|
||||||
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
$(eval ALL_MODULES.$$(LOCAL_MODULE).INSTALLED += $$(my_app_lib_path)/$$(lib)))
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Clear jni_shared_libraries to not embed it into the apk.
|
# Clear jni_shared_libraries to not embed it into the apk.
|
||||||
|
Reference in New Issue
Block a user