Allow disabling turbine

m -j TURBINE_ENABLED=false will build without turbine.  This is
primarily useful for A/B comparisions of turbine builds, but will
also be used to temporarily disable turbine for unbundled builds
until we have turbine prebuilts.

Bug: 64308460
Test: m -j TURBINE_ENABLED=false java
Test: m -j java
Change-Id: Ie48746c8bfc60c361be9634cb1805ca1c09aa1fe
This commit is contained in:
Colin Cross 2017-09-26 16:17:24 -07:00
parent 9b2e4c6950
commit 7dc9043546
7 changed files with 33 additions and 1 deletions

View File

@ -683,9 +683,15 @@ endef
# Java libraries that you want to link against.
# $(1): library name list
# $(2): Non-empty if IS_HOST_MODULE
ifneq ($(TURBINE_ENABLED),false)
define java-lib-header-files
$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes-header.jar)
endef
else
define java-lib-header-files
$(call java-lib-files,$(1),$(2))
endef
endif
# Get the dependency files (you can put on the right side of "|" of a build rule)
# of the Java libraries.
@ -709,9 +715,15 @@ endef
# Get the header jar files (you can pass to "javac -classpath") of static or shared
# APK libraries that you want to link against.
# $(1): library name list
ifneq ($(TURBINE_ENABLED),false)
define app-lib-header-files
$(foreach lib,$(1),$(call intermediates-dir-for,APPS,$(lib),,COMMON)/classes-header.jar)
endef
else
define app-lib-header-files
$(call app-lib-files,$(1))
endef
endif
###########################################################
## Convert "core ext framework" to "out/.../classes.jack ..."

View File

@ -119,6 +119,8 @@ $(full_classes_compiled_jar): \
| $(SOONG_JAVAC_WRAPPER)
$(transform-host-java-to-dalvik-package)
ifneq ($(TURBINE_ENABLED),false)
$(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): \
@ -147,6 +149,8 @@ endif
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
endif # TURBINE_ENABLED != false
$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
$(full_classes_combined_jar): $(full_classes_compiled_jar) \
$(jar_manifest_file) \

View File

@ -122,4 +122,6 @@ 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)))
ifneq ($(TURBINE_DISABLED),false)
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_header_jar)))
endif

View File

@ -499,6 +499,8 @@ $(full_classes_compiled_jar): \
| $(SOONG_JAVAC_WRAPPER)
$(transform-java-to-classes.jar)
ifneq ($(TURBINE_ENABLED),false)
$(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): \
@ -527,6 +529,8 @@ endif
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
endif # TURBINE_ENABLED != false
javac-check : $(full_classes_compiled_jar)
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)

View File

@ -300,7 +300,11 @@ ifdef LOCAL_INSTRUMENTATION_FOR
APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
# link against the jar with full original names (before proguard processing).
link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes-pre-proguard.jar
link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes-header.jar
ifneq ($(TURBINE_ENABLED),false)
link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes-header.jar
else
link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
endif
full_java_libs += $(link_instr_classes_jar)
full_java_header_libs += $(link_instr_classes_header_jar)
endif # LOCAL_INSTRUMENTATION_FOR

View File

@ -468,8 +468,10 @@ $(common_classes_jar): PRIVATE_PREFIX := $(my_prefix)
$(common_classes_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
ifneq ($(TURBINE_ENABLED),false)
$(common_header_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
endif
else # !LOCAL_IS_HOST_MODULE
# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
@ -520,8 +522,10 @@ endif
$(common_classes_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
ifneq ($(TURBINE_ENABLED),false)
$(common_header_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
endif
$(common_classes_pre_proguard_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)

View File

@ -26,11 +26,13 @@ include $(BUILD_SYSTEM)/jacoco.mk
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
ifneq ($(TURBINE_DISABLED),false)
ifdef LOCAL_SOONG_HEADER_JAR
$(eval $(call copy-one-file,$(LOCAL_SOONG_HEADER_JAR),$(full_classes_header_jar)))
else
$(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_header_jar)))
endif
endif # TURBINE_DISABLED != false
ifdef LOCAL_SOONG_DEX_JAR
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))