Merge "Remove unnecessary inheritance layer between aliases."
diff --git a/core/Makefile b/core/Makefile
index 237d5d1..c930708 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1459,7 +1459,6 @@
# We can't build static executables when SANITIZE_TARGET=address
ifeq ($(strip $(SANITIZE_TARGET)),)
built_ota_tools += \
- $(call intermediates-dir-for,EXECUTABLES,check_prereq,,,$(TARGET_PREFER_32_BIT))/check_prereq \
$(call intermediates-dir-for,EXECUTABLES,applypatch_static,,,$(TARGET_PREFER_32_BIT))/applypatch_static \
$(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
endif
@@ -1630,6 +1629,9 @@
$(hide) for part in $(AB_OTA_PARTITIONS); do \
echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
done
+ $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
+ echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
+ done
@# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
$(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
ifdef OSRELEASED_DIRECTORY
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 03e8dd5..00815e4 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -1,7 +1,8 @@
## Clang configurations.
LLVM_PREBUILTS_VERSION := 3.8
-LLVM_PREBUILTS_PATH := prebuilts/clang/host/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin
+LLVM_PREBUILTS_BASE := prebuilts/clang/host
+LLVM_PREBUILTS_PATH := $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin
LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_PATH)/../lib/clang/$(LLVM_PREBUILTS_VERSION)/lib/linux/
CLANG := $(LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
diff --git a/core/combo/HOST_CROSS_windows-x86.mk b/core/combo/HOST_CROSS_windows-x86.mk
index c2a65bc..1ac1059 100644
--- a/core/combo/HOST_CROSS_windows-x86.mk
+++ b/core/combo/HOST_CROSS_windows-x86.mk
@@ -32,8 +32,8 @@
$(combo_var_prefix)GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
# Use C99-compliant printf functions (%zd).
$(combo_var_prefix)GLOBAL_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
-# Admit to using >= Win2K.
-$(combo_var_prefix)GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0500
+# Admit to using >= Win2K. Both are needed because of <_mingw.h>.
+$(combo_var_prefix)GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0500 -DWINVER=0x0500
# Get 64-bit off_t and related functions.
$(combo_var_prefix)GLOBAL_CFLAGS += -D_FILE_OFFSET_BITS=64
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index 18bdbe7..1eb3240 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -115,8 +115,6 @@
-Wl,-maarch64linux \
-Wl,--hash-style=gnu \
-Wl,--fix-cortex-a53-843419 \
- -fuse-ld=gold \
- -Wl,--icf=safe \
$(arch_variant_ldflags)
# Disable transitive dependency library symbol resolving.
diff --git a/core/definitions.mk b/core/definitions.mk
index 1c8f41a..0089865 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2099,7 +2099,7 @@
#TODO: update the manifest to point to the dex file
define add-dex-to-package
-$(hide) zip -qjX $@ $(dir $(PRIVATE_DEX_FILE))classes*.dex
+$(hide) find $(dir $(PRIVATE_DEX_FILE)) -maxdepth 1 -name "classes*.dex" | sort | xargs zip -qjX $@
endef
# Add java resources added by the current module.
@@ -2115,7 +2115,7 @@
#
define add-carried-jack-resources
$(hide) if [ -d $(PRIVATE_JACK_INTERMEDIATES_DIR) ] ; then \
- find $(PRIVATE_JACK_INTERMEDIATES_DIR) -type f \
+ find $(PRIVATE_JACK_INTERMEDIATES_DIR) -type f | sort \
| sed -e "s?^$(PRIVATE_JACK_INTERMEDIATES_DIR)/? -C \"$(PRIVATE_JACK_INTERMEDIATES_DIR)\" \"?" -e "s/$$/\"/" \
> $(dir $@)jack_res_jar_flags; \
if [ -s $(dir $@)jack_res_jar_flags ] ; then \
@@ -2161,7 +2161,7 @@
rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
zip -d $@ 'lib/*.so' && \
- ( cd $(dir $@)uncompressedlibs && zip -D -r -X -0 ../$(notdir $@) lib ) && \
+ ( cd $(dir $@)uncompressedlibs && find lib -type f | sort | zip -D -X -0 ../$(notdir $@) -@ ) && \
rm -rf $(dir $@)uncompressedlibs; \
fi
endef
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 5b11724..d6f6cc9 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -44,7 +44,10 @@
relocation_packer_input := $(linked_module)
relocation_packer_output := $(intermediates)/PACKED/$(my_built_module_stem)
-my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
+my_pack_module_relocations := false
+ifneq ($(DISABLE_RELOCATION_PACKER),true)
+ my_pack_module_relocations := $(LOCAL_PACK_MODULE_RELOCATIONS)
+endif
ifeq ($(my_pack_module_relocations),)
my_pack_module_relocations := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PACK_MODULE_RELOCATIONS)
diff --git a/core/goma.mk b/core/goma.mk
index ddd7d80..01a1d81 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -56,7 +56,11 @@
# gomacc can start goma client's daemon process automatically, but
# it is safer and faster to start up it beforehand. We run this as a
# background process so this won't slow down the build.
- $(shell $(goma_ctl) ensure_start &> /dev/null &)
+ # We use "ensure_start" command when the compiler_proxy is already
+ # running and uses GOMA_HERMETIC=error flag. The compiler_proxy will
+ # restart otherwise.
+ # TODO(hamaji): Remove this condition after http://b/25676777 is fixed.
+ $(shell ( if ( curl http://localhost:$$($(GOMA_CC) port)/flagz | grep GOMA_HERMETIC=error ); then cmd=ensure_start; else cmd=restart; fi; GOMA_HERMETIC=error $(goma_ctl) $${cmd} ) &> /dev/null &)
goma_ctl :=
goma_dir :=
diff --git a/core/main.mk b/core/main.mk
index 27b559f..2bd3163 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -316,8 +316,8 @@
#
# -----------------------------------------------------------------
# Jack version configuration
-include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk
-include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk
+-include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk
+-include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk
# -----------------------------------------------------------------
###
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 505bd45..3af7101 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -48,6 +48,10 @@
# Do not pack relocations by default
LOCAL_PACK_MODULE_RELOCATIONS := false
endif
+
+ ifeq ($(DISABLE_RELOCATION_PACKER),true)
+ LOCAL_PACK_MODULE_RELOCATIONS := false
+ endif
endif
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
diff --git a/tools/check_prereq/Android.mk b/tools/check_prereq/Android.mk
deleted file mode 100644
index 4329aff..0000000
--- a/tools/check_prereq/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2009 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)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := check_prereq.c
-LOCAL_MODULE := check_prereq
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES +=
-LOCAL_STATIC_LIBRARIES += libcutils libc
-
-include $(BUILD_EXECUTABLE)
diff --git a/tools/check_prereq/check_prereq.c b/tools/check_prereq/check_prereq.c
deleted file mode 100644
index d7b8918..0000000
--- a/tools/check_prereq/check_prereq.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/system_properties.h>
-#include <cutils/properties.h>
-
-// Compare the timestamp of the new build (passed on the command line)
-// against the current value of ro.build.date.utc. Exit successfully
-// if the new build is newer than the current build (or if the
-// timestamps are the same).
-int main(int argc, char** argv) {
- if (argc != 2) {
- usage:
- fprintf(stderr, "usage: %s <timestamp>\n", argv[0]);
- return 2;
- }
-
- char value[PROPERTY_VALUE_MAX];
- char* default_value = "0";
-
- property_get("ro.build.date.utc", value, default_value);
-
- long current = strtol(value, NULL, 10);
- char* end;
- long install = strtol(argv[1], &end, 10);
-
- printf("current build time: [%ld] new build time: [%ld]\n",
- current, install);
-
- return (*end == 0 && current > 0 && install >= current) ? 0 : 1;
-}
diff --git a/tools/target_files_diff.py b/tools/target_files_diff.py
new file mode 100755
index 0000000..010ea84
--- /dev/null
+++ b/tools/target_files_diff.py
@@ -0,0 +1,224 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2009 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.
+#
+
+#
+# Finds differences between two target files packages
+#
+
+from __future__ import print_function
+
+import argparse
+import contextlib
+import os
+import re
+import subprocess
+import tempfile
+
+def ignore(name):
+ """
+ Files to ignore when diffing
+
+ These are packages that we're already diffing elsewhere,
+ or files that we expect to be different for every build,
+ or known problems.
+ """
+
+ # We're looking at the files that make the images, so no need to search them
+ if name in ['IMAGES']:
+ return True
+ # These are packages of the recovery partition, which we're already diffing
+ if name in ['SYSTEM/etc/recovery-resource.dat',
+ 'SYSTEM/recovery-from-boot.p']:
+ return True
+
+ # These files are just the BUILD_NUMBER, and will always be different
+ if name in ['BOOT/RAMDISK/selinux_version',
+ 'RECOVERY/RAMDISK/selinux_version']:
+ return True
+
+ # b/24201956 .art/.oat/.odex files are different with every build
+ if name.endswith('.art') or name.endswith('.oat') or name.endswith('.odex'):
+ return True
+ # b/25348136 libpac.so changes with every build
+ if name in ['SYSTEM/lib/libpac.so',
+ 'SYSTEM/lib64/libpac.so']:
+ return True
+
+ return False
+
+
+def rewrite_build_property(original, new):
+ """
+ Rewrite property files to remove values known to change for every build
+ """
+
+ skipped = ['ro.bootimage.build.date=',
+ 'ro.bootimage.build.date.utc=',
+ 'ro.bootimage.build.fingerprint=',
+ 'ro.build.id=',
+ 'ro.build.display.id=',
+ 'ro.build.version.incremental=',
+ 'ro.build.date=',
+ 'ro.build.date.utc=',
+ 'ro.build.host=',
+ 'ro.build.description=',
+ 'ro.build.fingerprint=',
+ 'ro.expect.recovery_id=',
+ 'ro.vendor.build.date=',
+ 'ro.vendor.build.date.utc=',
+ 'ro.vendor.build.fingerprint=']
+
+ for line in original:
+ skip = False
+ for s in skipped:
+ if line.startswith(s):
+ skip = True
+ break
+ if not skip:
+ new.write(line)
+
+
+def trim_install_recovery(original, new):
+ """
+ Rewrite the install-recovery script to remove the hash of the recovery partition.
+ """
+ for line in original:
+ new.write(re.sub(r'[0-9a-f]{40}', '0'*40, line))
+
+def sort_file(original, new):
+ """
+ Sort the file. Some OTA metadata files are not in a deterministic order currently.
+ """
+ lines = original.readlines()
+ lines.sort()
+ for line in lines:
+ new.write(line)
+
+# Map files to the functions that will modify them for diffing
+REWRITE_RULES = {
+ 'BOOT/RAMDISK/default.prop': rewrite_build_property,
+ 'RECOVERY/RAMDISK/default.prop': rewrite_build_property,
+ 'SYSTEM/build.prop': rewrite_build_property,
+ 'VENDOR/build.prop': rewrite_build_property,
+
+ 'SYSTEM/bin/install-recovery.sh': trim_install_recovery,
+
+ 'META/boot_filesystem_config.txt': sort_file,
+ 'META/filesystem_config.txt': sort_file,
+ 'META/recovery_filesystem_config.txt': sort_file,
+ 'META/vendor_filesystem_config.txt': sort_file,
+}
+
+@contextlib.contextmanager
+def preprocess(name, filename):
+ """
+ Optionally rewrite files before diffing them, to remove known-variable information.
+ """
+ if name in REWRITE_RULES:
+ with tempfile.NamedTemporaryFile() as newfp:
+ with open(filename, 'r') as oldfp:
+ REWRITE_RULES[name](oldfp, newfp)
+ newfp.flush()
+ yield newfp.name
+ else:
+ yield filename
+
+def diff(name, file1, file2):
+ """
+ Diff a file pair with diff, running preprocess() on the arguments first.
+ """
+ with preprocess(name, file1) as f1:
+ with preprocess(name, file2) as f2:
+ proc = subprocess.Popen(['diff', f1, f2], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ (stdout, ignore) = proc.communicate()
+ if proc.returncode == 0:
+ return
+ stdout = stdout.strip()
+ if stdout == 'Binary files %s and %s differ' % (f1, f2):
+ print("%s: Binary files differ" % name)
+ else:
+ for line in stdout.strip().split('\n'):
+ print("%s: %s" % (name, line))
+
+def recursiveDiff(prefix, dir1, dir2):
+ """
+ Recursively diff two directories, checking metadata then calling diff()
+ """
+ list1 = sorted(os.listdir(dir1))
+ list2 = sorted(os.listdir(dir2))
+
+ for entry in list1:
+ name = os.path.join(prefix, entry)
+ name1 = os.path.join(dir1, entry)
+ name2 = os.path.join(dir2, entry)
+
+ if ignore(name):
+ continue
+
+ if entry in list2:
+ if os.path.islink(name1):
+ if os.path.islink(name2):
+ link1 = os.readlink(name1)
+ link2 = os.readlink(name2)
+ if link1 != link2:
+ print("%s: Symlinks differ: %s vs %s" % (name, link1, link2))
+ else:
+ print("%s: File types differ, skipping compare" % name)
+ continue
+
+ stat1 = os.stat(name1)
+ stat2 = os.stat(name2)
+ type1 = stat1.st_mode & ~0777
+ type2 = stat2.st_mode & ~0777
+
+ if type1 != type2:
+ print("%s: File types differ, skipping compare" % name)
+ continue
+
+ if stat1.st_mode != stat2.st_mode:
+ print("%s: Modes differ: %o vs %o" % (name, stat1.st_mode, stat2.st_mode))
+
+ if os.path.isdir(name1):
+ recursiveDiff(name, name1, name2)
+ elif os.path.isfile(name1):
+ diff(name, name1, name2)
+ else:
+ print("%s: Unknown file type, skipping compare" % name)
+ else:
+ print("%s: Only in base package" % name)
+
+ for entry in list2:
+ name = os.path.join(prefix, entry)
+ name1 = os.path.join(dir1, entry)
+ name2 = os.path.join(dir2, entry)
+
+ if ignore(name):
+ continue
+
+ if entry not in list1:
+ print("%s: Only in new package" % name)
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('dir1', help='The base target files package (extracted)')
+ parser.add_argument('dir2', help='The new target files package (extracted)')
+ args = parser.parse_args()
+
+ recursiveDiff('', args.dir1, args.dir2)
+
+if __name__ == '__main__':
+ main()