forked from openkylin/platform_build
Add Turbine as part of java build toolchain in Make.
1. Bundle static_java_header_libs during turbine-classes.jar if necessary. This can be improved if we have the ability to merge jars on the fly. 2. Copy sdk/stubs-classes.jar to sdk/stubs-classes-header.jar, and Use .KATI_RESTAT to cut un-necessary targets rebuilt. 3. Copy prebuilt-classes.jar to prebuilt-classes-header.jar since Turbine doesn't apply to prebuilt. 4. Run jarjar after Turbine compilation, otherwise downstream targets won't find corresponding symbols. 5. Change classes.jar in -classpath used in Desugar to classes-header.jar. 6. Change legacy-libs in Proguard from classes.jar to classes-header.jar. 7. Add .KATI_RESTAT for turbine-classes.jar, and remove IJAR. 8.boot.art is re-generated during the incremental rebuild since javalib.jar got re-generated. Then boot.art re-triggered lots of downstream targets to be rebuilt. So we add .KATI_RESTAT for javalib.jar to prevent downstream to be rebuilt. The ziptime & commit-change-to-toc operation for javalib.jar(small) didn't bring too much overhead when we build from clean state. Next step: specify static_java_header_libs in -classpath, and merge jars at the end. touch frameworks/base/core/java/com/google/android/util/Procedure.java && time m time: 1m58s (794 -> 49 targets) m clean && time m java time: 9m34s Bug: b/64308460 Test: m clean && m checkbuild Change-Id: Iefcc234405b9f461b6882c06bba15e21fa783d28
This commit is contained in:
parent
f61712fbf1
commit
0739155c86
|
@ -650,6 +650,7 @@ JACK_DEFAULT_ARGS := $(BUILD_SYSTEM)/jack-default.args
|
|||
DEFAULT_JACK_EXTRA_ARGS := @$(JACK_DEFAULT_ARGS)
|
||||
endif
|
||||
|
||||
TURBINE := $(HOST_OUT_JAVA_LIBRARIES)/turbine$(COMMON_JAVA_PACKAGE_SUFFIX)
|
||||
PROGUARD := external/proguard/bin/proguard.sh
|
||||
JAVATAGS := build/tools/java-event-log-tags.py
|
||||
MERGETAGS := build/tools/merge-event-log-tags.py
|
||||
|
|
|
@ -692,6 +692,14 @@ define java-lib-files
|
|||
$(foreach lib,$(1),$(call _java-lib-full-classes.jar,$(lib),$(2)))
|
||||
endef
|
||||
|
||||
# Get the header jar files (you can pass to "javac -classpath") of static or shared
|
||||
# Java libraries that you want to link against.
|
||||
# $(1): library name list
|
||||
# $(2): Non-empty if IS_HOST_MODULE
|
||||
define java-lib-header-files
|
||||
$(foreach lib,$(1),$(call intermediates-dir-for, JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes-header.jar)
|
||||
endef
|
||||
|
||||
# Get the dependency files (you can put on the right side of "|" of a build rule)
|
||||
# of the Java libraries.
|
||||
# $(1): library name list
|
||||
|
@ -2229,6 +2237,7 @@ endef
|
|||
#
|
||||
# $(1): javac
|
||||
# $(2): bootclasspath
|
||||
# $(3): classpath_libs
|
||||
define compile-java
|
||||
$(hide) rm -f $@
|
||||
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR)
|
||||
|
@ -2240,7 +2249,7 @@ $(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
|
|||
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||
$(2) \
|
||||
$(addprefix -classpath ,$(strip \
|
||||
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
|
||||
$(call normalize-path-list,$(3)))) \
|
||||
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
|
||||
-d $(PRIVATE_CLASS_INTERMEDIATES_DIR) -s $(PRIVATE_ANNO_INTERMEDIATES_DIR) \
|
||||
$(PRIVATE_JAVACFLAGS) \
|
||||
|
@ -2272,7 +2281,31 @@ endef
|
|||
|
||||
define transform-java-to-classes.jar
|
||||
@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
|
||||
endef
|
||||
|
||||
define transform-java-to-header.jar
|
||||
@echo "$($(PRIVATE_PREFIX)DISPLAY) Turbine: $(PRIVATE_MODULE)"
|
||||
@mkdir -p $(dir $@)
|
||||
@rm -rf $(dir $@)/classes-turbine
|
||||
@mkdir $(dir $@)/classes-turbine
|
||||
$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
|
||||
$(JAVA) -jar $(TURBINE) \
|
||||
--output $@.tmp --temp_dir $(dir $@)/classes-turbine -$(PRIVATE_BOOTCLASSPATH) \
|
||||
--sources \@$(PRIVATE_JAVA_SOURCE_LIST) \
|
||||
--javacopts $(PRIVATE_JAVACFLAGS) $(COMMON_JDK_FLAGS) \
|
||||
$(addprefix --classpath ,$(strip \
|
||||
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)))) \
|
||||
|| ( rm -rf $(dir $@)/classes-turbine ; exit 41 ) \
|
||||
fi
|
||||
$(hide) $(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_HEADER_LIBRARIES),$(dir $@)/classes-turbine)
|
||||
$(hide) if [ -s $@.tmp ] ; then \
|
||||
unzip -qo $@.tmp -d $(dir $@)/classes-turbine; rm -f $(dir $@)/classes-turbine/module-info.class; \
|
||||
fi
|
||||
$(hide) $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(dir $@)/classes-turbine/META-INF)
|
||||
$(hide) $(JAR) -cf $@.tmp $(call jar-args-sorted-files-in-directory,$(dir $@)/classes-turbine)
|
||||
$(hide) $(ZIPTIME) $@.tmp
|
||||
$(hide) $(call commit-change-for-toc,$@)
|
||||
endef
|
||||
|
||||
# Invoke Jack to compile java from source to dex and jack files.
|
||||
|
@ -2387,26 +2420,6 @@ else \
|
|||
fi
|
||||
endef
|
||||
|
||||
# b/37756495
|
||||
IJAR_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
|
||||
|
||||
## Rule to create a table of contents from a .jar file.
|
||||
## Must be called with $(eval).
|
||||
# $(1): A .jar file
|
||||
define _transform-jar-to-toc
|
||||
$1.toc: $1 | $(IJAR)
|
||||
@echo Generating TOC: $$@
|
||||
$(hide) $(IJAR_ASAN_OPTIONS) $(IJAR) $$< $$@.tmp
|
||||
$$(call commit-change-for-toc,$$@)
|
||||
endef
|
||||
|
||||
## Define a rule which generates .jar.toc and mark it as .KATI_RESTAT.
|
||||
# $(1): A .jar file
|
||||
define define-jar-to-toc-rule
|
||||
$(eval $(call _transform-jar-to-toc,$1))\
|
||||
$(eval .KATI_RESTAT: $1.toc)
|
||||
endef
|
||||
|
||||
ifeq (,$(TARGET_BUILD_APPS))
|
||||
|
||||
## Rule to create a table of contents from a .dex file.
|
||||
|
@ -2508,7 +2521,7 @@ $(hide) $(JAVA) \
|
|||
-Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
|
||||
-jar $(DESUGAR) \
|
||||
$(addprefix --bootclasspath_entry ,$(call desugar-bootclasspath,$(PRIVATE_BOOTCLASSPATH))) \
|
||||
$(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_LIBRARIES)) \
|
||||
$(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)) \
|
||||
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
|
||||
--desugar_try_with_resources_if_needed=false \
|
||||
--allow_empty_bootclasspath \
|
||||
|
@ -2718,8 +2731,15 @@ endef
|
|||
# Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR
|
||||
# in transform-java-to-classes for the sake of vm-tests.
|
||||
define transform-host-java-to-package
|
||||
@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
|
||||
@echo "Host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH),$(PRIVATE_ALL_JAVA_LIBRARIES))
|
||||
endef
|
||||
|
||||
# Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR
|
||||
# in transform-java-to-classes for the sake of vm-tests.
|
||||
define transform-host-java-to-dalvik-package
|
||||
@echo "Dalvik Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
|
||||
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
|
|
@ -42,6 +42,9 @@ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|||
LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex $(LOCAL_JAVA_LIBRARIES)
|
||||
endif
|
||||
|
||||
full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
|
||||
full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
|
||||
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
||||
full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar
|
||||
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
||||
|
@ -52,6 +55,7 @@ built_dex := $(intermediates.COMMON)/classes.dex
|
|||
java_source_list_file := $(intermediates.COMMON)/java-source-list
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += \
|
||||
$(full_classes_turbine_jar) \
|
||||
$(full_classes_compiled_jar) \
|
||||
$(full_classes_desugar_jar) \
|
||||
$(full_classes_jarjar_jar) \
|
||||
|
@ -98,25 +102,54 @@ $(java_source_list_file): $(java_sources_deps)
|
|||
ifndef LOCAL_JACK_ENABLED
|
||||
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
|
||||
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
|
||||
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
|
||||
$(full_classes_compiled_jar): \
|
||||
$(java_source_list_file) \
|
||||
$(java_sources_deps) \
|
||||
$(full_java_lib_deps) \
|
||||
$(full_java_header_libs) \
|
||||
$(full_static_java_libs) \
|
||||
$(jar_manifest_file) \
|
||||
$(annotation_processor_deps) \
|
||||
$(NORMALIZE_PATH) \
|
||||
$(JAR_ARGS) \
|
||||
| $(SOONG_JAVAC_WRAPPER)
|
||||
$(transform-host-java-to-package)
|
||||
$(transform-host-java-to-dalvik-package)
|
||||
|
||||
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
||||
$(full_classes_turbine_jar): \
|
||||
$(java_source_list_file) \
|
||||
$(java_sources_deps) \
|
||||
$(full_java_header_libs) \
|
||||
$(jar_manifest_file) \
|
||||
$(NORMALIZE_PATH) \
|
||||
$(JAR_ARGS) \
|
||||
$(ZIPTIME) \
|
||||
| $(TURBINE)
|
||||
$(transform-java-to-header.jar)
|
||||
|
||||
.KATI_RESTAT: $(full_classes_turbine_jar)
|
||||
|
||||
# Run jarjar before generate classes-header.jar if necessary.
|
||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||
@echo Header JarJar: $@
|
||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
||||
else
|
||||
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
||||
endif
|
||||
|
||||
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
|
||||
|
||||
my_desugaring :=
|
||||
ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
|
||||
my_desugaring := true
|
||||
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
||||
$(full_classes_desugar_jar): $(full_classes_compiled_jar) $(DESUGAR)
|
||||
$(full_classes_desugar_jar): $(full_classes_compiled_jar) $(full_java_header_libs) $(DESUGAR)
|
||||
$(desugar-classes-jar)
|
||||
endif
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
|||
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
||||
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
||||
java_source_list_file := $(intermediates.COMMON)/java-source-list
|
||||
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += \
|
||||
$(full_classes_compiled_jar) \
|
||||
|
@ -71,7 +72,7 @@ $(java_source_list_file): $(java_sources_deps)
|
|||
$(write-java-source-list)
|
||||
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
|
||||
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
|
||||
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
|
||||
|
@ -83,6 +84,7 @@ $(full_classes_compiled_jar): \
|
|||
$(annotation_processor_deps) \
|
||||
$(NORMALIZE_PATH) \
|
||||
$(ZIPTIME) \
|
||||
$(JAR_ARGS) \
|
||||
| $(SOONG_JAVAC_WRAPPER)
|
||||
$(transform-host-java-to-package)
|
||||
$(remove-timestamps-from-package)
|
||||
|
@ -110,3 +112,4 @@ include $(BUILD_SYSTEM)/jacoco.mk
|
|||
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(LOCAL_BUILT_MODULE)))
|
||||
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
|
||||
|
||||
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_header_jar)))
|
||||
|
|
55
core/java.mk
55
core/java.mk
|
@ -113,6 +113,9 @@ ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
|
|||
LOCAL_PROGUARD_ENABLED :=
|
||||
endif
|
||||
|
||||
full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
|
||||
full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
|
||||
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
|
||||
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
|
||||
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
|
||||
|
@ -139,6 +142,7 @@ noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
|
|||
jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
|
||||
|
||||
LOCAL_INTERMEDIATE_TARGETS += \
|
||||
$(full_classes_turbine_jar) \
|
||||
$(full_classes_compiled_jar) \
|
||||
$(full_classes_desugar_jar) \
|
||||
$(full_classes_jarjar_jar) \
|
||||
|
@ -152,7 +156,6 @@ LOCAL_INTERMEDIATE_TARGETS += \
|
|||
$(full_classes_stubs_jar) \
|
||||
$(java_source_list_file)
|
||||
|
||||
|
||||
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
|
||||
|
||||
###############################################################
|
||||
|
@ -448,7 +451,7 @@ java_sources_deps := \
|
|||
$(java_source_list_file): $(java_sources_deps)
|
||||
$(write-java-source-list)
|
||||
|
||||
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(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)
|
||||
|
@ -457,14 +460,44 @@ $(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_fil
|
|||
$(full_classes_compiled_jar): \
|
||||
$(java_source_list_file) \
|
||||
$(java_sources_deps) \
|
||||
$(full_java_lib_deps) \
|
||||
$(full_java_header_libs) \
|
||||
$(full_static_java_libs) \
|
||||
$(jar_manifest_file) \
|
||||
$(layers_file) \
|
||||
$(annotation_processor_deps) \
|
||||
$(NORMALIZE_PATH) \
|
||||
$(JAR_ARGS) \
|
||||
| $(SOONG_JAVAC_WRAPPER)
|
||||
$(transform-java-to-classes.jar)
|
||||
|
||||
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
||||
$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
||||
$(full_classes_turbine_jar): \
|
||||
$(java_source_list_file) \
|
||||
$(java_sources_deps) \
|
||||
$(full_java_header_libs) \
|
||||
$(jar_manifest_file) \
|
||||
$(layers_file) \
|
||||
$(NORMALIZE_PATH) \
|
||||
$(JAR_ARGS) \
|
||||
$(ZIPTIME) \
|
||||
| $(TURBINE)
|
||||
$(transform-java-to-header.jar)
|
||||
|
||||
.KATI_RESTAT: $(full_classes_turbine_jar)
|
||||
|
||||
# Run jarjar before generate classes-header.jar if necessary.
|
||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||
@echo Header JarJar: $@
|
||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
||||
else
|
||||
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
||||
endif
|
||||
|
||||
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
|
||||
|
||||
javac-check : $(full_classes_compiled_jar)
|
||||
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
|
||||
|
||||
|
@ -499,7 +532,7 @@ ifndef LOCAL_JACK_ENABLED
|
|||
ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
|
||||
my_desugaring := true
|
||||
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
||||
$(full_classes_desugar_jar): $(full_classes_processed_jar) $(DESUGAR)
|
||||
$(full_classes_desugar_jar): $(full_classes_processed_jar) $(full_java_header_libs) $(DESUGAR)
|
||||
$(desugar-classes-jar)
|
||||
endif
|
||||
endif
|
||||
|
@ -548,19 +581,22 @@ ifneq (,$(filter android-support-%,$(LOCAL_STATIC_JAVA_LIBRARIES)))
|
|||
ifdef LOCAL_SDK_VERSION
|
||||
ifdef TARGET_BUILD_APPS
|
||||
ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
|
||||
my_support_library_sdk_raise := $(call java-lib-files, sdk_vcurrent)
|
||||
my_support_library_sdk_raise := $(call java-lib-header-files, sdk_vcurrent)
|
||||
endif
|
||||
else
|
||||
# For platform build, we can't just raise to the "current" SDK,
|
||||
# that would break apps that use APIs removed from the current SDK.
|
||||
my_support_library_sdk_raise := $(call java-lib-files,$(TARGET_DEFAULT_JAVA_LIBRARIES))
|
||||
my_support_library_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_JAVA_LIBRARIES))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# jack already has the libraries in its classpath and doesn't support jars
|
||||
legacy_proguard_flags := $(addprefix -libraryjars ,$(my_support_library_sdk_raise) \
|
||||
$(filter-out $(my_support_library_sdk_raise),$(full_shared_java_libs)))
|
||||
$(filter-out $(my_support_library_sdk_raise),$(full_shared_java_header_libs)))
|
||||
|
||||
legacy_proguard_lib_deps := $(my_support_library_sdk_raise) \
|
||||
$(filter-out $(my_support_library_sdk_raise),$(full_shared_java_header_libs))
|
||||
|
||||
legacy_proguard_flags += -printmapping $(proguard_dictionary)
|
||||
jack_proguard_flags := -printmapping $(jack_dictionary)
|
||||
|
@ -605,6 +641,7 @@ ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
|||
# link_instr_classes_jar is defined in base_rule.mk
|
||||
# jack already has this library in its classpath and doesn't support jars
|
||||
legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
|
||||
legacy_proguard_lib_deps += $(link_instr_classes_jar)
|
||||
else # obfuscation
|
||||
# If obfuscation is enabled, the main app must be obfuscated too.
|
||||
# We need to run obfuscation using the main app's dictionary,
|
||||
|
@ -658,7 +695,7 @@ endif
|
|||
$(full_classes_proguard_jar): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
|
||||
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
|
||||
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
|
||||
$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) | $(PROGUARD)
|
||||
$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) | $(PROGUARD)
|
||||
$(call transform-jar-to-proguard)
|
||||
|
||||
else # LOCAL_PROGUARD_ENABLED not defined
|
||||
|
@ -667,8 +704,6 @@ endif # LOCAL_PROGUARD_ENABLED defined
|
|||
|
||||
$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(full_classes_jar)))
|
||||
|
||||
$(call define-jar-to-toc-rule, $(full_classes_jar))
|
||||
|
||||
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
||||
ifndef LOCAL_JACK_ENABLED
|
||||
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
||||
|
|
|
@ -171,7 +171,13 @@ full_static_java_libs := \
|
|||
$(call intermediates-dir-for, \
|
||||
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jar)
|
||||
|
||||
full_static_java_header_libs := \
|
||||
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
|
||||
$(call intermediates-dir-for, \
|
||||
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes-header.jar)
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_HEADER_LIBRARIES := $(full_static_java_header_libs)
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
|
||||
|
@ -198,18 +204,18 @@ ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|||
# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
|
||||
my_bootclasspath := ""
|
||||
else # LOCAL_NO_STANDARD_LIBRARIES
|
||||
my_bootclasspath := $(call java-lib-files,core-oj):$(call java-lib-files,core-libart)
|
||||
my_bootclasspath := $(call java-lib-header-files,core-oj):$(call java-lib-header-files,core-libart)
|
||||
endif # LOCAL_NO_STANDARD_LIBRARIES
|
||||
else
|
||||
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
|
||||
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
|
||||
my_bootclasspath := $(call java-lib-files,android_stubs_current)
|
||||
my_bootclasspath := $(call java-lib-header-files,android_stubs_current)
|
||||
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
|
||||
my_bootclasspath := $(call java-lib-files,android_system_stubs_current)
|
||||
my_bootclasspath := $(call java-lib-header-files,android_system_stubs_current)
|
||||
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
|
||||
my_bootclasspath := $(call java-lib-files,android_test_stubs_current)
|
||||
my_bootclasspath := $(call java-lib-header-files,android_test_stubs_current)
|
||||
else
|
||||
my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
|
||||
my_bootclasspath := $(call java-lib-header-files,sdk_v$(LOCAL_SDK_VERSION))
|
||||
endif # current, system_current, or test_current
|
||||
endif # LOCAL_SDK_VERSION
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
|
||||
|
@ -227,6 +233,7 @@ endif
|
|||
endif
|
||||
|
||||
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE))
|
||||
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE))
|
||||
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE))
|
||||
full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps))
|
||||
|
||||
|
@ -236,11 +243,12 @@ ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
|
|||
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
||||
my_bootclasspath := ""
|
||||
else
|
||||
my_bootclasspath := $(call normalize-path-list,$(call java-lib-files,core-oj-hostdex core-libart-hostdex,true))
|
||||
my_bootclasspath := $(call normalize-path-list,$(call java-lib-header-files,core-oj-hostdex core-libart-hostdex,true))
|
||||
endif
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
|
||||
|
||||
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),true)
|
||||
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),true)
|
||||
full_java_lib_deps := $(full_shared_java_libs)
|
||||
else # !USE_CORE_LIB_BOOTCLASSPATH
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
|
||||
|
@ -251,7 +259,10 @@ full_java_lib_deps := $(full_shared_java_libs)
|
|||
endif # USE_CORE_LIB_BOOTCLASSPATH
|
||||
endif # !LOCAL_IS_HOST_MODULE
|
||||
|
||||
# Only host java libraries use LOCAL_CLASSPATH.
|
||||
full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
|
||||
full_java_header_libs := $(full_shared_java_header_libs) $(full_static_java_header_libs)
|
||||
|
||||
full_java_lib_deps := $(full_java_lib_deps) $(full_static_java_libs) $(LOCAL_CLASSPATH)
|
||||
|
||||
ifndef LOCAL_IS_HOST_MODULE
|
||||
|
@ -267,6 +278,7 @@ ifneq ($(apk_libraries),)
|
|||
# link against the jar with full original names (before proguard processing).
|
||||
full_shared_java_libs += $(link_apk_libraries)
|
||||
full_java_libs += $(link_apk_libraries)
|
||||
full_java_header_libs += $(link_apk_libraries)
|
||||
full_java_lib_deps += $(link_apk_libraries)
|
||||
endif
|
||||
|
||||
|
@ -285,6 +297,7 @@ ifdef LOCAL_INSTRUMENTATION_FOR
|
|||
# link against the jar with full original names (before proguard processing).
|
||||
link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes-pre-proguard.jar
|
||||
full_java_libs += $(link_instr_classes_jar)
|
||||
full_java_header_libs += $(link_instr_classes_jar)
|
||||
full_java_lib_deps += $(link_instr_classes_jar)
|
||||
endif # LOCAL_INSTRUMENTATION_FOR
|
||||
endif # LOCAL_IS_HOST_MODULE
|
||||
|
@ -333,6 +346,7 @@ endif
|
|||
endif # !LOCAL_IS_HOST_MODULE
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
|
||||
|
||||
ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
|
||||
$(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
||||
|
|
|
@ -85,13 +85,16 @@ $(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
|
|||
ifdef LOCAL_JACK_ENABLED
|
||||
$(create-empty-package)
|
||||
else
|
||||
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
||||
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@.tmp)
|
||||
endif
|
||||
$(add-dex-to-package)
|
||||
$(call add-dex-to-package-arg,$@.tmp)
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
$(add-carried-jack-resources)
|
||||
endif
|
||||
$(remove-timestamps-from-package)
|
||||
$(hide) $(ZIPTIME) $@.tmp
|
||||
$(call commit-change-for-toc,$@)
|
||||
|
||||
.KATI_RESTAT: $(common_javalib.jar)
|
||||
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
ifneq ($(dexpreopt_boot_jar_module),) # boot jar
|
||||
|
|
|
@ -455,6 +455,7 @@ ifdef LOCAL_IS_HOST_MODULE
|
|||
# for host java libraries deps should be in the common dir, so we make a copy in
|
||||
# the common dir.
|
||||
common_classes_jar := $(intermediates.COMMON)/classes.jar
|
||||
common_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
|
||||
$(common_classes_jar): PRIVATE_MODULE := $(LOCAL_MODULE)
|
||||
$(common_classes_jar): PRIVATE_PREFIX := $(my_prefix)
|
||||
|
@ -462,10 +463,14 @@ $(common_classes_jar): PRIVATE_PREFIX := $(my_prefix)
|
|||
$(common_classes_jar) : $(my_src_jar)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
$(common_header_jar) : $(my_src_jar)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
else # !LOCAL_IS_HOST_MODULE
|
||||
# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
|
||||
# while the deps should be in the common dir, so we make a copy in the common dir.
|
||||
common_classes_jar := $(intermediates.COMMON)/classes.jar
|
||||
common_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
common_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
|
||||
common_javalib_jar := $(intermediates.COMMON)/javalib.jar
|
||||
|
||||
|
@ -510,14 +515,15 @@ endif
|
|||
$(common_classes_jar) : $(my_src_jar)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
$(common_header_jar) : $(my_src_jar)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
$(common_classes_pre_proguard_jar) : $(my_src_jar)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
$(common_javalib_jar) : $(common_classes_jar)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
||||
$(call define-jar-to-toc-rule, $(common_classes_jar))
|
||||
|
||||
ifdef LOCAL_USE_AAPT2
|
||||
ifneq ($(my_src_aar),)
|
||||
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
||||
|
|
|
@ -184,6 +184,7 @@ $(full_classes_jack): $(R_file_stamp)
|
|||
$(jack_check_timestamp): $(R_file_stamp)
|
||||
endif # LOCAL_JACK_ENABLED
|
||||
$(full_classes_compiled_jar): $(R_file_stamp)
|
||||
$(full_classes_turbine_jar): $(R_file_stamp)
|
||||
|
||||
|
||||
# if we have custom proguarding done use the proguarded classes jar instead of the normal classes jar
|
||||
|
|
Loading…
Reference in New Issue