Merge "Build support for 32-bit armv8-a"
diff --git a/Android.mk b/Android.mk
index a1455d4..5053e7d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,8 +1 @@
-LOCAL_PATH := $(call my-dir)
-
-# We're relocating the build project to a subdirectory, then using symlinks
-# to expose the subdirectories where they used to be. If the manifest hasn't
-# been updated, we need to include all the subdirectories.
-ifeq ($(LOCAL_PATH),build)
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
+include $(call all-subdir-makefiles)
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..004210b
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,85 @@
+Android build system usage:
+
+m [-j] [<targets>] [<variable>=<value>...]
+
+
+Ways to specify what to build:
+ The common way to specify what to build is to set that information in the
+ environment via:
+
+ # Set up the shell environment.
+ source build/envsetup.sh # Run "hmm" after sourcing for more info
+ # Select the device and variant to target. If no argument is given, it
+ # will list choices and prompt.
+ lunch [<product>-<variant>] # Selects the device and variant to target.
+ # Invoke the configured build.
+ m [<options>] [<targets>] [<variable>=<value>...]
+
+ <product> is the device that the created image is intended to be run on.
+ This is saved in the shell environment as $TARGET_PRODUCT by `lunch`.
+ <variant> is one of "user", "userdebug", or "eng", and controls the
+ amount of debugging to be added into the generated image.
+ This gets saved in the shell environment as $TARGET_BUILD_VARIANT by
+ `lunch`.
+
+ Each of <options>, <targets>, and <variable>=<value> is optional.
+ If no targets are specified, the build system will build the images
+ for the configured product and variant.
+
+ An alternative to setting $TARGET_PRODUCT and $TARGET_BUILD_VARIANT,
+ which you may see in build servers, is to execute:
+
+ make PRODUCT-<product>-<variant>
+
+
+ A target may be a file path. For example, out/host/linux-x86/bin/adb .
+ Note that when giving a relative file path as a target, that path is
+ interpreted relative to the root of the source tree (rather than relative
+ to the current working directory).
+
+ A target may also be any other target defined within a Makefile. Run
+ `m help` to view the names of some common targets.
+
+ To view the modules and targets defined in a particular directory, look for:
+ files named *.mk (most commonly Android.mk)
+ these files are defined in Make syntax
+ files named Android.bp
+ these files are defined in Blueprint syntax
+
+ For now, the full (extremely large) compiled list of targets can be found
+ (after running the build once), split among these two files:
+
+ ${OUT}/build-<product>*.ninja
+ ${OUT}/soong/build.ninja
+
+ If you find yourself interacting with these files, you are encouraged to
+ provide a more convenient tool for browsing targets, and to mention the
+ tool here.
+
+Targets that adjust an existing build:
+ showcommands Display the individual commands run to implement
+ the build
+ dist Copy into ${DIST_DIR} the portion of the build
+ that must be distributed
+
+Flags
+ -j <N> Run <N> processes at once
+ -j Autodetect the number of processes to run at once,
+ and run that many
+
+Variables
+ Variables can either be set in the surrounding shell environment or can be
+ passed as command-line arguments. For example:
+ export I_AM_A_SHELL_VAR=1
+ I_AM_ANOTHER_SHELL_VAR=2 make droid I_AM_A_MAKE_VAR=3
+ Here are some common variables and their meanings:
+ TARGET_PRODUCT The <product> to build # as described above
+ TARGET_BUILD_VARIANT The <variant> to build # as described above
+ DIST_DIR The directory in which to place the distribution
+ artifacts.
+ OUT_DIR The directory in which to place non-distribution
+ artifacts.
+
+ There is not yet known a convenient method by which to discover the full
+ list of supported variables. Please mention it here when there is.
+
diff --git a/core/Makefile b/core/Makefile
index fae81a4..4972b36 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -196,7 +196,7 @@
# if it isn't already a part of the flavor (via a dedicated lunch
# config for example).
TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
-ifdef SANITIZE_TARGET
+ifneq (, $(filter address, $(SANITIZE_TARGET)))
ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
endif
@@ -967,6 +967,23 @@
$(if $(2),$(hide) $(foreach kv,$(2),echo "$(kv)" >> $(1);))
endef
+# $(1): modules list
+# $(2): output dir
+# $(3): mount point
+# $(4): staging dir
+# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
+define build-image-kernel-modules
+ $(hide) rm -rf $(2)/lib/modules
+ $(hide) mkdir -p $(2)/lib/modules
+ $(hide) cp $(1) $(2)/lib/modules/
+ $(hide) rm -rf $(4)
+ $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
+ $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
+ $(hide) $(DEPMOD) -b $(4) 0.0
+ $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
+ $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
+endef
+
# -----------------------------------------------------------------
# Recovery image
@@ -1097,23 +1114,6 @@
RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
-# $(1): modules list
-# $(2): output dir
-# $(3): mount point
-# $(4): staging dir
-# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
-define build-image-kernel-modules
- $(hide) rm -rf $(2)/lib/modules
- $(hide) mkdir -p $(2)/lib/modules
- $(hide) cp $(1) $(2)/lib/modules/
- $(hide) rm -rf $(4)
- $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
- $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
- $(hide) $(DEPMOD) -b $(4) 0.0
- $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
- $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
-endef
-
# $(1): output file
define build-recoveryimage-target
@echo ----- Making recovery image ------
diff --git a/core/binary.mk b/core/binary.mk
index 6d6b6a9..ec3b83c 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -53,6 +53,7 @@
my_cc := $(LOCAL_CC)
my_cc_wrapper := $(CC_WRAPPER)
my_cxx := $(LOCAL_CXX)
+my_cxx_ldlibs :=
my_cxx_wrapper := $(CXX_WRAPPER)
my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
@@ -104,7 +105,7 @@
ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
my_min_sdk_version := 21
else
- my_min_sdk_version := 9
+ my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
endif
# Historically we've just set up a bunch of symlinks in prebuilts/ndk to map
@@ -447,7 +448,10 @@
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
my_header_libraries := $(LOCAL_HEADER_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_HEADER_LIBRARIES_$(my_32_64_bit_suffix)) $(my_header_libraries)
+# soong defined modules already have done through this
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
+endif
# Add static HAL libraries
ifdef LOCAL_HAL_STATIC_LIBRARIES
diff --git a/core/clang/config.mk b/core/clang/config.mk
index be43a26..d41c17f 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -72,6 +72,7 @@
# INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS is defined later in other config.mk.
LOCAL_CLANG_EXCEPTION_PROJECTS = \
bionic/tests/ \
+ device/google/contexthub/ \
device/huawei/angler/ \
device/lge/bullhead/ \
external/gentoo/integration/ \
diff --git a/core/cleanspec.mk b/core/cleanspec.mk
index 4441e2a..af28954 100644
--- a/core/cleanspec.mk
+++ b/core/cleanspec.mk
@@ -64,6 +64,6 @@
# ************************************************
subdir_cleanspecs := \
- $(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) . CleanSpec.mk)
+ $(file <$(OUT_DIR)/.module_paths/CleanSpec.mk.list)
include $(subdir_cleanspecs)
subdir_cleanspecs :=
diff --git a/core/definitions.mk b/core/definitions.mk
index a36b34c..fcf4fa3 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2176,6 +2176,7 @@
exit 1; \
fi; \
unzip -qo $$f -d $(2); \
+ rm -f $(2)/module-info.class; \
done
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(2)/META-INF)
endef
@@ -2186,6 +2187,17 @@
JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JACK) $(DEFAULT_JACK_EXTRA_ARGS)
endef
+# Return jar arguments to compress files in a given directory
+# $(1): directory
+#
+# Returns an @-file argument that contains the output of a subshell
+# that looks like -C $(1) path/to/file1 -C $(1) path/to/file2
+# Also adds "-C out/empty ." which avoids errors in jar when
+# there are no files in the directory.
+define jar-args-sorted-files-in-directory
+ @<(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:
@@ -2243,9 +2255,9 @@
$(if $(PRIVATE_JAR_MANIFEST), \
$(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf && \
- $(JAR) -cfm $@ $(dir $@)/manifest.mf \
- -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
- $(hide) $(JAR) -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
+ $(JAR) -cfm $@ $(dir $@)/manifest.mf, \
+ $(hide) $(JAR) -cf $@) \
+ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR))
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
endef
@@ -2515,7 +2527,7 @@
$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
endef
-define desugar-classpath
+define desugar-bootclasspath
$(filter-out -classpath -bootclasspath "",$(subst :,$(space),$(1)))
endef
@@ -2684,20 +2696,27 @@
fi
endef
+# Add resources (non .class files) from a jar to a package
+# $(1): the package file
+# $(2): the jar file
+# $(3): temporary directory
+define add-jar-resources-to-package
+ rm -rf $(3)
+ mkdir -p $(3)
+ unzip -qo $(2) -d $(3) $$(zipinfo -1 $(2) | grep -v -E "\.class$$")
+ $(JAR) uf $(1) $(call jar-args-sorted-files-in-directory,$(3))
+endef
+
# Sign a package using the specified key/cert.
#
define sign-package
$(call sign-package-arg,$@)
endef
-# signapk uses internal APIs from sun.security.{pkcs,x509}; see http://b/37137869
# $(1): the package file we are signing.
define sign-package-arg
$(hide) mv $(1) $(1).unsigned
-$(hide) $(JAVA) -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) \
- $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports java.base/sun.security.pkcs=ALL-UNNAMED,) \
- $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports java.base/sun.security.x509=ALL-UNNAMED,) \
- -jar $(SIGNAPK_JAR) \
+$(hide) $(JAVA) -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) -jar $(SIGNAPK_JAR) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) \
$(PRIVATE_ADDITIONAL_CERTIFICATES) $(1).unsigned $(1).signed
$(hide) mv $(1).signed $(1)
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 47fdba6..aa11d15 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -11,9 +11,9 @@
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
endif
-# Pass special classpath to skip uses library check.
+# Pass special class loader context to skip the classpath and collision check.
# Should modify build system to pass used libraries properly later.
-DEX2OAT_CLASSPATH := "&"
+DEX2OAT_CLASS_LOADER_CONTEXT := "&"
DEX2OAT_DEPENDENCY += $(DEX2OAT)
@@ -25,6 +25,10 @@
COMPILED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
+# Use the first dirty-image-objects file in PRODUCT_COPY_FILES.
+DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \
+ $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES))))
+
define get-product-default-property
$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
endef
@@ -146,7 +150,7 @@
$(hide) mkdir -p $(dir $(2))
$(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
- --runtime-arg -classpath --runtime-arg $(DEX2OAT_CLASSPATH) \
+ --class-loader-context=$(DEX2OAT_CLASS_LOADER_CONTEXT) \
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
--dex-file=$(1) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 6e49f64..d728118 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -37,6 +37,12 @@
COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES)
endif
+# If we have a dirty-image-objects file, create a parameter.
+DIRTY_IMAGE_OBJECTS_FLAGS :=
+ifneq ($(DIRTY_IMAGE_OBJECTS),)
+ DIRTY_IMAGE_OBJECTS_FLAGS := --dirty-image-objects=$(DIRTY_IMAGE_OBJECTS)
+endif
+
# The rule to install boot.art
# Depends on installed boot.oat, boot-*.art, boot-*.oat
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES)
@@ -53,6 +59,7 @@
ifeq (,$(my_out_boot_image_profile_location))
my_boot_image_flags := $(COMPILED_CLASSES_FLAGS)
my_boot_image_flags += --image-classes=$(PRELOADED_CLASSES)
+my_boot_image_flags += $(DIRTY_IMAGE_OBJECTS_FLAGS)
else
my_boot_image_flags := --compiler-filter=speed-profile
my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
@@ -61,7 +68,7 @@
$($(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
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DEX2OAT_DEPENDENCY) $(my_out_profile_location)
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_profile_location)
@echo "target dex2oat: $@"
@mkdir -p $(dir $@)
@mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
diff --git a/core/help.mk b/core/help.mk
deleted file mode 100644
index c034e79..0000000
--- a/core/help.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-.PHONY: help
-help:
- @echo
- @echo "Common make targets:"
- @echo "----------------------------------------------------------------------------------"
- @echo "droid Default target"
- @echo "clean (aka clobber) equivalent to rm -rf out/"
- @echo "snod Quickly rebuild the system image from built packages"
- @echo "vnod Quickly rebuild the vendor image from built packages"
- @echo "offline-sdk-docs Generate the HTML for the developer SDK docs"
- @echo "doc-comment-check-docs Check HTML doc links & validity, without generating HTML"
- @echo "libandroid_runtime All the JNI framework stuff"
- @echo "framework All the java framework stuff"
- @echo "services The system server (Java) and friends"
- @echo "help You're reading it right now"
-
-.PHONY: out
-out:
- @echo "I'm sure you're nice and all, but no thanks."
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 4f3069f..0aabd51 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -98,6 +98,7 @@
$(proto_java_sources_file_stamp) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(SOONG_JAVAC_WRAPPER)
$(transform-host-java-to-package)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index a68be6a..033297a 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -71,6 +71,7 @@
$(proto_java_sources_file_stamp) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
$(ZIPTIME) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(SOONG_JAVAC_WRAPPER)
diff --git a/core/jacoco.mk b/core/jacoco.mk
index a04d25e..f4788bf 100644
--- a/core/jacoco.mk
+++ b/core/jacoco.mk
@@ -120,12 +120,13 @@
$(LOCAL_FULL_CLASSES_JACOCO_JAR): PRIVATE_TEMP_JAR_PATH := $(my_temp_jar_path)
$(LOCAL_FULL_CLASSES_JACOCO_JAR): PRIVATE_INSTRUMENTED_PATH := $(my_instrumented_path)
$(LOCAL_FULL_CLASSES_JACOCO_JAR): PRIVATE_FULL_CLASSES_PRE_JACOCO_JAR := $(LOCAL_FULL_CLASSES_PRE_JACOCO_JAR)
+$(LOCAL_FULL_CLASSES_JACOCO_JAR): $(JAR_ARGS)
$(LOCAL_FULL_CLASSES_JACOCO_JAR): $(my_instrumented_timestamp_path) $(LOCAL_FULL_CLASSES_PRE_JACOCO_JAR)
rm -f $@ $(PRIVATE_TEMP_JAR_PATH)
# copy the pre-jacoco jar (containing files excluded from instrumentation)
cp $(PRIVATE_FULL_CLASSES_PRE_JACOCO_JAR) $(PRIVATE_TEMP_JAR_PATH)
# copy instrumented files back into the resultant jar
- $(JAR) -uf $(PRIVATE_TEMP_JAR_PATH) -C $(PRIVATE_INSTRUMENTED_PATH) .
+ $(JAR) -uf $(PRIVATE_TEMP_JAR_PATH) $(call jar-args-sorted-files-in-directory,$(PRIVATE_INSTRUMENTED_PATH))
mv $(PRIVATE_TEMP_JAR_PATH) $@
# this is used to trigger $(my_classes_to_report_on_path) to build
diff --git a/core/java.mk b/core/java.mk
index c457bd8..8cc6fe6 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -445,6 +445,7 @@
$(proto_java_sources_file_stamp) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(SOONG_JAVAC_WRAPPER)
$(transform-java-to-classes.jar)
diff --git a/core/main.mk b/core/main.mk
index ef690e0..01646de 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -70,6 +70,10 @@
DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE)
endif
+# Make an empty directory, which can be used to make empty jars
+EMPTY_DIRECTORY := $(OUT_DIR)/empty
+$(shell mkdir -p $(EMPTY_DIRECTORY) && rm -rf $(EMPTY_DIRECTORY)/*)
+
# CTS-specific config.
-include cts/build/config.mk
# VTS-specific config.
@@ -403,7 +407,7 @@
# Include all of the makefiles in the system
#
-subdir_makefiles := $(SOONG_ANDROID_MK) $(call first-makefiles-under,$(TOP))
+subdir_makefiles := $(SOONG_ANDROID_MK) $(file <$(OUT_DIR)/.module_paths/Android.mk.list)
subdir_makefiles_total := $(words $(subdir_makefiles))
.KATI_READONLY := subdir_makefiles_total
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 89d3b34..ec211f3 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -548,8 +548,12 @@
$(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
endif
+
$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
+$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
+$(LOCAL_BUILT_MODULE): PRIVATE_FULL_CLASSES_JAR := $(full_classes_jar)
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
+$(LOCAL_BUILT_MODULE) : $(JAR_ARGS)
ifdef LOCAL_USE_AAPT2
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
@@ -577,6 +581,11 @@
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else # full_classes_jar
$(add-dex-to-package)
+ifdef LOCAL_USE_AAPT2
+ifndef LOCAL_JACK_ENABLED
+ $(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
+endif
+endif
endif # full_classes_jar
ifdef LOCAL_JACK_ENABLED
$(add-carried-jack-resources)
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index db64a8d..9fcf194 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -70,7 +70,7 @@
proguard_options_file :=
-ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
+ifneq ($(filter custom,$(LOCAL_PROGUARD_ENABLED)),custom)
proguard_options_file := $(intermediates.COMMON)/proguard_options
endif
@@ -184,14 +184,23 @@
endif # LOCAL_JACK_ENABLED
$(full_classes_compiled_jar): $(R_file_stamp)
+
+# if we have custom proguarding done use the proguarded classes jar instead of the normal classes jar
+ifeq ($(filter custom,$(LOCAL_PROGUARD_ENABLED)),custom)
+aar_classes_jar = $(full_classes_proguard_jar)
+else
+aar_classes_jar = $(full_classes_jar)
+endif
+
# Rule to build AAR, archive including classes.jar, resource, etc.
built_aar := $(intermediates.COMMON)/javalib.aar
$(built_aar): PRIVATE_MODULE := $(LOCAL_MODULE)
$(built_aar): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
-$(built_aar): PRIVATE_CLASSES_JAR := $(full_classes_jar)
+$(built_aar): PRIVATE_CLASSES_JAR := $(aar_classes_jar)
$(built_aar): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(built_aar): PRIVATE_R_TXT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.txt
-$(built_aar) : $(full_classes_jar) $(full_android_manifest)
+$(built_aar): $(JAR_ARGS)
+$(built_aar) : $(aar_classes_jar) $(full_android_manifest)
@echo "target AAR: $(PRIVATE_MODULE) ($@)"
$(hide) rm -rf $(dir $@)aar && mkdir -p $(dir $@)aar/res
$(hide) cp $(PRIVATE_ANDROID_MANIFEST) $(dir $@)aar/AndroidManifest.xml
@@ -200,12 +209,13 @@
$(hide) $(foreach res,$(PRIVATE_RESOURCE_DIR),cp -Rfn $(res)/* $(dir $@)aar/res;)
$(hide) cp $(PRIVATE_R_TXT) $(dir $@)aar/R.txt
$(hide) $(JAR) -cMf $@ \
- -C $(dir $@)aar .
+ $(call jar-args-sorted-files-in-directory,$(dir $@)aar)
# Register the aar file.
ALL_MODULES.$(LOCAL_MODULE).AAR := $(built_aar)
endif # need_compile_res
# Reset internal variables.
+aar_classes_jar :=
all_res_assets :=
LOCAL_IS_STATIC_JAVA_LIBRARY :=
diff --git a/envsetup.sh b/envsetup.sh
index ae65832..55167c0 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1,7 +1,13 @@
function hmm() {
cat <<EOF
+
+Run "m help" for help with the build system itself.
+
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
+ Selects <product_name> as the product to build, and <build_variant> as the variant to
+ build, and stores those selections in the environment to be read by subsequent
+ invocations of 'm' etc.
- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
diff --git a/help.sh b/help.sh
new file mode 100755
index 0000000..c031dcc
--- /dev/null
+++ b/help.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+# locate some directories
+cd "$(dirname $0)"
+SCRIPT_DIR="${PWD}"
+cd ../..
+TOP="${PWD}"
+
+message='The basic Android build process is:
+
+cd '"${TOP}"'
+source build/envsetup.sh # Add "lunch" (and other utilities and variables)
+ # to the shell environment.
+lunch [<product>-<variant>] # Choose the device to target.
+m -j [<goals>] # Execute the configured build.
+
+Usage of "m" imitates usage of the program "make".
+See '"${SCRIPT_DIR}"'/README.txt for more info about build usage and concepts.
+
+Common goals are:
+
+ clean (aka clobber) equivalent to rm -rf out/
+ checkbuild Build every module defined in the source tree
+ droid Default target
+ nothing Do not build anything, just parse and validate the build structure
+
+ java Build all the java code in the source tree
+ native Build all the native code in the source tree
+
+ host Build all the host code (not to be run on a device) in the source tree
+ target Build all the target code (to be run on the device) in the source tree
+
+ (java|native)-(host|target)
+ (host|target)-(java|native)
+ Build the intersection of the two given arguments
+
+ snod Quickly rebuild the system image from built packages
+ Stands for "System, NO Dependencies"
+ vnod Quickly rebuild the vendor image from built packages
+ Stands for "Vendor, NO Dependencies"
+
+
+So, for example, you could run:
+
+cd '"${TOP}"'
+source build/envsetup.sh
+lunch aosp_arm-userdebug
+m -j java
+
+to build all of the java code for the userdebug variant of the aosp_arm device.
+'
+
+echo "$message"
diff --git a/target/Android.mk b/target/Android.mk
new file mode 100644
index 0000000..9929b00
--- /dev/null
+++ b/target/Android.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# Only if this Android.mk was included not by a symlink should it be used.
+# This facilitates the transition away from symlinks: b/64397960
+ifeq ($(LOCAL_PATH),build/make/target)
+include $(call first-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/target/product/base.mk b/target/product/base.mk
index 89027bf..3f50731 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -132,6 +132,7 @@
# Packages included only for eng or userdebug builds, previously debug tagged
PRODUCT_PACKAGES_DEBUG := \
+ logpersist.start \
perfprofd \
sqlite3
@@ -143,5 +144,9 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/compiled-classes:system/etc/compiled-classes)
+# Note: it is acceptable to not have a dirty-image-objects file. In that case, the special bin
+# for known dirty objects in the image will be empty.
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
+ frameworks/base/dirty-image-objects:system/etc/dirty-image-objects)
$(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk)
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index da56d3a..c28e669 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -107,7 +107,8 @@
PRODUCT_SYSTEM_SERVER_JARS := \
services \
ethernet-service \
- wifi-service
+ wifi-service \
+ com.android.location.provider \
# The set of packages whose code can be loaded by the system server.
PRODUCT_SYSTEM_SERVER_APPS += \
@@ -136,6 +137,10 @@
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/compiled-classes-phone:system/etc/compiled-classes)
+# Enable dirty image object binning to reduce dirty pages in the image.
+PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
+ frameworks/base/dirty-image-objects-phone:system/etc/dirty-image-objects)
+
# On userdebug builds, collect more tombstones by default.
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
diff --git a/target/product/vndk/Android.mk b/target/product/vndk/Android.mk
new file mode 100644
index 0000000..20e8436
--- /dev/null
+++ b/target/product/vndk/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := vndk_package
+LOCAL_REQUIRED_MODULES := \
+ $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \
+ $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \
+ $(LLNDK_LIBRARIES)
+
+include $(BUILD_PHONY_PACKAGE)
diff --git a/tools/Android.mk b/tools/Android.mk
index 9073ac3..c05d681 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -16,4 +16,8 @@
LOCAL_PATH := $(call my-dir)
+# Only if this Android.mk was included not by a symlink should it be used.
+# This facilitates the transition away from symlinks: b/64397960
+ifeq ($(LOCAL_PATH),build/make/tools)
include $(call all-makefiles-under,$(LOCAL_PATH))
+endif