Merge changes I54b8ec9c,Ibef28507,Ia858de22,Ide3050ec,Ib6e00be4, ...
* changes: Add asan-specific CleanSpec Use a srcjar for aapt and aapt2 output Move R.txt and make aapt2 generate it Move aapt2.mk before java.mk Remove redundant renderscript_target_api computation Move java renderscript support to java_renderscript.mk Use srcjar and resource zip as output of renderscript rules
This commit is contained in:
commit
2a63439a31
9 changed files with 349 additions and 313 deletions
13
CleanSpec.mk
13
CleanSpec.mk
|
@ -463,6 +463,19 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/manifest.xml)
|
|||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/compatibility_matrix.xml)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/compatibility_matrix.xml)
|
||||
|
||||
# Remove obsolete intermedates src files
|
||||
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/src/RenderScript.stamp*)
|
||||
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/*_intermediates/src)
|
||||
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/src)
|
||||
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/*_intermediates/java-source-list)
|
||||
$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/java-source-list)
|
||||
$(call add-clean-step, rm -rf $(OUT_DOCS)/*-timestamp)
|
||||
|
||||
$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/APPS/*_intermediates/src)
|
||||
$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/JAVA_LIBRARIES/*_intermediates/src)
|
||||
$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/APPS/*_intermediates/java-source-list)
|
||||
$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/JAVA_LIBRARIES/*_intermediates/java-source-list)
|
||||
|
||||
# ************************************************
|
||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
|
||||
# ************************************************
|
||||
|
|
|
@ -78,12 +78,17 @@ ifneq ($(my_apk_split_configs),)
|
|||
$(my_res_package): PRIVATE_AAPT_FLAGS += $(addprefix --split ,$(join $(built_apk_splits),$(addprefix :,$(my_apk_split_configs))))
|
||||
endif
|
||||
|
||||
my_srcjar := $(intermediates.COMMON)/aapt2.srcjar
|
||||
LOCAL_SRCJARS += $(my_srcjar)
|
||||
|
||||
$(my_res_package): PRIVATE_RES_FLAT := $(my_res_resources_flat)
|
||||
$(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_resources_flata) $(my_overlay_resources_flat)
|
||||
$(my_res_package): PRIVATE_SHARED_ANDROID_LIBRARIES := $(my_shared_library_resources)
|
||||
$(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
|
||||
$(my_res_package): PRIVATE_ASSET_DIRS := $(my_asset_dirs)
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS :=
|
||||
$(my_res_package): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt2
|
||||
$(my_res_package): PRIVATE_SRCJAR := $(my_srcjar)
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
|
||||
|
||||
ifdef R_file_stamp
|
||||
$(my_res_package): PRIVATE_R_FILE_STAMP := $(R_file_stamp)
|
||||
|
@ -108,12 +113,12 @@ $(my_res_package): $(full_android_manifest) $(my_static_library_resources) $(my_
|
|||
$(my_res_package): $(my_full_asset_paths)
|
||||
$(my_res_package): $(my_res_resources_flat) $(my_overlay_resources_flat) \
|
||||
$(my_resources_flata) $(my_static_library_resources) \
|
||||
$(AAPT2)
|
||||
$(AAPT2) $(SOONG_ZIP)
|
||||
@echo "AAPT2 link $@"
|
||||
$(call aapt2-link)
|
||||
ifdef R_file_stamp
|
||||
@rm -f $(PRIVATE_R_FILE_STAMP)
|
||||
$(call find-generated-R.java,$(PRIVATE_R_FILE_STAMP))
|
||||
$(call find-generated-R.java,$(PRIVATE_JAVA_GEN_DIR),$(PRIVATE_R_FILE_STAMP))
|
||||
endif
|
||||
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
|
||||
@rm -f $(PRIVATE_RESOURCE_EXPORT_PACKAGE)
|
||||
|
|
|
@ -13,8 +13,3 @@ ifdef LOCAL_AAPT_FLAGS
|
|||
aapt_flags :=
|
||||
endif
|
||||
endif
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
|
||||
|
|
|
@ -1036,9 +1036,9 @@ $(hide) $(RS_CC_ASAN_OPTIONS) $(PRIVATE_RS_CC) \
|
|||
$(PRIVATE_RS_FLAGS) \
|
||||
$(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \
|
||||
$(PRIVATE_RS_SOURCE_FILES)
|
||||
$(SOONG_ZIP) -o $@ -C $(PRIVATE_RS_OUTPUT_DIR)/src -D $(PRIVATE_RS_OUTPUT_DIR)/src
|
||||
$(SOONG_ZIP) -o $(PRIVATE_RS_OUTPUT_RES_ZIP) -C $(PRIVATE_RS_OUTPUT_DIR)/res -D $(PRIVATE_RS_OUTPUT_DIR)/res
|
||||
$(call _merge-renderscript-d,$(PRIVATE_DEP_FILES),$@.d)
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) touch $@
|
||||
endef
|
||||
|
||||
define transform-bc-to-so
|
||||
|
@ -2021,11 +2021,12 @@ AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
|
|||
# This rule creates the R.java and Manifest.java files, both of which
|
||||
# are PRODUCT-neutral. Don't pass PRIVATE_PRODUCT_AAPT_CONFIG to this invocation.
|
||||
define create-resource-java-files
|
||||
@mkdir -p $(PRIVATE_SOURCE_INTERMEDIATES_DIR)
|
||||
@mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT))
|
||||
rm -rf $(PRIVATE_JAVA_GEN_DIR)
|
||||
mkdir -p $(PRIVATE_JAVA_GEN_DIR)
|
||||
$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
|
||||
$(eval # PRIVATE_PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \
|
||||
$(addprefix -J , $(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \
|
||||
$(addprefix -J , $(PRIVATE_JAVA_GEN_DIR)) \
|
||||
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
|
||||
$(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \
|
||||
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
|
||||
|
@ -2039,30 +2040,31 @@ $(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
|
|||
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
|
||||
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
|
||||
--skip-symbols-without-default-localization
|
||||
$(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR)
|
||||
# So that we re-run aapt when the list of input files change
|
||||
$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
|
||||
endef
|
||||
|
||||
# Search for generated R.java/Manifest.java, copy the found R.java as $1.
|
||||
# Search for generated R.java/Manifest.java in $1, copy the found R.java as $2.
|
||||
# Also copy them to a central 'R' directory to make it easier to add the files to an IDE.
|
||||
define find-generated-R.java
|
||||
$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
|
||||
$(hide) for GENERATED_MANIFEST_FILE in `find $(1) \
|
||||
-name Manifest.java 2> /dev/null`; do \
|
||||
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
|
||||
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
||||
$(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
||||
done;
|
||||
$(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
|
||||
$(hide) for GENERATED_R_FILE in `find $(1) \
|
||||
-name R.java 2> /dev/null`; do \
|
||||
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
|
||||
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
||||
$(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|
||||
|| exit 31; \
|
||||
$(ACP) -fp $$GENERATED_R_FILE $1 || exit 32; \
|
||||
$(ACP) -fp $$GENERATED_R_FILE $(2) || exit 32; \
|
||||
done;
|
||||
@# Ensure that the target file is always created, i.e. also in case we did not
|
||||
@# enter the GENERATED_R_FILE-loop above. This avoids unnecessary rebuilding.
|
||||
$(hide) touch $1
|
||||
$(hide) touch $(2)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
@ -2110,6 +2112,8 @@ endef
|
|||
|
||||
define aapt2-link
|
||||
@mkdir -p $(dir $@)
|
||||
rm -rf $(PRIVATE_JAVA_GEN_DIR)
|
||||
mkdir -p $(PRIVATE_JAVA_GEN_DIR)
|
||||
$(call dump-words-to-file,$(PRIVATE_RES_FLAT),$(dir $@)aapt2-flat-list)
|
||||
$(call dump-words-to-file,$(PRIVATE_OVERLAY_FLAT),$(dir $@)aapt2-flat-overlay-list)
|
||||
$(hide) $(AAPT2) link -o $@ \
|
||||
|
@ -2118,7 +2122,7 @@ $(hide) $(AAPT2) link -o $@ \
|
|||
$(addprefix -I ,$(PRIVATE_AAPT_INCLUDES)) \
|
||||
$(addprefix -I ,$(PRIVATE_SHARED_ANDROID_LIBRARIES)) \
|
||||
$(addprefix -A ,$(PRIVATE_ASSET_DIR)) \
|
||||
$(addprefix --java ,$(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \
|
||||
$(addprefix --java ,$(PRIVATE_JAVA_GEN_DIR)) \
|
||||
$(addprefix --proguard ,$(PRIVATE_PROGUARD_OPTIONS_FILE)) \
|
||||
$(addprefix --min-sdk-version ,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
|
||||
$(addprefix --target-sdk-version ,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
|
||||
|
@ -2131,6 +2135,7 @@ $(hide) $(AAPT2) link -o $@ \
|
|||
$(addprefix --rename-instrumentation-target-package ,$(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
|
||||
-R \@$(dir $@)aapt2-flat-overlay-list \
|
||||
\@$(dir $@)aapt2-flat-list
|
||||
$(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
@ -2212,8 +2217,6 @@ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
|
|||
fi
|
||||
$(if $(PRIVATE_HAS_PROTO_SOURCES), \
|
||||
$(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(1))
|
||||
$(if $(PRIVATE_HAS_RS_SOURCES), \
|
||||
$(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(1))
|
||||
endef
|
||||
|
||||
# Some historical notes:
|
||||
|
|
157
core/java.mk
157
core/java.mk
|
@ -106,159 +106,6 @@ LOCAL_INTERMEDIATE_TARGETS += \
|
|||
|
||||
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
|
||||
|
||||
###############################################################
|
||||
## .rs files: RenderScript sources to .java files and .bc files
|
||||
###############################################################
|
||||
renderscript_sources := $(filter %.rs,$(LOCAL_SRC_FILES))
|
||||
# Because names of the java files from RenderScript are unknown until the
|
||||
# .rs file(s) are compiled, we have to depend on a timestamp file.
|
||||
RenderScript_file_stamp :=
|
||||
rs_generated_res_dir :=
|
||||
rs_compatibility_jni_libs :=
|
||||
ifneq ($(renderscript_sources),)
|
||||
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
|
||||
RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
|
||||
renderscript_intermediate.COMMON := $(intermediates.COMMON)/renderscript
|
||||
|
||||
# Defaulting to an empty string uses the latest available platform SDK.
|
||||
renderscript_target_api :=
|
||||
|
||||
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
||||
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
||||
else
|
||||
ifneq (,$(LOCAL_SDK_VERSION))
|
||||
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
||||
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
||||
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
||||
endif
|
||||
endif # LOCAL_SDK_VERSION is set
|
||||
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
||||
|
||||
# For 64-bit, we always have to upgrade to at least 21 for compat build.
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
||||
ifeq ($(TARGET_IS_64_BIT),true)
|
||||
ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
|
||||
renderscript_target_api := 21
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
|
||||
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
|
||||
endif
|
||||
|
||||
# Turn on all warnings and warnings as errors for RS compiles.
|
||||
# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
|
||||
renderscript_flags := -Wall -Werror
|
||||
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
|
||||
|
||||
# prepend the RenderScript system include path
|
||||
ifneq ($(filter-out current system_current test_current core_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
|
||||
# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
|
||||
LOCAL_RENDERSCRIPT_INCLUDES := \
|
||||
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
|
||||
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
|
||||
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
||||
else
|
||||
LOCAL_RENDERSCRIPT_INCLUDES := \
|
||||
$(TOPDIR)external/clang/lib/Headers \
|
||||
$(TOPDIR)frameworks/rs/script_api/include \
|
||||
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
||||
endif
|
||||
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
|
||||
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
|
||||
endif
|
||||
|
||||
bc_files := $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources)))
|
||||
bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
|
||||
|
||||
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
|
||||
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
|
||||
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
|
||||
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
|
||||
# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
|
||||
# automatically found by the java compiling function transform-java-to-classes.jar.
|
||||
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
|
||||
$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
|
||||
$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
|
||||
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
|
||||
$(transform-renderscripts-to-java-and-bc)
|
||||
|
||||
# include the dependency files (.d/.P) generated by llvm-rs-cc.
|
||||
$(call include-depfile,$(RenderScript_file_stamp).P,$(RenderScript_file_stamp))
|
||||
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
||||
|
||||
|
||||
ifeq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
|
||||
ifeq ($(TARGET_IS_64_BIT),true)
|
||||
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc64/
|
||||
else
|
||||
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc32/
|
||||
endif
|
||||
else
|
||||
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/
|
||||
endif
|
||||
|
||||
rs_generated_bc := $(addprefix \
|
||||
$(renderscript_intermediate.bc_folder), $(bc_files))
|
||||
|
||||
renderscript_intermediate := $(intermediates)/renderscript
|
||||
|
||||
# We don't need the .so files in bundled branches
|
||||
# Prevent these from showing up on the device
|
||||
# One exception is librsjni.so, which is needed for
|
||||
# both native path and compat path.
|
||||
rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
|
||||
LOCAL_JNI_SHARED_LIBRARIES += librsjni
|
||||
|
||||
ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
|
||||
|
||||
rs_compatibility_jni_libs := $(addprefix \
|
||||
$(renderscript_intermediate)/librs., \
|
||||
$(patsubst %.bc,%.so, $(bc_files)))
|
||||
|
||||
$(rs_generated_bc) : $(RenderScript_file_stamp)
|
||||
|
||||
rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
|
||||
LOCAL_JNI_SHARED_LIBRARIES += libRSSupport
|
||||
|
||||
rs_support_io_lib :=
|
||||
# check if the target api level support USAGE_IO
|
||||
ifeq ($(filter $(RSCOMPAT_NO_USAGEIO_API_LEVELS),$(renderscript_target_api)),)
|
||||
rs_support_io_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupportIO.so
|
||||
LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO
|
||||
endif
|
||||
|
||||
my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
||||
ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
|
||||
my_min_sdk_version := 21
|
||||
else
|
||||
my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
|
||||
endif
|
||||
|
||||
$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
|
||||
$(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
|
||||
$(rs_compatibility_jni_libs): $(BCC_COMPAT)
|
||||
$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
|
||||
$(rs_compatibility_jni_libs): PRIVATE_SDK_VERSION := $(my_min_sdk_version)
|
||||
$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
|
||||
$(renderscript_intermediate.bc_folder)%.bc \
|
||||
$(SOONG_OUT_DIR)/ndk.timestamp
|
||||
$(transform-bc-to-so)
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
|
||||
# Make sure the generated resource will be added to the apk.
|
||||
rs_generated_res_dir := $(renderscript_intermediate.COMMON)/res
|
||||
LOCAL_RESOURCE_DIR := $(rs_generated_res_dir) $(LOCAL_RESOURCE_DIR)
|
||||
endif
|
||||
|
||||
|
||||
###########################################################
|
||||
## AIDL: Compile .aidl files to .java
|
||||
###########################################################
|
||||
|
@ -334,9 +181,6 @@ include $(BUILD_SYSTEM)/java_common.mk
|
|||
|
||||
include $(BUILD_SYSTEM)/sdk_check.mk
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES := $(if $(renderscript_sources),true)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RS_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/renderscript
|
||||
|
||||
# Set the profile source so that the odex / profile code included from java.mk
|
||||
# can find it.
|
||||
#
|
||||
|
@ -403,7 +247,6 @@ endif
|
|||
java_sources_deps := \
|
||||
$(java_sources) \
|
||||
$(java_resource_sources) \
|
||||
$(RenderScript_file_stamp) \
|
||||
$(proto_java_sources_file_stamp) \
|
||||
$(LOCAL_SRCJARS) \
|
||||
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
||||
|
|
|
@ -177,7 +177,7 @@ endif # java_resource_file_groups
|
|||
#####################################
|
||||
## Warn if there is unrecognized file in LOCAL_SRC_FILES.
|
||||
my_unknown_src_files := $(filter-out \
|
||||
%.java %.aidl %.proto %.logtags %.rs, \
|
||||
%.java %.aidl %.proto %.logtags, \
|
||||
$(LOCAL_SRC_FILES) $(LOCAL_INTERMEDIATE_SOURCES) $(LOCAL_GENERATED_SOURCES))
|
||||
ifneq ($(my_unknown_src_files),)
|
||||
$(warning $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Unused source files: $(my_unknown_src_files))
|
||||
|
|
155
core/java_renderscript.mk
Normal file
155
core/java_renderscript.mk
Normal file
|
@ -0,0 +1,155 @@
|
|||
###############################################################
|
||||
## Renderscript support for java
|
||||
## Adds rules to convert .rs files to .java and .bc files
|
||||
###############################################################
|
||||
|
||||
renderscript_sources := $(filter %.rs,$(LOCAL_SRC_FILES))
|
||||
LOCAL_SRC_FILES := $(filter-out %.rs,$(LOCAL_SRC_FILES))
|
||||
|
||||
rs_generated_res_zip :=
|
||||
rs_generated_src_jar :=
|
||||
rs_compatibility_jni_libs :=
|
||||
ifneq ($(renderscript_sources),)
|
||||
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
|
||||
renderscript_intermediate.COMMON := $(intermediates.COMMON)/renderscript
|
||||
rs_generated_res_zip := $(renderscript_intermediate.COMMON)/res.zip
|
||||
rs_generated_src_jar := $(renderscript_intermediate.COMMON)/rs.srcjar
|
||||
|
||||
LOCAL_SRCJARS += $(rs_generated_src_jar)
|
||||
|
||||
# Defaulting to an empty string uses the latest available platform SDK.
|
||||
renderscript_target_api :=
|
||||
|
||||
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
||||
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
||||
else
|
||||
ifneq (,$(LOCAL_SDK_VERSION))
|
||||
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
||||
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
||||
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
||||
endif
|
||||
endif # LOCAL_SDK_VERSION is set
|
||||
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
||||
|
||||
# For 64-bit, we always have to upgrade to at least 21 for compat build.
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
||||
ifeq ($(TARGET_IS_64_BIT),true)
|
||||
ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
|
||||
renderscript_target_api := 21
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
|
||||
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
|
||||
endif
|
||||
|
||||
# Turn on all warnings and warnings as errors for RS compiles.
|
||||
# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
|
||||
renderscript_flags := -Wall -Werror
|
||||
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
|
||||
|
||||
# prepend the RenderScript system include path
|
||||
ifneq ($(filter-out current system_current test_current core_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
|
||||
# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
|
||||
LOCAL_RENDERSCRIPT_INCLUDES := \
|
||||
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
|
||||
$(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
|
||||
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
||||
else
|
||||
LOCAL_RENDERSCRIPT_INCLUDES := \
|
||||
$(TOPDIR)external/clang/lib/Headers \
|
||||
$(TOPDIR)frameworks/rs/script_api/include \
|
||||
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
||||
endif
|
||||
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
|
||||
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
|
||||
endif
|
||||
|
||||
bc_files := $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources)))
|
||||
bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
|
||||
|
||||
$(rs_generated_src_jar): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
|
||||
$(rs_generated_src_jar): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
|
||||
$(rs_generated_src_jar): PRIVATE_RS_FLAGS := $(renderscript_flags)
|
||||
$(rs_generated_src_jar): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
|
||||
$(rs_generated_src_jar): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
|
||||
$(rs_generated_src_jar): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
|
||||
$(rs_generated_src_jar): PRIVATE_DEP_FILES := $(bc_dep_files)
|
||||
$(rs_generated_src_jar): PRIVATE_RS_OUTPUT_RES_ZIP := $(rs_generated_res_zip)
|
||||
$(rs_generated_src_jar): .KATI_IMPLICIT_OUTPUTS := $(rs_generated_res_zip)
|
||||
$(rs_generated_src_jar): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) $(SOONG_ZIP)
|
||||
$(transform-renderscripts-to-java-and-bc)
|
||||
|
||||
# include the dependency files (.d/.P) generated by llvm-rs-cc.
|
||||
$(call include-depfile,$(rs_generated_src_jar).P,$(rs_generated_src_jar))
|
||||
|
||||
ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
|
||||
|
||||
|
||||
ifeq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
|
||||
ifeq ($(TARGET_IS_64_BIT),true)
|
||||
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc64/
|
||||
else
|
||||
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc32/
|
||||
endif
|
||||
else
|
||||
renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/
|
||||
endif
|
||||
|
||||
rs_generated_bc := $(addprefix \
|
||||
$(renderscript_intermediate.bc_folder), $(bc_files))
|
||||
|
||||
renderscript_intermediate := $(intermediates)/renderscript
|
||||
|
||||
# We don't need the .so files in bundled branches
|
||||
# Prevent these from showing up on the device
|
||||
# One exception is librsjni.so, which is needed for
|
||||
# both native path and compat path.
|
||||
rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
|
||||
LOCAL_JNI_SHARED_LIBRARIES += librsjni
|
||||
|
||||
ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
|
||||
|
||||
rs_compatibility_jni_libs := $(addprefix \
|
||||
$(renderscript_intermediate)/librs., \
|
||||
$(patsubst %.bc,%.so, $(bc_files)))
|
||||
|
||||
$(rs_generated_src_jar): .KATI_IMPLICIT_OUTPUTS += $(rs_generated_bc)
|
||||
|
||||
rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
|
||||
LOCAL_JNI_SHARED_LIBRARIES += libRSSupport
|
||||
|
||||
rs_support_io_lib :=
|
||||
# check if the target api level support USAGE_IO
|
||||
ifeq ($(filter $(RSCOMPAT_NO_USAGEIO_API_LEVELS),$(renderscript_target_api)),)
|
||||
rs_support_io_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupportIO.so
|
||||
LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO
|
||||
endif
|
||||
|
||||
my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
||||
ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
|
||||
my_min_sdk_version := 21
|
||||
else
|
||||
my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
|
||||
endif
|
||||
|
||||
$(rs_compatibility_jni_libs): $(RS_PREBUILT_CLCORE) \
|
||||
$(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
|
||||
$(rs_compatibility_jni_libs): $(BCC_COMPAT)
|
||||
$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
|
||||
$(rs_compatibility_jni_libs): PRIVATE_SDK_VERSION := $(my_min_sdk_version)
|
||||
$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
|
||||
$(renderscript_intermediate.bc_folder)%.bc \
|
||||
$(SOONG_OUT_DIR)/ndk.timestamp
|
||||
$(transform-bc-to-so)
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += $(rs_generated_src_jar)
|
||||
# Make sure the generated resource will be added to the apk.
|
||||
LOCAL_RESOURCE_DIR := $(renderscript_intermediate.COMMON)/res $(LOCAL_RESOURCE_DIR)
|
||||
endif
|
|
@ -322,12 +322,123 @@ endif
|
|||
|
||||
include $(BUILD_SYSTEM)/android_manifest.mk
|
||||
|
||||
resource_export_package :=
|
||||
|
||||
include $(BUILD_SYSTEM)/java_renderscript.mk
|
||||
|
||||
include $(BUILD_SYSTEM)/aapt_flags.mk
|
||||
|
||||
ifeq ($(need_compile_res),true)
|
||||
|
||||
###############################
|
||||
## APK splits
|
||||
built_apk_splits :=
|
||||
installed_apk_splits :=
|
||||
my_apk_split_configs :=
|
||||
|
||||
ifdef LOCAL_PACKAGE_SPLITS
|
||||
ifdef LOCAL_COMPRESSED_MODULE
|
||||
$(error $(LOCAL_MODULE): LOCAL_COMPRESSED_MODULE is not currently supported for split installs)
|
||||
endif # LOCAL_COMPRESSED_MODULE
|
||||
|
||||
my_apk_split_configs := $(LOCAL_PACKAGE_SPLITS)
|
||||
my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs))
|
||||
built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk)
|
||||
endif
|
||||
|
||||
$(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
|
||||
$(R_file_stamp) $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
|
||||
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
|
||||
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
|
||||
|
||||
###############################
|
||||
## AAPT/AAPT2
|
||||
|
||||
ifdef LOCAL_USE_AAPT2
|
||||
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
|
||||
ifneq (,$(renderscript_target_api))
|
||||
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
|
||||
my_generated_res_zips := $(rs_generated_res_zip)
|
||||
endif # renderscript_target_api < 21
|
||||
endif # renderscript_target_api is set
|
||||
my_asset_dirs := $(LOCAL_ASSET_DIR)
|
||||
my_full_asset_paths := $(all_assets)
|
||||
|
||||
# Add AAPT2 link specific flags.
|
||||
$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
|
||||
ifndef LOCAL_AAPT_NAMESPACES
|
||||
$(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
|
||||
endif
|
||||
|
||||
include $(BUILD_SYSTEM)/aapt2.mk
|
||||
else # LOCAL_USE_AAPT2
|
||||
|
||||
my_srcjar := $(intermediates.COMMON)/aapt.srcjar
|
||||
LOCAL_SRCJARS += $(my_srcjar)
|
||||
$(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
|
||||
$(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
|
||||
$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
|
||||
# Since we don't know where the real R.java file is going to end up,
|
||||
# we need to use another file to stand in its place. We'll just
|
||||
# copy the generated file to src/R.stamp, which means it will
|
||||
# have the same contents and timestamp as the actual file.
|
||||
#
|
||||
# At the same time, this will copy the R.java file to a central
|
||||
# 'R' directory to make it easier to add the files to an IDE.
|
||||
#
|
||||
|
||||
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
|
||||
$(intermediates.COMMON)/public_resources.xml
|
||||
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
|
||||
$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_res_assets)
|
||||
$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT) $(SOONG_ZIP) | $(ACP)
|
||||
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
||||
@rm -rf $@ && mkdir -p $(dir $@)
|
||||
$(create-resource-java-files)
|
||||
$(call find-generated-R.java,$(PRIVATE_JAVA_GEN_DIR),$@)
|
||||
|
||||
$(proguard_options_file): $(R_file_stamp)
|
||||
|
||||
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.)
|
||||
# files.
|
||||
resource_export_package := $(intermediates.COMMON)/package-export.apk
|
||||
$(R_file_stamp): $(resource_export_package)
|
||||
|
||||
# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
|
||||
# can't know anything about PRODUCT. Clear it out just for this target.
|
||||
$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
|
||||
$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
|
||||
$(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
|
||||
$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
|
||||
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
|
||||
$(create-empty-package)
|
||||
$(add-assets-to-package)
|
||||
endif
|
||||
|
||||
endif # LOCAL_USE_AAPT2
|
||||
|
||||
endif # need_compile_res
|
||||
|
||||
called_from_package_internal := true
|
||||
#################################
|
||||
include $(BUILD_SYSTEM)/java.mk
|
||||
#################################
|
||||
called_from_package_internal :=
|
||||
|
||||
ifeq ($(need_compile_res),true)
|
||||
|
||||
# Other modules should depend on the BUILT module if
|
||||
# they want to use this module's R.java file.
|
||||
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
||||
|
||||
# The R.java file must exist by the time the java source
|
||||
# list is generated
|
||||
$(java_source_list_file): $(R_file_stamp)
|
||||
|
||||
endif # need_compile_res
|
||||
|
||||
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
||||
ifeq ($(LOCAL_SDK_RES_VERSION),)
|
||||
LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
|
||||
|
@ -364,111 +475,6 @@ $(java_source_list_file): $(data_binding_stamp)
|
|||
$(full_classes_compiled_jar): $(data_binding_stamp)
|
||||
endif # LOCAL_DATA_BINDING
|
||||
|
||||
resource_export_package :=
|
||||
|
||||
include $(BUILD_SYSTEM)/aapt_flags.mk
|
||||
|
||||
ifeq ($(need_compile_res),true)
|
||||
|
||||
###############################
|
||||
## APK splits
|
||||
built_apk_splits :=
|
||||
installed_apk_splits :=
|
||||
my_apk_split_configs :=
|
||||
|
||||
ifdef LOCAL_PACKAGE_SPLITS
|
||||
ifdef LOCAL_COMPRESSED_MODULE
|
||||
$(error $(LOCAL_MODULE): LOCAL_COMPRESSED_MODULE is not currently supported for split installs)
|
||||
endif # LOCAL_COMPRESSED_MODULE
|
||||
|
||||
my_apk_split_configs := $(LOCAL_PACKAGE_SPLITS)
|
||||
my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs))
|
||||
built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk)
|
||||
installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_USE_AAPT2
|
||||
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
|
||||
renderscript_target_api :=
|
||||
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
||||
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
||||
else
|
||||
ifneq (,$(LOCAL_SDK_VERSION))
|
||||
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
||||
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
||||
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
||||
endif
|
||||
endif # LOCAL_SDK_VERSION is set
|
||||
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
||||
ifneq (,$(renderscript_target_api))
|
||||
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
|
||||
my_generated_res_dirs := $(rs_generated_res_dir)
|
||||
my_generated_res_dirs_deps := $(RenderScript_file_stamp)
|
||||
endif # renderscript_target_api < 21
|
||||
endif # renderscript_target_api is set
|
||||
my_asset_dirs := $(LOCAL_ASSET_DIR)
|
||||
my_full_asset_paths := $(all_assets)
|
||||
|
||||
# Add AAPT2 link specific flags.
|
||||
$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
|
||||
ifndef LOCAL_AAPT_NAMESPACES
|
||||
$(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
|
||||
endif
|
||||
|
||||
include $(BUILD_SYSTEM)/aapt2.mk
|
||||
else # LOCAL_USE_AAPT2
|
||||
|
||||
# Since we don't know where the real R.java file is going to end up,
|
||||
# we need to use another file to stand in its place. We'll just
|
||||
# copy the generated file to src/R.stamp, which means it will
|
||||
# have the same contents and timestamp as the actual file.
|
||||
#
|
||||
# At the same time, this will copy the R.java file to a central
|
||||
# 'R' directory to make it easier to add the files to an IDE.
|
||||
#
|
||||
|
||||
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
|
||||
$(intermediates.COMMON)/public_resources.xml
|
||||
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
|
||||
$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_res_assets)
|
||||
$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
|
||||
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
||||
@rm -rf $@ && mkdir -p $(dir $@)
|
||||
$(create-resource-java-files)
|
||||
$(call find-generated-R.java,$@)
|
||||
|
||||
$(proguard_options_file): $(R_file_stamp)
|
||||
|
||||
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.)
|
||||
# files.
|
||||
resource_export_package := $(intermediates.COMMON)/package-export.apk
|
||||
$(R_file_stamp): $(resource_export_package)
|
||||
|
||||
# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
|
||||
# can't know anything about PRODUCT. Clear it out just for this target.
|
||||
$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
|
||||
$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
|
||||
$(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
|
||||
$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
|
||||
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
|
||||
$(create-empty-package)
|
||||
$(add-assets-to-package)
|
||||
endif
|
||||
|
||||
endif # LOCAL_USE_AAPT2
|
||||
|
||||
# Other modules should depend on the BUILT module if
|
||||
# they want to use this module's R.java file.
|
||||
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
||||
|
||||
# The R.java file must exist by the time the java source
|
||||
# list is generated
|
||||
$(java_source_list_file): $(R_file_stamp)
|
||||
|
||||
endif # need_compile_res
|
||||
|
||||
framework_res_package_export :=
|
||||
|
||||
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
||||
|
@ -504,6 +510,14 @@ ifdef LOCAL_USE_AAPT2
|
|||
$(my_res_package) : $(all_library_res_package_export_deps)
|
||||
endif
|
||||
|
||||
# These four are set above for $(R_stamp_file) and $(my_res_package), but
|
||||
# $(LOCAL_BUILT_MODULE) is not set before java.mk, so they have to be set again
|
||||
# here.
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
|
||||
|
||||
ifneq ($(full_classes_jar),)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
||||
# Use the jarjar processed arhive as the initial package file.
|
||||
|
@ -670,6 +684,7 @@ $(built_apk_splits) : $(intermediates)/%.apk : $(LOCAL_BUILT_MODULE)
|
|||
$(sign-package)
|
||||
|
||||
# Rules to install the splits
|
||||
installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
|
||||
$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(intermediates)/package_%.apk
|
||||
@echo "Install: $@"
|
||||
$(copy-file-to-new-target)
|
||||
|
|
|
@ -92,7 +92,7 @@ endif # need_compile_res
|
|||
|
||||
all_res_assets := $(all_resources)
|
||||
|
||||
include $(BUILD_SYSTEM)/java_library.mk
|
||||
include $(BUILD_SYSTEM)/java_renderscript.mk
|
||||
|
||||
ifeq (true,$(need_compile_res))
|
||||
include $(BUILD_SYSTEM)/android_manifest.mk
|
||||
|
@ -130,10 +130,15 @@ endif
|
|||
|
||||
include $(BUILD_SYSTEM)/aapt_flags.mk
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
|
||||
|
||||
# add --non-constant-id to prevent inlining constants.
|
||||
# AAR needs text symbol file R.txt.
|
||||
ifdef LOCAL_USE_AAPT2
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --static-lib
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --static-lib --output-text-symbols $(intermediates.COMMON)/R.txt
|
||||
ifndef LOCAL_AAPT_NAMESPACES
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
|
||||
endif
|
||||
|
@ -141,10 +146,15 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_CONFIG :=
|
|||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS :=
|
||||
else
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id --output-text-symbols $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id --output-text-symbols $(intermediates.COMMON)
|
||||
|
||||
my_srcjar := $(intermediates.COMMON)/aapt.srcjar
|
||||
LOCAL_SRCJARS += $(my_srcjar)
|
||||
$(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
|
||||
$(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
|
||||
$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(intermediates.COMMON)/R.txt) $(my_srcjar)
|
||||
endif
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
|
||||
|
@ -156,35 +166,32 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME :=
|
|||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR :=
|
||||
|
||||
ifdef LOCAL_USE_AAPT2
|
||||
# One more level with name res so we can zip up the flat resources that can be linked by apps.
|
||||
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
|
||||
renderscript_target_api :=
|
||||
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
||||
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
||||
# One more level with name res so we can zip up the flat resources that can be linked by apps.
|
||||
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
|
||||
ifneq (,$(renderscript_target_api))
|
||||
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
|
||||
my_generated_res_zips := $(rs_generated_res_zip)
|
||||
endif # renderscript_target_api < 21
|
||||
endif # renderscript_target_api is set
|
||||
include $(BUILD_SYSTEM)/aapt2.mk
|
||||
$(my_res_package) : $(framework_res_package_export)
|
||||
$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
|
||||
else
|
||||
ifneq (,$(LOCAL_SDK_VERSION))
|
||||
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
||||
ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
||||
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
||||
endif
|
||||
endif # LOCAL_SDK_VERSION is set
|
||||
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
||||
ifneq (,$(renderscript_target_api))
|
||||
ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
|
||||
my_generated_res_dirs := $(rs_generated_res_dir)
|
||||
my_generated_res_dirs_deps := $(RenderScript_file_stamp)
|
||||
endif # renderscript_target_api < 21
|
||||
endif # renderscript_target_api is set
|
||||
include $(BUILD_SYSTEM)/aapt2.mk
|
||||
$(my_res_package) : $(framework_res_package_export)
|
||||
else
|
||||
$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_resources)
|
||||
$(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(framework_res_package_export)
|
||||
$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
|
||||
$(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_resources)
|
||||
$(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(SOONG_ZIP) \
|
||||
$(framework_res_package_export) $(rs_generated_res_zip)
|
||||
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
||||
$(create-resource-java-files)
|
||||
$(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@
|
||||
$(hide) find $(PRIVATE_JAVA_GEN_DIR) -name R.java | xargs cat > $@
|
||||
endif # LOCAL_USE_AAPT2
|
||||
|
||||
endif # need_compile_res
|
||||
|
||||
include $(BUILD_SYSTEM)/java_library.mk
|
||||
|
||||
ifeq (true,$(need_compile_res))
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
||||
$(java_source_list_file): $(R_file_stamp)
|
||||
$(full_classes_compiled_jar): $(R_file_stamp)
|
||||
|
@ -204,9 +211,9 @@ $(built_aar): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|||
$(built_aar): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
|
||||
$(built_aar): PRIVATE_CLASSES_JAR := $(aar_classes_jar)
|
||||
$(built_aar): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
|
||||
$(built_aar): PRIVATE_R_TXT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.txt
|
||||
$(built_aar): PRIVATE_R_TXT := $(intermediates.COMMON)/R.txt
|
||||
$(built_aar): $(JAR_ARGS)
|
||||
$(built_aar) : $(aar_classes_jar) $(full_android_manifest)
|
||||
$(built_aar) : $(aar_classes_jar) $(full_android_manifest) $(intermediates.COMMON)/R.txt
|
||||
@echo "target AAR: $(PRIVATE_MODULE) ($@)"
|
||||
$(hide) rm -rf $(dir $@)aar && mkdir -p $(dir $@)aar/res
|
||||
$(hide) cp $(PRIVATE_ANDROID_MANIFEST) $(dir $@)aar/AndroidManifest.xml
|
||||
|
|
Loading…
Reference in a new issue