forked from openkylin/platform_build
Remove sharding support from make
Sharding is not used in make any more, the large java modules (libcore and framework) have moved to Soong. Keeping sharding support complicates java compiling, so remove it. Bug: 73885582 Test: m checkbuild Change-Id: I2932f9e96bfc8f2ebf82095b16d6c0b3c51613f0
This commit is contained in:
parent
b6013af085
commit
5ef6e79c21
|
@ -126,7 +126,6 @@ LOCAL_JAR_PACKAGES:=
|
|||
LOCAL_JAR_PROCESSOR:=
|
||||
LOCAL_JAR_PROCESSOR_ARGS:=
|
||||
LOCAL_JAVACFLAGS:=
|
||||
LOCAL_JAVAC_SHARD_SIZE:=
|
||||
LOCAL_JAVA_LANGUAGE_VERSION:=
|
||||
LOCAL_JAVA_LAYERS_FILE:=
|
||||
LOCAL_JAVA_LIBRARIES:=
|
||||
|
|
|
@ -2222,16 +2222,6 @@ $(call fetch-additional-java-source,$@.tmp)
|
|||
$(hide) tr ' ' '\n' < $@.tmp | $(NORMALIZE_PATH) | sort -u > $@
|
||||
endef
|
||||
|
||||
# $(1): sharding number.
|
||||
# $(2): Java source files paths.
|
||||
define save-sharded-java-source-list
|
||||
$(java_source_list_file).shard.$(1): $(2) $$(NORMALIZE_PATH)
|
||||
@echo "shard java source list: $$@"
|
||||
rm -f $$@
|
||||
$$(call dump-words-to-file,$(2),$$@.tmp)
|
||||
$(hide) tr ' ' '\n' < $$@.tmp | $$(NORMALIZE_PATH) | sort -u > $$@
|
||||
endef
|
||||
|
||||
# Common definition to invoke javac on the host and target.
|
||||
#
|
||||
# $(1): javac
|
||||
|
@ -2280,36 +2270,6 @@ $(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_
|
|||
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
|
||||
endef
|
||||
|
||||
# $(1): Javac output jar name.
|
||||
# $(2): Java source list file.
|
||||
# $(3): Java header libs.
|
||||
# $(4): Javac sharding number.
|
||||
# $(5): Javac sources deps (the arg may neeed $$ in case of containing '#')
|
||||
define create-classes-full-debug.jar
|
||||
$(1): PRIVATE_JAVACFLAGS := $$(LOCAL_JAVACFLAGS) $$(annotation_processor_flags)
|
||||
$(1): PRIVATE_JAR_EXCLUDE_FILES := $$(LOCAL_JAR_EXCLUDE_FILES)
|
||||
$(1): PRIVATE_JAR_PACKAGES := $$(LOCAL_JAR_PACKAGES)
|
||||
$(1): PRIVATE_JAR_EXCLUDE_PACKAGES := $$(LOCAL_JAR_EXCLUDE_PACKAGES)
|
||||
$(1): PRIVATE_DONT_DELETE_JAR_META_INF := $$(LOCAL_DONT_DELETE_JAR_META_INF)
|
||||
$(1): PRIVATE_JAVA_SOURCE_LIST := $(2)
|
||||
$(1): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(3)
|
||||
$(1): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes$(4)
|
||||
$(1): PRIVATE_ANNO_INTERMEDIATES_DIR := $(intermediates.COMMON)/anno$(4)
|
||||
$(1): \
|
||||
$(2) \
|
||||
$(3) \
|
||||
$(5) \
|
||||
$$(full_java_bootclasspath_libs) \
|
||||
$$(full_java_system_modules_deps) \
|
||||
$$(layers_file) \
|
||||
$$(annotation_processor_deps) \
|
||||
$$(NORMALIZE_PATH) \
|
||||
$$(JAR_ARGS) \
|
||||
| $$(SOONG_JAVAC_WRAPPER)
|
||||
@echo "Target Java: $$@ ($$(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||
$$(call compile-java,$$(TARGET_JAVAC),$$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
|
||||
endef
|
||||
|
||||
define transform-java-to-header.jar
|
||||
@echo "$($(PRIVATE_PREFIX)DISPLAY) Turbine: $(PRIVATE_MODULE)"
|
||||
@mkdir -p $(dir $@)
|
||||
|
|
91
core/java.mk
91
core/java.mk
|
@ -327,34 +327,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
|
||||
|
@ -435,48 +407,6 @@ java_sources_deps := \
|
|||
$(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)
|
||||
|
@ -510,6 +440,27 @@ $(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): \
|
||||
$(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) \
|
||||
| $(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)
|
||||
|
||||
|
|
|
@ -361,7 +361,6 @@ $(data_binding_stamp) : $(all_res_assets) $(full_android_manifest) \
|
|||
# Make sure the data-binding process happens before javac and generation of R.java.
|
||||
$(R_file_stamp): $(data_binding_stamp)
|
||||
$(java_source_list_file): $(data_binding_stamp)
|
||||
$(foreach x,$(sharded_java_source_list_files),$(eval $(x): $(data_binding_stamp)))
|
||||
$(full_classes_compiled_jar): $(data_binding_stamp)
|
||||
endif # LOCAL_DATA_BINDING
|
||||
|
||||
|
@ -467,7 +466,6 @@ $(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)
|
||||
$(foreach x,$(sharded_java_source_list_files),$(eval $(x): $(R_file_stamp)))
|
||||
|
||||
endif # need_compile_res
|
||||
|
||||
|
|
|
@ -187,7 +187,6 @@ endif # LOCAL_USE_AAPT2
|
|||
|
||||
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
||||
$(java_source_list_file): $(R_file_stamp)
|
||||
$(foreach x,$(sharded_java_source_list_files),$(eval $(x): $(R_file_stamp)))
|
||||
$(full_classes_compiled_jar): $(R_file_stamp)
|
||||
$(full_classes_turbine_jar): $(R_file_stamp)
|
||||
|
||||
|
|
Loading…
Reference in New Issue