Merge changes I97ea3ff3,Ib4351a5b,I74b61809,If2653f84,I2932f9e9, ... am: 34af6a41ff am: 3d8c0a2c9e

am: a9aa74ca38

Change-Id: Ieb4c17f4a3ac9d753f089936122335e39cda9e31
This commit is contained in:
Colin Cross
2018-03-14 23:54:27 +00:00
committed by android-build-merger
10 changed files with 100 additions and 157 deletions

View File

@@ -108,9 +108,8 @@ LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
###############################################################
## .rs files: RenderScript sources to .java files and .bc files
## .fs files: Filterscript sources to .java files and .bc files
###############################################################
renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_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 :=
@@ -171,7 +170,7 @@ ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
endif
bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
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)
@@ -331,34 +330,6 @@ java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES)))
java_intermediate_sources := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
all_java_sources := $(java_sources) $(java_intermediate_sources)
enable_sharding :=
ifneq ($(TURBINE_ENABLED),false)
ifneq ($(LOCAL_JAVAC_SHARD_SIZE),)
ifneq ($(LOCAL_JAR_PROCESSOR),)
$(call pretty-error,Cannot set both LOCAL_JAVAC_SHARD_SIZE and LOCAL_JAR_PROCESSOR!)
endif # LOCAL_JAR_PROCESSOR is not empty
enable_sharding := true
num_shards := $(call int_divide,$(words $(java_sources)),$(LOCAL_JAVAC_SHARD_SIZE))
ifneq ($(words $(java_sources)),$(call int_multiply,$(LOCAL_JAVAC_SHARD_SIZE),$(num_shards)))
# increment number of shards by 1.
num_shards := $(call int_plus,$(num_shards),1)
endif
shard_idx_list := $(call int_range_list,1,$(num_shards))
sharded_java_source_list_files += $(foreach x,$(shard_idx_list),$(java_source_list_file).shard.$(x))
sharded_jar_list += $(foreach x,$(shard_idx_list),$(full_classes_compiled_jar).shard.$(x))
# always put dynamically-located .java files (generated by Proto/resource, etc) in a new final shard.
# increment number of shards by 1.
num_shards := $(call int_plus,$(num_shards),1)
sharded_java_source_list_files += $(java_source_list_file).shard.$(num_shards)
sharded_jar_list += $(full_classes_compiled_jar).shard.$(num_shards)
LOCAL_INTERMEDIATE_TARGETS += $(sharded_java_source_list_files)
LOCAL_INTERMEDIATE_TARGETS += $(sharded_jar_list)
endif # LOCAL_JAVAC_SHARD_SIZE is not empty
endif # TURBINE_ENABLED != false
include $(BUILD_SYSTEM)/java_common.mk
include $(BUILD_SYSTEM)/sdk_check.mk
@@ -434,56 +405,16 @@ java_sources_deps := \
$(java_resource_sources) \
$(RenderScript_file_stamp) \
$(proto_java_sources_file_stamp) \
$(LOCAL_SRCJARS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(java_source_list_file): $(java_sources_deps)
$(write-java-source-list)
ifdef enable_sharding
$(foreach x,$(shard_idx_list),\
$(eval $(call save-sharded-java-source-list,$(x),\
$(wordlist $(call int_plus,1,$(call int_multiply,$(LOCAL_JAVAC_SHARD_SIZE),$(call int_subtract,$(x),1))),\
$(call int_multiply,$(LOCAL_JAVAC_SHARD_SIZE),$(x)),$(sort $(java_sources))))))
# always put dynamically-located .java files (generated by Proto/resource, etc) in a new final shard.
$(java_source_list_file).shard.$(num_shards): PRIVATE_JAVA_INTERMEDIATE_SOURCES := $(java_intermediate_sources)
$(java_source_list_file).shard.$(num_shards): $(java_resource_sources) \
$(RenderScript_file_stamp) \
$(proto_java_sources_file_stamp) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
$(NORMALIZE_PATH)
$(hide) rm -f $@
$(call dump-words-to-file,$(PRIVATE_JAVA_INTERMEDIATE_SOURCES),$@.tmp)
$(call fetch-additional-java-source,$@.tmp)
$(hide) tr ' ' '\n' < $@.tmp | $(NORMALIZE_PATH) | sort -u > $@
# Javac sharding with header libs including its own header jar as one of dependency.
$(foreach x,$(shard_idx_list),\
$(eval $(call create-classes-full-debug.jar,$(full_classes_compiled_jar).shard.$(x),\
$(java_source_list_file).shard.$(x),\
$(full_java_header_libs) $(full_classes_header_jar),$(x),\
$(wordlist $(call int_plus,1,$(call int_multiply,$(LOCAL_JAVAC_SHARD_SIZE),$(call int_subtract,$(x),1))),\
$(call int_multiply,$(LOCAL_JAVAC_SHARD_SIZE),$(x)),$(sort $(java_sources))))))
# Javac sharding for last shard with additional Java dependencies.
$(eval $(call create-classes-full-debug.jar,$(full_classes_compiled_jar).shard.$(num_shards),\
$(java_source_list_file).shard.$(num_shards),$(full_java_header_libs) $(full_classes_header_jar),$(strip \
$(num_shards)),$$(java_resource_sources) $$(RenderScript_file_stamp) \
$$(proto_java_sources_file_stamp) $$(LOCAL_ADDITIONAL_DEPENDENCIES)))
$(full_classes_compiled_jar): PRIVATE_SHARDED_JAR_LIST := $(sharded_jar_list)
$(full_classes_compiled_jar): $(sharded_jar_list) | $(MERGE_ZIPS)
$(MERGE_ZIPS) -j $@ $(PRIVATE_SHARDED_JAR_LIST)
else
# we can't use single $ for java_sources_deps since it may contain hash '#' sign.
$(eval $(call create-classes-full-debug.jar,$(full_classes_compiled_jar),\
$(java_source_list_file),$(full_java_header_libs),,$$(java_sources_deps)))
endif # ifdef enable_sharding
ifneq ($(TURBINE_ENABLED),false)
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_turbine_jar): \
$(java_source_list_file) \
@@ -514,6 +445,31 @@ $(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_
endif # TURBINE_ENABLED != false
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
$(full_classes_compiled_jar): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
$(full_classes_compiled_jar): \
$(java_source_list_file) \
$(full_java_header_libs) \
$(java_sources_deps) \
$(full_java_bootclasspath_libs) \
$(full_java_system_modules_deps) \
$(layers_file) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(EXTRACT_SRCJARS) \
| $(SOONG_JAVAC_WRAPPER)
@echo "Target Java: $@
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
javac-check : $(full_classes_compiled_jar)
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)