Add support for Jack plugin am: 53b7fbbe78 am: be50693fc1

am: 62e67d1bff

Change-Id: I7cf2db9ccd9bfe03ec1394340b2683b014e7dde5
This commit is contained in:
Yohann Roussel 2016-09-22 22:14:39 +00:00 committed by android-build-merger
commit cf65679d9e
5 changed files with 38 additions and 6 deletions

View File

@ -76,6 +76,8 @@ LOCAL_JAVA_LAYERS_FILE:=
LOCAL_NO_STANDARD_LIBRARIES:=
LOCAL_CLASSPATH:=
LOCAL_JACK_CLASSPATH:=
LOCAL_JACK_PLUGIN_PATH:=
LOCAL_JACK_PLUGIN:=
LOCAL_DROIDDOC_USE_STANDARD_DOCLET:=
LOCAL_DROIDDOC_SOURCE_PATH:=
LOCAL_DROIDDOC_TEMPLATE_DIR:=

View File

@ -748,6 +748,13 @@ define normalize-path-list
$(subst $(space),:,$(strip $(1)))
endef
###########################################################
## Convert "a b c" into "a,b,c"
###########################################################
define normalize-comma-list
$(subst $(space),$(comma),$(strip $(1)))
endef
###########################################################
## Read the word out of a colon-separated list of words.
## This has the same behavior as the built-in function
@ -2325,6 +2332,9 @@ $(call call-jack) \
$(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_JACK_SHARED_LIBRARIES)))) \
$(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
$(addprefix --pluginpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_JACK_PLUGIN_PATH)))) \
$(if $(PRIVATE_JACK_PLUGIN),--plugin $(call normalize-comma-list,$(PRIVATE_JACK_PLUGIN))) \
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
-D jack.import.resource.policy=keep-first \
@ -2384,6 +2394,9 @@ define transform-jar-to-jack
$(hide) find $@.tmpjill.res -iname "*.class" -delete
$(hide) $(call call-jack) \
$(PRIVATE_JACK_FLAGS) \
$(addprefix --pluginpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_JACK_PLUGIN_PATH)))) \
$(if $(PRIVATE_JACK_PLUGIN),--plugin $(call normalize-comma-list,$(PRIVATE_JACK_PLUGIN))) \
-D jack.import.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
@ -2491,6 +2504,9 @@ $(call call-jack) \
$(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_JACK_SHARED_LIBRARIES)))) \
$(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
$(addprefix --pluginpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_JACK_PLUGIN_PATH)))) \
$(if $(PRIVATE_JACK_PLUGIN),--plugin $(call normalize-comma-list,$(PRIVATE_JACK_PLUGIN))) \
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
-D jack.import.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \

View File

@ -85,7 +85,9 @@ jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
$(built_dex): $(jack_all_deps) | setup-jack-server
$(built_dex): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(built_dex): PRIVATE_JACK_PLUGIN := $(JACK_PLUGIN)
$(built_dex): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
@echo Building with Jack: $@
$(jack-java-to-dex)
@ -103,7 +105,9 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
$(add-carried-jack-resources)
else # LOCAL_IS_STATIC_JAVA_LIBRARY
$(full_classes_jack): $(jack_all_deps) | setup-jack-server
$(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(full_classes_jack): PRIVATE_JACK_PLUGIN := $(JACK_PLUGIN)
$(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
@echo Building with Jack: $@
$(java-to-jack)

View File

@ -635,7 +635,9 @@ $(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
$(jack-check-java)
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(full_classes_jack): $(jack_all_deps) | setup-jack-server
$(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(full_classes_jack): PRIVATE_JACK_PLUGIN := $(JACK_PLUGIN)
$(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
@echo Building with Jack: $@
$(java-to-jack)
@ -648,6 +650,8 @@ else #LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
LOCAL_JACK_PLUGIN_PATH += $(HOST_OUT_JAVA_LIBRARIES)/jack-coverage-plugin.jar
LOCAL_JACK_PLUGIN += com.android.jack.coverage.CodeCoverage
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS := \
-D jack.coverage=true \
-D jack.coverage.metadata.file=$(intermediates.COMMON)/coverage.em \
@ -658,7 +662,9 @@ else
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
endif
$(built_dex_intermediate): $(jack_all_deps) | setup-jack-server
$(built_dex_intermediate): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(built_dex_intermediate): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
$(built_dex_intermediate): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
@echo Building with Jack: $@
$(jack-java-to-dex)
@ -672,9 +678,11 @@ $(call define-dex-to-toc-rule, $(intermediates.COMMON))
endif #LOCAL_IS_STATIC_JAVA_LIBRARY
$(noshrob_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(noshrob_classes_jack): PRIVATE_JACK_PLUGIN := $(JACK_PLUGIN)
$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
$(noshrob_classes_jack): $(jack_all_deps) | setup-jack-server
$(noshrob_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
@echo Building with Jack: $@
$(java-to-jack)
endif # full_classes_jar is defined

View File

@ -502,7 +502,9 @@ ifneq ($(prebuilt_module_is_dex_javalib),true)
# We may be building classes.jack from a host jar for host dalvik Java library.
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_FLAGS:=$(LOCAL_JACK_FLAGS)
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_MIN_SDK_VERSION := $(if $(strip $(LOCAL_MIN_SDK_VERSION)),$(LOCAL_MIN_SDK_VERSION),1)
$(intermediates.COMMON)/classes.jack : $(my_src_jar) \
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_PLUGIN := $(JACK_PLUGIN)
$(intermediates.COMMON)/classes.jack : $(LOCAL_JACK_PLUGIN_PATH) $(my_src_jar) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_DEFAULT_ARGS) $(JACK) \
| setup-jack-server
$(transform-jar-to-jack)