Merge "Implement LOCAL_TARGET_REQUIRED_MODULES"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 6a3e53e..63d6f66 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -428,6 +428,10 @@
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*/classes*.jack)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*/jack*)
+# Move adbd from $(PRODUCT_OUT)/root/sbin to $(PRODUCT_OUT)/system/bin
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/sbin/adbd)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/sbin/adbd)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index e0d0234..305cf4e 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1186,6 +1186,8 @@
@echo Copying baseline ramdisk...
# Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
$(hide) rsync -a --exclude=etc --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
+ # Copy adbd from system/bin to recovery/root/sbin
+ $(hide) cp -f $(TARGET_OUT_EXECUTABLES)/adbd $(TARGET_RECOVERY_ROOT_OUT)/sbin/adbd
@echo Modifying ramdisk contents...
$(if $(BOARD_RECOVERY_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
@@ -1239,6 +1241,8 @@
@echo ----- Made recovery image: $(1) --------
endef
+ADBD := $(TARGET_OUT_EXECUTABLES)/adbd
+
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
@@ -1249,7 +1253,7 @@
ifeq (true,$(BOARD_AVB_ENABLE))
$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
endif
-$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) $(ADBD) \
$(INSTALLED_RAMDISK_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
$(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
@@ -1264,7 +1268,7 @@
$(call build-recoveryimage-target, $@)
endif
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) $(ADBD) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
@@ -1771,8 +1775,11 @@
# We just build this directly to the install location.
INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
+ifneq (true,$(SANITIZE_LITE))
+# Only create system_other when not building the second stage of a SANITIZE_LITE build.
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
$(build-systemotherimage-target)
+endif
.PHONY: systemotherimage-nodeps
systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 2e179f6..73b1c04 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -29,6 +29,26 @@
# include defines, and compiler settings for the given architecture
# version.
#
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),)
+TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT := generic
+endif
+
+KNOWN_ARMv8_CORES := cortex-a53 cortex-a53.a57 cortex-a73
+KNOWN_ARMv8_CORES += kryo denver64 exynos-m1 exynos-m2
+
+# Many devices (incorrectly) use armv7-a-neon as the 2nd architecture variant
+# for cores that implement armv8-a ISAs. The following sets it to armv8-a.
+ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv8_CORES)))
+ ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-a)
+ $(warning $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT) is armv8-a.)
+ ifneq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
+ $(warning TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT), ignored! Use armv8-a instead.)
+ endif
+ # Overwrite TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT
+ TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv8-a
+ endif
+endif
+
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv5te
endif
diff --git a/core/combo/arch/arm/armv8-a.mk b/core/combo/arch/arm/armv8-a.mk
new file mode 100644
index 0000000..9ef5c49
--- /dev/null
+++ b/core/combo/arch/arm/armv8-a.mk
@@ -0,0 +1,9 @@
+# Configuration for Linux on ARM.
+# Generating binaries for the ARMv8-a architecture
+#
+# Many libraries are not aware of armv8-a, and AArch32 is (almost) a superset
+# of armv7-a-neon. So just let them think we are just like v7.
+ARCH_ARM_HAVE_ARMV7A := true
+ARCH_ARM_HAVE_VFP := true
+ARCH_ARM_HAVE_VFP_D32 := true
+ARCH_ARM_HAVE_NEON := true
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index 0538c52..835ee82 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -1,12 +1,11 @@
# Selects a Java compiler.
#
# Inputs:
-# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
-# default
-# ALTERNATE_JAVAC -- the alternate java compiler to use
+# OVERRIDE_ANDROID_JAVA_HOME -- alternate location to use for jdk
#
# Outputs:
-# COMMON_JAVAC -- Java compiler command with common arguments
+# ANDROID_JAVA_HOME -- Directory that contains JDK
+# ANDROID_JAVA_TOOLCHAIN -- Directory that contains javac and other java tools
#
ifndef ANDROID_COMPILE_WITH_JACK
@@ -23,8 +22,6 @@
endif
endif
-common_jdk_flags := -Xmaxerrs 9999999
-
ifeq ($(OVERRIDE_ANDROID_JAVA_HOME),)
ANDROID_JAVA_HOME := prebuilts/jdk/jdk8/$(HOST_PREBUILT_TAG)
else
@@ -34,30 +31,6 @@
ANDROID_JAVA_TOOLCHAIN := $(ANDROID_JAVA_HOME)/bin
export JAVA_HOME := $(abspath $(ANDROID_JAVA_HOME))
-# Use the indexer wrapper to index the codebase instead of the javac compiler
-ifeq ($(ALTERNATE_JAVAC),)
-JAVACC := $(ANDROID_JAVA_TOOLCHAIN)/javac
-else
-JAVACC := $(ALTERNATE_JAVAC)
-endif
-
+# TODO(ccross): remove this, it is needed for now because it is used by
+# config.mk before makevars from soong are loaded
JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java
-JAVADOC := $(ANDROID_JAVA_TOOLCHAIN)/javadoc
-JAR := $(ANDROID_JAVA_TOOLCHAIN)/jar
-
-# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
-ifdef JAVAC_WRAPPER
- ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
- JAVACC := $(JAVAC_WRAPPER) $(JAVACC)
- endif
-endif
-
-COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags)
-
-GLOBAL_JAVAC_DEBUG_FLAGS := -g
-
-HOST_JAVAC ?= $(COMMON_JAVAC)
-TARGET_JAVAC ?= $(COMMON_JAVAC)
-
-#$(info HOST_JAVAC=$(HOST_JAVAC))
-#$(info TARGET_JAVAC=$(TARGET_JAVAC))
diff --git a/core/config.mk b/core/config.mk
index 65601bf..f74f5b4 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -650,6 +650,7 @@
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
diff --git a/core/definitions.mk b/core/definitions.mk
index c43b156..15752f9 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -692,6 +692,14 @@
$(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
@@ -2206,48 +2214,50 @@
@<(find $(1) -type f | sort | $(JAR_ARGS) $(1); echo "-C $(EMPTY_DIRECTORY) .")
endef
-# Common definition to invoke javac on the host and target.
-#
# Some historical notes:
# - below we write the list of java files to java-source-list to avoid argument
# list length problems with Cygwin
# - we filter out duplicate java file names because eclipse's compiler
# doesn't like them.
+define write-java-source-list
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Java source list: $(PRIVATE_MODULE)"
+$(hide) rm -f $@
+$(call dump-words-to-file,$(sort $(PRIVATE_JAVA_SOURCES)),$@.tmp)
+$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $@.tmp; \
+fi
+$(if $(PRIVATE_HAS_PROTO_SOURCES), \
+ $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $@.tmp)
+$(if $(PRIVATE_HAS_RS_SOURCES), \
+ $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $@.tmp)
+$(hide) tr ' ' '\n' < $@.tmp | $(NORMALIZE_PATH) | sort -u > $@
+endef
+
+# Common definition to invoke javac on the host and target.
#
# $(1): javac
# $(2): bootclasspath
+# $(3): classpath_libs
define compile-java
$(hide) rm -f $@
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR)
$(hide) mkdir -p $(dir $@)
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR)
$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
-fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list )
-$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
- | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
-$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
+$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
$(SOONG_JAVAC_WRAPPER) $(1) -encoding UTF-8 \
$(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) \
- \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \
+ \@$(PRIVATE_JAVA_SOURCE_LIST) \
|| ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) \
fi
$(if $(PRIVATE_JAVA_LAYERS_FILE), $(hide) build/tools/java-layers.py \
- $(PRIVATE_JAVA_LAYERS_FILE) \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq,)
-$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list
-$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
+ $(PRIVATE_JAVA_LAYERS_FILE) @$(PRIVATE_JAVA_SOURCE_LIST),)
$(if $(PRIVATE_JAR_EXCLUDE_FILES), $(hide) find $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
-name $(word 1, $(PRIVATE_JAR_EXCLUDE_FILES)) \
$(addprefix -o -name , $(wordlist 2, 999, $(PRIVATE_JAR_EXCLUDE_FILES))) \
@@ -2271,15 +2281,34 @@
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.
-#
-# Some historical notes:
-# - below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin
-# - we filter out duplicate java file names because Jack doesn't like them.
define jack-java-to-dex
$(hide) rm -f $@
$(hide) rm -f $(PRIVATE_CLASSES_JACK)
@@ -2288,17 +2317,6 @@
$(hide) mkdir -p $(dir $(PRIVATE_CLASSES_JACK))
$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
-$(if $(PRIVATE_SOURCE_INTERMEDIATES_DIR), \
- $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
- fi)
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
- | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
$(hide) echo -basedirectory $(CURDIR) > $@.flags; \
echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
@@ -2313,8 +2331,8 @@
$(hide) mkdir -p $@.tmpjill.res
$(hide) unzip -qo $(PRIVATE_JACK_IMPORT_JAR) -d $@.tmpjill.res
$(hide) find $@.tmpjill.res -iname "*.class" -delete)
-$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
- export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
+$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
+ export tmpEcjArg="@$(PRIVATE_JAVA_SOURCE_LIST)"; \
else \
export tmpEcjArg=""; \
fi; \
@@ -2345,37 +2363,18 @@
$$tmpEcjArg \
|| ( rm -rf $(PRIVATE_CLASSES_JACK); exit 41 )
$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/classes*.dex $(dir $@)
-$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
-$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
endef
# Invoke Jack to compile java source just to check it compiles correctly.
-#
-# Some historical notes:
-# - below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin
-# - we filter out duplicate java file names because Jack doesn't like them.
define jack-check-java
$(hide) rm -f $@
-$(hide) rm -f $@.java-source-list
-$(hide) rm -f $@.java-source-list-uniq
$(hide) mkdir -p $(dir $@)
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$@.java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list; \
-fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list )
-$(hide) tr ' ' '\n' < $@.java-source-list \
- | sort -u > $@.java-source-list-uniq
-$(hide) if [ -s $@.java-source-list-uniq ] ; then \
+$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
$(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \
$(strip $(PRIVATE_JACK_FLAGS)) \
$(strip $(PRIVATE_JACK_DEBUG_FLAGS)) \
@@ -2385,7 +2384,7 @@
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
-D jack.import.type.policy=keep-first \
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
- @$@.java-source-list-uniq; \
+ @$(PRIVATE_JAVA_SOURCE_LIST); \
fi
touch $@
endef
@@ -2421,26 +2420,6 @@
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.
@@ -2471,27 +2450,12 @@
# Invoke Jack to compile java from source to jack files without shrink or obfuscation.
-#
-# Some historical notes:
-# - below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin
-# - we filter out duplicate java file names because Jack doesn't like them.
define java-to-jack
$(hide) rm -f $@
$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR)
$(hide) mkdir -p $(dir $@)
$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
-fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
- | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
$(hide) echo -basedirectory $(CURDIR) > $@.flags; \
echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
@@ -2502,8 +2466,8 @@
$(hide) $(call add-java-resources-to,$@.res.tmp.zip)
$(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp
$(hide) rm $@.res.tmp.zip)
-$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
- export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
+$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
+ export tmpEcjArg="@$(PRIVATE_JAVA_SOURCE_LIST)"; \
else \
export tmpEcjArg=""; \
fi; \
@@ -2527,9 +2491,7 @@
$(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \
$$tmpEcjArg \
|| ( rm -f $@ ; exit 41 )
-$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
-$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
@@ -2559,7 +2521,7 @@
-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 \
@@ -2769,8 +2731,15 @@
# 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
###########################################################
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 0606c83..439f7e5 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -24,7 +24,12 @@
SYSTEM_OTHER_ODEX_FILTER ?= app/% priv-app/%
# Method returning whether the install path $(1) should be for system_other.
+# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan.
+ifeq ($(SANITIZE_LITE),true)
+install-on-system-other =
+else
install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1)))))
+endif
# The default values for pre-opting: always preopt PIC.
# Conditional to building on linux, as dex2oat currently does not work on darwin.
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index d728118..b22a98f 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -65,6 +65,12 @@
my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
endif
+ifneq (addresstrue,$(SANITIZE_TARGET)$(SANITIZE_LITE))
+# Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
+# and invalidate first-stage artifacts which are crucial to SANITIZE_LITE builds.
+# Note: this is technically incorrect. Compiled code contains stack checks which may depend
+# on ASAN settings.
+
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags)
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
# Use dex2oat debug version for better error reporting
@@ -92,3 +98,5 @@
--no-generate-debug-info --generate-build-id \
--multi-image --no-inline-from=core-oj.jar \
$(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
+
+endif
diff --git a/core/envsetup.mk b/core/envsetup.mk
index d17e9e0..d8be9c3 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -427,8 +427,16 @@
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
ifneq ($(filter address,$(SANITIZE_TARGET)),)
target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+target_out_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
+else
+target_out_app_base := $(TARGET_OUT)
+endif
else
target_out_shared_libraries_base := $(TARGET_OUT)
+target_out_app_base := $(TARGET_OUT)
endif
TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
@@ -442,8 +450,8 @@
endif
TARGET_OUT_RENDERSCRIPT_BITCODE := $(TARGET_OUT_SHARED_LIBRARIES)
TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
-TARGET_OUT_APPS := $(TARGET_OUT)/app
-TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT)/priv-app
+TARGET_OUT_APPS := $(target_out_app_base)/app
+TARGET_OUT_APPS_PRIVILEGED := $(target_out_app_base)/priv-app
TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
TARGET_OUT_ETC := $(TARGET_OUT)/etc
@@ -451,7 +459,13 @@
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
+else
TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
+endif
# Out for TARGET_2ND_ARCH
TARGET_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
@@ -520,8 +534,16 @@
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
ifneq ($(filter address,$(SANITIZE_TARGET)),)
target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+target_out_vendor_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor
+else
+target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
+endif
else
target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR)
+target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
endif
TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
@@ -533,8 +555,8 @@
endif
TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
-TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR)/app
-TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(TARGET_OUT_VENDOR)/priv-app
+TARGET_OUT_VENDOR_APPS := $(target_out_vendor_app_base)/app
+TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(target_out_vendor_app_base)/priv-app
TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 0aabd51..d436d03 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -42,6 +42,9 @@
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
@@ -49,15 +52,18 @@
full_classes_jack := $(intermediates.COMMON)/classes.jack
jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
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) \
$(full_classes_jack) \
$(full_classes_jar) \
$(jack_check_timestamp) \
- $(built_dex)
+ $(built_dex) \
+ $(java_source_list_file)
# See comment in java.mk
ifndef LOCAL_CHECKED_MODULE
@@ -83,31 +89,67 @@
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
+# List of dependencies for anything that needs all java sources in place
+java_sources_deps := \
+ $(java_sources) \
+ $(java_resource_sources) \
+ $(proto_java_sources_file_stamp) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+$(java_source_list_file): $(java_sources_deps)
+ $(write-java-source-list)
+
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_sources) \
- $(java_resource_sources) \
- $(full_java_lib_deps) \
- $(jar_manifest_file) \
- $(proto_java_sources_file_stamp) \
- $(annotation_processor_deps) \
- $(NORMALIZE_PATH) \
- $(JAR_ARGS) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- | $(SOONG_JAVAC_WRAPPER)
- $(transform-host-java-to-package)
+ $(java_source_list_file) \
+ $(java_sources_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-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
@@ -173,9 +215,14 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(PLATFORM_JACK_MIN_SDK_VERSION)
-jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(proto_java_sources_file_stamp) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(NORMALIZE_PATH) $(JACK_DEFAULT_ARGS) $(JACK)
+jack_all_deps := \
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_jack_deps) \
+ $(jar_manifest_file) \
+ $(NORMALIZE_PATH) \
+ $(JACK_DEFAULT_ARGS) \
+ $(JACK)
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 033297a..adc30dd 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -34,10 +34,13 @@
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) \
$(full_classes_jarjar_jar) \
+ $(java_source_list_file)
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
@@ -58,23 +61,31 @@
LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
endif
+# List of dependencies for anything that needs all java sources in place
+java_sources_deps := \
+ $(java_sources) \
+ $(java_resource_sources) \
+ $(proto_java_sources_file_stamp) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+$(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 :=
$(full_classes_compiled_jar): \
- $(java_sources) \
- $(java_resource_sources) \
- $(full_java_lib_deps) \
- $(jar_manifest_file) \
- $(proto_java_sources_file_stamp) \
- $(annotation_processor_deps) \
- $(NORMALIZE_PATH) \
- $(JAR_ARGS) \
- $(ZIPTIME) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- | $(SOONG_JAVAC_WRAPPER)
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_java_lib_deps) \
+ $(jar_manifest_file) \
+ $(annotation_processor_deps) \
+ $(NORMALIZE_PATH) \
+ $(ZIPTIME) \
+ $(JAR_ARGS) \
+ | $(SOONG_JAVAC_WRAPPER)
$(transform-host-java-to-package)
$(remove-timestamps-from-package)
@@ -101,3 +112,4 @@
$(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)))
diff --git a/core/java.mk b/core/java.mk
index 673b2b1..98df834 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -113,6 +113,9 @@
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
@@ -121,6 +124,8 @@
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
+java_source_list_file := $(intermediates.COMMON)/java-source-list
+
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
# If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
@@ -137,6 +142,7 @@
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) \
@@ -147,8 +153,8 @@
$(noshrob_classes_jack) \
$(jack_check_timestamp) \
$(built_dex) \
- $(full_classes_stubs_jar)
-
+ $(full_classes_stubs_jar) \
+ $(java_source_list_file)
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
@@ -434,26 +440,64 @@
endif
endif
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
+# List of dependencies for anything that needs all java sources in place
+java_sources_deps := \
+ $(java_sources) \
+ $(java_resource_sources) \
+ $(RenderScript_file_stamp) \
+ $(proto_java_sources_file_stamp) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+$(java_source_list_file): $(java_sources_deps)
+ $(write-java-source-list)
+
+$(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): \
- $(java_sources) \
- $(java_resource_sources) \
- $(full_java_lib_deps) \
- $(jar_manifest_file) \
- $(layers_file) \
- $(RenderScript_file_stamp) \
- $(proto_java_sources_file_stamp) \
- $(annotation_processor_deps) \
- $(NORMALIZE_PATH) \
- $(JAR_ARGS) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- | $(SOONG_JAVAC_WRAPPER)
+ $(java_source_list_file) \
+ $(java_sources_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)
@@ -488,7 +532,7 @@
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
@@ -537,19 +581,22 @@
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)
@@ -594,6 +641,7 @@
# 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,
@@ -647,7 +695,7 @@
$(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
@@ -656,8 +704,6 @@
$(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)
@@ -758,12 +804,19 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(annotation_processor_flags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
-jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \
- $(common_proguard_flag_files) $(proguard_flag_files) \
- $(proto_java_sources_file_stamp) $(annotation_processor_deps) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
- $(NORMALIZE_PATH) $(JACK_DEFAULT_ARGS) $(JACK)
+jack_all_deps := \
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_jack_deps) \
+ $(jar_manifest_file) \
+ $(layers_file) \
+ $(common_proguard_flag_files) \
+ $(proguard_flag_files) \
+ $(annotation_processor_deps) \
+ $(LOCAL_JARJAR_RULES) \
+ $(NORMALIZE_PATH) \
+ $(JACK_DEFAULT_ARGS) \
+ $(JACK)
$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
@echo Checking build with Jack: $@
diff --git a/core/java_common.mk b/core/java_common.mk
index 4bdfdb1..17803f8 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -171,7 +171,13 @@
$(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)
@@ -183,6 +189,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/proto
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
@@ -197,18 +204,18 @@
# 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)
@@ -226,6 +233,7 @@
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))
@@ -235,11 +243,12 @@
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 :=
@@ -250,7 +259,10 @@
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
@@ -266,6 +278,7 @@
# 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
@@ -284,6 +297,7 @@
# 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
@@ -332,6 +346,7 @@
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)
diff --git a/core/java_library.mk b/core/java_library.mk
index 0aad84c..ea9874b 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -85,13 +85,16 @@
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
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 941afc6..a626dde 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -344,7 +344,9 @@
$(hide) touch $@
# Make sure the data-binding process happens before javac and generation of R.java.
-$(R_file_stamp) $(full_classes_compiled_jar) : $(data_binding_stamp)
+$(R_file_stamp): $(data_binding_stamp)
+$(java_source_list_file): $(data_binding_stamp)
+$(full_classes_compiled_jar): $(data_binding_stamp)
# The dependency path when jack is enabled
$(built_dex_intermediate) : $(data_binding_stamp)
endif # LOCAL_DATA_BINDING
@@ -434,26 +436,9 @@
# they want to use this module's R.java file.
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
-ifdef LOCAL_JACK_ENABLED
-ifneq ($(built_dex_intermediate),)
-$(built_dex_intermediate): $(R_file_stamp)
-endif
-ifneq ($(noshrob_classes_jack),)
-$(noshrob_classes_jack): $(R_file_stamp)
-endif
-ifneq ($(full_classes_jack),)
-$(full_classes_jack): $(R_file_stamp)
-$(jack_check_timestamp): $(R_file_stamp)
-endif
-endif # LOCAL_JACK_ENABLED
-
-ifneq ($(full_classes_jar),)
-# If full_classes_jar is non-empty, we're building sources.
-# If we're building sources, the initial javac step (which
-# produces full_classes_compiled_jar) needs to ensure the
-# R.java and Manifest.java files have been generated first.
-$(full_classes_compiled_jar): $(R_file_stamp)
-endif
+# The R.java file must exist by the time the java source
+# list is generated
+$(java_source_list_file): $(R_file_stamp)
endif # need_compile_res
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index de71111..5a0ac37 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -455,6 +455,7 @@
# 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) : $(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 @@
$(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))
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 9fcf194..ecda730 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -177,12 +177,14 @@
endif # LOCAL_USE_AAPT2
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
+$(java_source_list_file): $(R_file_stamp)
ifdef LOCAL_JACK_ENABLED
$(noshrob_classes_jack): $(R_file_stamp)
$(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
diff --git a/core/tasks/tools/build_custom_image.mk b/core/tasks/tools/build_custom_image.mk
index 719279c..370934b 100644
--- a/core/tasks/tools/build_custom_image.mk
+++ b/core/tasks/tools/build_custom_image.mk
@@ -62,12 +62,16 @@
$(eval my_image_copy_files += $(src))\
$(eval my_copy_pairs += $(src):$(my_staging_dir)/$(word 2,$(pair))))
-ifndef CUSTOM_IMAGE_AVB_KEY_PATH
-# If key path isn't specified, use the default signing args.
-my_avb_signing_args := $(INTERNAL_AVB_SIGNING_ARGS)
-else
-my_avb_signing_args := \
- --algorithm $(CUSTOM_IMAGE_AVB_ALGORITHM) --key $(CUSTOM_IMAGE_AVB_KEY_PATH)
+ifdef CUSTOM_IMAGE_AVB_KEY_PATH
+ifndef CUSTOM_IMAGE_AVB_ALGORITHM
+ $(error CUSTOM_IMAGE_AVB_ALGORITHM is not defined)
+endif
+ifndef CUSTOM_IMAGE_AVB_ROLLBACK_INDEX
+ $(error CUSTOM_IMAGE_AVB_ROLLBACK_INDEX is not defined)
+endif
+# set rollback_index via footer args
+CUSTOM_IMAGE_AVB_ADD_HASH_FOOTER_ARGS += --rollback_index $(CUSTOM_IMAGE_AVB_ROLLBACK_INDEX)
+CUSTOM_IMAGE_AVB_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(CUSTOM_IMAGE_AVB_ROLLBACK_INDEX)
endif
$(my_built_custom_image): PRIVATE_INTERMEDIATES := $(intermediates)
@@ -84,7 +88,8 @@
$(my_built_custom_image): PRIVATE_VERITY_BLOCK_DEVICE := $(CUSTOM_IMAGE_VERITY_BLOCK_DEVICE)
$(my_built_custom_image): PRIVATE_DICT_FILE := $(CUSTOM_IMAGE_DICT_FILE)
$(my_built_custom_image): PRIVATE_AVB_AVBTOOL := $(AVBTOOL)
-$(my_built_custom_image): PRIVATE_AVB_SIGNING_ARGS := $(my_avb_signing_args)
+$(my_built_custom_image): PRIVATE_AVB_KEY_PATH := $(CUSTOM_IMAGE_AVB_KEY_PATH)
+$(my_built_custom_image): PRIVATE_AVB_ALGORITHM:= $(CUSTOM_IMAGE_AVB_ALGORITHM)
$(my_built_custom_image): PRIVATE_AVB_HASH_ENABLE := $(CUSTOM_IMAGE_AVB_HASH_ENABLE)
$(my_built_custom_image): PRIVATE_AVB_ADD_HASH_FOOTER_ARGS := $(CUSTOM_IMAGE_AVB_ADD_HASH_FOOTER_ARGS)
$(my_built_custom_image): PRIVATE_AVB_HASHTREE_ENABLE := $(CUSTOM_IMAGE_AVB_HASHTREE_ENABLE)
@@ -131,7 +136,9 @@
$(if $(PRIVATE_SUPPORT_VERITY_FEC),\
$(hide) echo "verity_fec=$(PRIVATE_SUPPORT_VERITY_FEC)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt)
$(hide) echo "avb_avbtool=$(PRIVATE_AVB_AVBTOOL)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt
- $(hide) echo "avb_signing_args=$(PRIVATE_AVB_SIGNING_ARGS)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt
+ $(if $(PRIVATE_AVB_KEY_PATH),\
+ $(hide) echo "avb_key_path=$(PRIVATE_AVB_KEY_PATH)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\
+ echo "avb_algorithm=$(PRIVATE_AVB_ALGORITHM)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt)
$(if $(PRIVATE_AVB_HASH_ENABLE),\
$(hide) echo "avb_hash_enable=$(PRIVATE_AVB_HASH_ENABLE)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt;\
echo "avb_add_hash_footer_args=$(PRIVATE_AVB_ADD_HASH_FOOTER_ARGS)" >> $(PRIVATE_INTERMEDIATES)/image_info.txt)
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 3ca35c0..498d551 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -38,8 +38,8 @@
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
-DEFAULT_PLATFORM_VERSION := OPR1
-MIN_PLATFORM_VERSION := OPR1
+DEFAULT_PLATFORM_VERSION := PPR1
+MIN_PLATFORM_VERSION := PPR1
MAX_PLATFORM_VERSION := PPR1
ALLOWED_VERSIONS := $(call allowed-platform-versions,\
@@ -79,12 +79,10 @@
# When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION
# please add that PLATFORM_VERSION to the following text file:
# cts/tests/tests/os/assets/platform_versions.txt
-PLATFORM_VERSION.OPR1 := 8.0.0
PLATFORM_VERSION.PPR1 := P
# This is the current development code-name, if the build is not a final
# release build. If this is a final release build, it is simply "REL".
-PLATFORM_VERSION_CODENAME.OPR1 := REL
PLATFORM_VERSION_CODENAME.PPR1 := P
ifndef PLATFORM_VERSION
diff --git a/envsetup.sh b/envsetup.sh
index 4d1d67b..a8bef92 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1635,6 +1635,14 @@
"$ANDROID_PRODUCT_OUT/provision-device" "$@"
}
+function atest()
+{
+ # TODO (sbasi): Replace this to be a destination in the build out when & if
+ # atest is built by the build system. (This will be necessary if it ever
+ # depends on external pip projects).
+ "$(gettop)"/tools/tradefederation/core/atest/atest.py "$@"
+}
+
if [ "x$SHELL" != "x/bin/bash" ]; then
case `ps -o command -p $$` in
*bash*)
diff --git a/target/board/Android.mk b/target/board/Android.mk
index 331367f..5504c52 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -131,12 +131,17 @@
endif
# All kernel versions that the system image works with.
-$(GEN): test/vts-testcase/kernel/config/data/android-3.18/android-base.cfg
-$(GEN): test/vts-testcase/kernel/config/data/android-4.4/android-base.cfg
-$(GEN): test/vts-testcase/kernel/config/data/android-4.9/android-base.cfg
-$(GEN): PRIVATE_FLAGS += --kernel=3.18:test/vts-testcase/kernel/config/data/android-3.18/android-base.cfg
-$(GEN): PRIVATE_FLAGS += --kernel=4.4:test/vts-testcase/kernel/config/data/android-4.4/android-base.cfg
-$(GEN): PRIVATE_FLAGS += --kernel=4.9:test/vts-testcase/kernel/config/data/android-4.9/android-base.cfg
+KERNEL_VERSIONS := 3.18 4.4 4.9
+KERNEL_CONFIG_DATA := test/vts-testcase/kernel/config/data
+
+$(GEN): $(foreach version,$(KERNEL_VERSIONS),\
+ $(wildcard $(KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg))
+$(GEN): PRIVATE_FLAGS += $(foreach version,$(KERNEL_VERSIONS),\
+ --kernel=$(version):$(call normalize-path-list,\
+ $(wildcard $(KERNEL_CONFIG_DATA)/android-$(version)/android-base*.cfg)))
+
+KERNEL_VERSIONS :=
+KERNEL_CONFIG_DATA :=
$(GEN): $(FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(HOST_OUT_EXECUTABLES)/assemble_vintf
# TODO(b/37405869) (b/37715375) inject avb versions as well for devices that have avb enabled.
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index ef15bbd..e6d741a 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -35,11 +35,11 @@
# platforms.
#
# If you're building a 64 bit platform (and not an application) the
-# ARM-v8 specification allows you to assume NEON and all the features
-# available in a cortex-A15 CPU. You should be able to set :
+# ARM-v8 specification allows you to assume all the features available in an
+# armv7-a-neon CPU. You should set the following as 2nd arch/cpu variant:
#
-# TARGET_2ND_ARCH_VARIANT := armv7-a-neon
-# TARGET_2ND_CPU_VARIANT := cortex-a15
+# TARGET_2ND_ARCH_VARIANT := armv8-a
+# TARGET_2ND_CPU_VARIANT := generic
#
# DO NOT USE
# DO NOT USE
@@ -50,8 +50,8 @@
# DO NOT USE
# DO NOT USE
else
-TARGET_2ND_ARCH_VARIANT := armv7-a-neon
-TARGET_2ND_CPU_VARIANT := cortex-a15
+TARGET_2ND_ARCH_VARIANT := armv8-a
+TARGET_2ND_CPU_VARIANT := generic
endif
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index ce57f62..789fefe 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -251,15 +251,16 @@
else:
d["fstab"] = None
- d["build.prop"] = LoadBuildProp(read_helper)
+ d["build.prop"] = LoadBuildProp(read_helper, 'SYSTEM/build.prop')
+ d["vendor.build.prop"] = LoadBuildProp(read_helper, 'VENDOR/build.prop')
return d
-def LoadBuildProp(read_helper):
+def LoadBuildProp(read_helper, prop_file):
try:
- data = read_helper("SYSTEM/build.prop")
+ data = read_helper(prop_file)
except KeyError:
- print("Warning: could not find SYSTEM/build.prop in %s" % (zip,))
+ print("Warning: could not read %s" % (prop_file,))
data = ""
return LoadDictionaryFromLines(data.split("\n"))
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 1b0f68b..a9e1606 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -275,6 +275,11 @@
return False
+def HasTrebleEnabled(target_files_zip, info_dict):
+ return (HasVendorPartition(target_files_zip) and
+ GetBuildProp("ro.treble.enabled", info_dict) == "true")
+
+
def GetOemProperty(name, oem_props, oem_dict, info_dict):
if oem_props is not None and name in oem_props:
return oem_dict[name]
@@ -316,57 +321,93 @@
return sparse_img.SparseImage(path, mappath, clobbered_blocks)
-def AddCompatibilityArchive(target_zip, output_zip, system_included=True,
- vendor_included=True):
- """Adds compatibility info from target files into the output zip.
+def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip,
+ target_info_dict,
+ source_info_dict=None):
+ """Adds compatibility info into the output zip if it's Treble-enabled target.
Metadata used for on-device compatibility verification is retrieved from
target_zip then added to compatibility.zip which is added to the output_zip
archive.
- Compatibility archive should only be included for devices with a vendor
- partition as checking provides value when system and vendor are independently
- versioned.
+ Compatibility archive should only be included for devices that have enabled
+ Treble support.
Args:
target_zip: Zip file containing the source files to be included for OTA.
output_zip: Zip file that will be sent for OTA.
- system_included: If True, the system image will be updated and therefore
- its metadata should be included.
- vendor_included: If True, the vendor image will be updated and therefore
- its metadata should be included.
+ target_info_dict: The dict that holds the target build info.
+ source_info_dict: The dict that holds the source build info, if generating
+ an incremental OTA; None otherwise.
"""
- # Determine what metadata we need. Files are names relative to META/.
- compatibility_files = []
- vendor_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
- system_metadata = ("system_manifest.xml", "system_matrix.xml")
- if vendor_included:
- compatibility_files += vendor_metadata
- if system_included:
- compatibility_files += system_metadata
+ def AddCompatibilityArchive(system_updated, vendor_updated):
+ """Adds compatibility info based on system/vendor update status.
- # Create new archive.
- compatibility_archive = tempfile.NamedTemporaryFile()
- compatibility_archive_zip = zipfile.ZipFile(compatibility_archive, "w",
- compression=zipfile.ZIP_DEFLATED)
+ Args:
+ system_updated: If True, the system image will be updated and therefore
+ its metadata should be included.
+ vendor_updated: If True, the vendor image will be updated and therefore
+ its metadata should be included.
+ """
+ # Determine what metadata we need. Files are names relative to META/.
+ compatibility_files = []
+ vendor_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
+ system_metadata = ("system_manifest.xml", "system_matrix.xml")
+ if vendor_updated:
+ compatibility_files += vendor_metadata
+ if system_updated:
+ compatibility_files += system_metadata
- # Add metadata.
- for file_name in compatibility_files:
- target_file_name = "META/" + file_name
+ # Create new archive.
+ compatibility_archive = tempfile.NamedTemporaryFile()
+ compatibility_archive_zip = zipfile.ZipFile(compatibility_archive, "w",
+ compression=zipfile.ZIP_DEFLATED)
- if target_file_name in target_zip.namelist():
- data = target_zip.read(target_file_name)
- common.ZipWriteStr(compatibility_archive_zip, file_name, data)
+ # Add metadata.
+ for file_name in compatibility_files:
+ target_file_name = "META/" + file_name
- # Ensure files are written before we copy into output_zip.
- compatibility_archive_zip.close()
+ if target_file_name in target_zip.namelist():
+ data = target_zip.read(target_file_name)
+ common.ZipWriteStr(compatibility_archive_zip, file_name, data)
- # Only add the archive if we have any compatibility info.
- if compatibility_archive_zip.namelist():
- common.ZipWrite(output_zip, compatibility_archive.name,
- arcname="compatibility.zip",
- compress_type=zipfile.ZIP_STORED)
+ # Ensure files are written before we copy into output_zip.
+ compatibility_archive_zip.close()
+
+ # Only add the archive if we have any compatibility info.
+ if compatibility_archive_zip.namelist():
+ common.ZipWrite(output_zip, compatibility_archive.name,
+ arcname="compatibility.zip",
+ compress_type=zipfile.ZIP_STORED)
+
+ # Will only proceed if the target has enabled the Treble support (as well as
+ # having a /vendor partition).
+ if not HasTrebleEnabled(target_zip, target_info_dict):
+ return
+
+ # We don't support OEM thumbprint in Treble world (which calculates
+ # fingerprints in a different way as shown in CalculateFingerprint()).
+ assert not target_info_dict.get("oem_fingerprint_properties")
+
+ # Full OTA carries the info for system/vendor both.
+ if source_info_dict is None:
+ AddCompatibilityArchive(True, True)
+ return
+
+ assert not source_info_dict.get("oem_fingerprint_properties")
+
+ source_fp = GetBuildProp("ro.build.fingerprint", source_info_dict)
+ target_fp = GetBuildProp("ro.build.fingerprint", target_info_dict)
+ system_updated = source_fp != target_fp
+
+ source_fp_vendor = GetVendorBuildProp("ro.vendor.build.fingerprint",
+ source_info_dict)
+ target_fp_vendor = GetVendorBuildProp("ro.vendor.build.fingerprint",
+ target_info_dict)
+ vendor_updated = source_fp_vendor != target_fp_vendor
+
+ AddCompatibilityArchive(system_updated, vendor_updated)
def WriteFullOTAPackage(input_zip, output_zip):
@@ -470,11 +511,6 @@
if HasVendorPartition(input_zip):
system_progress -= 0.1
- # Place a copy of file_contexts.bin into the OTA package which will be used
- # by the recovery program.
- if "selinux_fc" in OPTIONS.info_dict:
- WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip)
-
recovery_mount_options = OPTIONS.info_dict.get("recovery_mount_options")
script.ShowProgress(system_progress, 0)
@@ -499,6 +535,9 @@
vendor_diff = common.BlockDifference("vendor", vendor_tgt)
vendor_diff.WriteScript(script, output_zip)
+ AddCompatibilityArchiveIfTrebleEnabled(input_zip, output_zip,
+ OPTIONS.info_dict)
+
common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict)
common.ZipWriteStr(output_zip, "boot.img", boot_img.data)
@@ -540,10 +579,6 @@
WriteMetadata(metadata, output_zip)
-def WritePolicyConfig(file_name, output_zip):
- common.ZipWrite(output_zip, file_name, os.path.basename(file_name))
-
-
def WriteMetadata(metadata, output_zip):
value = "".join(["%s=%s\n" % kv for kv in sorted(metadata.iteritems())])
common.ZipWriteStr(output_zip, METADATA_NAME, value,
@@ -551,13 +586,22 @@
def GetBuildProp(prop, info_dict):
- """Return the fingerprint of the build of a given target-files info_dict."""
+ """Returns the inquired build property from a given info_dict."""
try:
return info_dict.get("build.prop", {})[prop]
except KeyError:
raise common.ExternalError("couldn't find %s in build.prop" % (prop,))
+def GetVendorBuildProp(prop, info_dict):
+ """Returns the inquired vendor build property from a given info_dict."""
+ try:
+ return info_dict.get("vendor.build.prop", {})[prop]
+ except KeyError:
+ raise common.ExternalError(
+ "couldn't find %s in vendor.build.prop" % (prop,))
+
+
def HandleDowngradeMetadata(metadata):
# Only incremental OTAs are allowed to reach here.
assert OPTIONS.incremental_source is not None
@@ -688,6 +732,10 @@
else:
vendor_diff = None
+ AddCompatibilityArchiveIfTrebleEnabled(
+ target_zip, output_zip, OPTIONS.target_info_dict,
+ OPTIONS.source_info_dict)
+
AppendAssertions(script, OPTIONS.target_info_dict, oem_dicts)
device_specific.IncrementalOTA_Assertions()
@@ -1178,32 +1226,13 @@
else:
print("Warning: cannot find care map file in target_file package")
- if HasVendorPartition(target_zip):
- update_vendor = True
- update_system = True
+ # OPTIONS.source_info_dict must be None for incrementals.
+ if source_file is None:
+ assert OPTIONS.source_info_dict is None
- # If incremental then figure out what is being updated so metadata only for
- # the updated image is included.
- if source_file is not None:
- input_tmp, input_zip = common.UnzipTemp(
- target_file, UNZIP_PATTERN)
- source_tmp, source_zip = common.UnzipTemp(
- source_file, UNZIP_PATTERN)
+ AddCompatibilityArchiveIfTrebleEnabled(
+ target_zip, output_zip, OPTIONS.info_dict, OPTIONS.source_info_dict)
- vendor_src = GetImage("vendor", source_tmp)
- vendor_tgt = GetImage("vendor", input_tmp)
- system_src = GetImage("system", source_tmp)
- system_tgt = GetImage("system", input_tmp)
-
- update_system = system_src.TotalSha1() != system_tgt.TotalSha1()
- update_vendor = vendor_src.TotalSha1() != vendor_tgt.TotalSha1()
-
- input_zip.close()
- source_zip.close()
-
- target_zip = zipfile.ZipFile(target_file, "r")
- AddCompatibilityArchive(target_zip, output_zip, update_system,
- update_vendor)
common.ZipClose(target_zip)
# Write the current metadata entry with placeholders.