f09e59eb52
This allows to compile dex targeted java sources using Jack and Jill. Default is still to compile with the legacy toolchain. Default can be switched to the new toolchain by setting environement variable: export ANDROID_COMPILE_WITH_JACK=true Toolchain can also be forced for one module by defining LOCAL_JACK_ENABLED:=full # disabled, full, incremental in the mk portion defining the module. Jack execution environement can be controlled with: Global variable ANDROID_JACK_VM allow to change the jvm executing Jack. Global variable ANDROID_JACK_VM_ARGS allows to change default args given to the jvm. Global variable ANDROID_JACK_EXTRA_ARGS allows to define some default args to give to Jack LOCAL_JACK_VM_ARGS allows to override default args given to the jvm for the module. LOCAL_JACK_EXTRA_ARGS allows to override default args passed to Jack. This includes cherry-picks of the following changes:b4c49cba57
22c3fa6d73
138768c1bb
5dd3e1d312
83d5d04047
8bc90fd2d6
140274707e
0fbc9ff2a2
833b427d72
f9a27f45b4
2809666941
37822c443d
c6b44d43c3
d2a76c14bf
06744f60fc
95573d5036
b821391614
2794e7b582
801f2c44d0
c76d99dca1
f528e132d6
76a5e0bd1a
e25b3984ff
Partially, only Jack related parts werekeptec46a3b71f
abee3a9f41
77cbe10fd9
daf07db4cd
b6bfb5893a
Ie all Jack related changes untillb6bfb5893a
excepta96cc59ab5
"Use Jack by default" Change-Id: If9d47ef1c4fd1e6765ad2a47d816c1ad3cfab0e3
124 lines
3.6 KiB
Makefile
124 lines
3.6 KiB
Makefile
###########################################################
|
|
## Standard rules for building a java library.
|
|
##
|
|
###########################################################
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
$(error $(LOCAL_PATH): Host java libraries must use BUILD_HOST_JAVA_LIBRARY)
|
|
endif
|
|
|
|
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
|
|
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
|
|
|
ifneq (,$(LOCAL_ASSET_DIR))
|
|
$(error $(LOCAL_PATH): Target java libraries may not set LOCAL_ASSET_DIR)
|
|
endif
|
|
|
|
ifneq (true,$(LOCAL_IS_STATIC_JAVA_LIBRARY))
|
|
ifneq (,$(LOCAL_RESOURCE_DIR))
|
|
$(error $(LOCAL_PATH): Target java libraries may not set LOCAL_RESOURCE_DIR)
|
|
endif
|
|
# base_rules.mk looks at this
|
|
all_res_assets :=
|
|
endif
|
|
|
|
LOCAL_BUILT_MODULE_STEM := javalib.jar
|
|
|
|
#################################
|
|
include $(BUILD_SYSTEM)/configure_local_jack.mk
|
|
#################################
|
|
|
|
ifdef LOCAL_JACK_ENABLED
|
|
ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
LOCAL_BUILT_MODULE_STEM := classes.jack
|
|
endif
|
|
endif
|
|
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
|
|
|
# This file will be the one that other modules should depend on.
|
|
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
|
|
LOCAL_INTERMEDIATE_TARGETS += $(common_javalib.jar)
|
|
|
|
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
|
|
LOCAL_PROGUARD_ENABLED :=
|
|
endif
|
|
|
|
ifeq (true,$(EMMA_INSTRUMENT))
|
|
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
|
|
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
|
|
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
|
endif # LOCAL_EMMA_INSTRUMENT
|
|
endif # EMMA_INSTRUMENT_STATIC
|
|
else
|
|
LOCAL_EMMA_INSTRUMENT := false
|
|
endif # EMMA_INSTRUMENT
|
|
|
|
#################################
|
|
include $(BUILD_SYSTEM)/java.mk
|
|
#################################
|
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
|
# No dex; all we want are the .class files with resources.
|
|
$(common_javalib.jar) : $(java_resource_sources)
|
|
ifdef LOCAL_PROGUARD_ENABLED
|
|
$(common_javalib.jar) : $(full_classes_proguard_jar)
|
|
else
|
|
$(common_javalib.jar) : $(full_classes_jar)
|
|
endif
|
|
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
|
|
$(copy-file-to-target)
|
|
|
|
ifdef LOCAL_JACK_ENABLED
|
|
$(LOCAL_BUILT_MODULE) : $(full_classes_jack)
|
|
else
|
|
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar)
|
|
endif
|
|
$(copy-file-to-target)
|
|
|
|
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
|
|
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
|
$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
|
|
$(common_javalib.jar) : $(built_dex) $(java_resource_sources)
|
|
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
|
|
ifdef LOCAL_JACK_ENABLED
|
|
$(create-empty-package)
|
|
else
|
|
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
|
endif
|
|
$(add-dex-to-package)
|
|
ifdef LOCAL_JACK_ENABLED
|
|
$(add-carried-jack-resources)
|
|
endif
|
|
|
|
ifdef LOCAL_DEX_PREOPT
|
|
ifneq ($(dexpreopt_boot_jar_module),) # boot jar
|
|
# boot jar's rules are defined in dex_preopt.mk
|
|
dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
|
|
$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar) | $(ACP)
|
|
$(call copy-file-to-target)
|
|
|
|
# For libart boot jars, we don't have .odex files.
|
|
else # ! boot jar
|
|
$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
# Use pattern rule - we may have multiple built odex files.
|
|
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
|
|
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
|
|
$(call dexpreopt-one-file,$<,$@)
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
|
|
$(call copy-file-to-target)
|
|
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
|
|
$(call dexpreopt-remove-classes.dex,$@)
|
|
endif
|
|
|
|
endif # ! boot jar
|
|
|
|
else # LOCAL_DEX_PREOPT
|
|
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
|
|
$(call copy-file-to-target)
|
|
|
|
endif # LOCAL_DEX_PREOPT
|
|
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|