Merge "Create telephony apex."
diff --git a/Changes.md b/Changes.md
index 0b5db4d..5a0fd23 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,36 @@
# Build System Changes for Android.mk Writers
+## LOCAL_C_INCLUDES outside the source/output trees are an error {#BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS}
+
+Include directories are expected to be within the source tree (or in the output
+directory, generated during the build). This has been checked in some form
+since Oreo, but now has better checks.
+
+There's now a `BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS` variable, that when set, will
+turn these errors into warnings temporarily. I don't expect this to last more
+than a release, since they're fairly easy to clean up.
+
+Neither of these cases are supported by Soong, and will produce errors when
+converting your module.
+
+### Absolute paths
+
+This has been checked since Oreo. The common reason to hit this is because a
+makefile is calculating a path, and ran abspath/realpath/etc. This is a problem
+because it makes your build non-reproducible. It's very unlikely that your
+source path is the same on every machine.
+
+### Using `../` to leave the source/output directories
+
+This is the new check that has been added. In every case I've found, this has
+been a mistake in the Android.mk -- assuming that `LOCAL_C_INCLUDES` (which is
+relative to the top of the source tree) acts like `LOCAL_SRC_FILES` (which is
+relative to `LOCAL_PATH`).
+
+Since this usually isn't a valid path, you can almost always just remove the
+offending line.
+
+
# `BOARD_HAL_STATIC_LIBRARIES` and `LOCAL_HAL_STATIC_LIBRARIES` are obsolete {#BOARD_HAL_STATIC_LIBRARIES}
Define proper HIDL / Stable AIDL HAL instead.
diff --git a/core/binary.mk b/core/binary.mk
index fc6503a..ae456e3 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1295,9 +1295,13 @@
my_c_includes := $(foreach inc,$(my_c_includes),$(call clean-path,$(inc)))
-my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)))
+my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)) $(filter ../%,$(my_c_includes)))
ifneq ($(my_outside_includes),)
-$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ ifeq ($(BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS),true)
+ $(call pretty-warning,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ else
+ $(call pretty-error,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ endif
endif
# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
diff --git a/core/board_config.mk b/core/board_config.mk
index 4c128f1..0e3c52f 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -89,6 +89,7 @@
BUILD_BROKEN_PREBUILT_ELF_FILES \
BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
BUILD_BROKEN_USES_NETWORK \
+ BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
_build_broken_var_list += \
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
diff --git a/core/tasks/with-license.mk b/core/tasks/with-license.mk
index daa6897..469ad76 100644
--- a/core/tasks/with-license.mk
+++ b/core/tasks/with-license.mk
@@ -20,7 +20,7 @@
name := $(name)_debug
endif
-name := $(name)-img-$(FILE_NAME_TAG)-with-license
+name := $(name)-flashable-$(FILE_NAME_TAG)-with-license
with_license_intermediates := \
$(call intermediates-dir-for,PACKAGING,with_license)
@@ -35,8 +35,7 @@
else
$(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
RADIO/bootloader.img:bootloader.img RADIO/radio.img:radio.img \
- IMAGES/system.img:system.img IMAGES/vendor.img:vendor.img \
- IMAGES/boot.img:boot.img OTA/android-info.txt:android-info.txt
+ IMAGES/*.img:. OTA/android-info.txt:android-info.txt
endif
with_license_zip := $(PRODUCT_OUT)/$(name).sh
$(with_license_zip): PRIVATE_NAME := $(name)
diff --git a/tools/event_log_tags.py b/tools/event_log_tags.py
index 645839e..35b2de0 100644
--- a/tools/event_log_tags.py
+++ b/tools/event_log_tags.py
@@ -62,9 +62,9 @@
try:
for self.linenum, line in enumerate(file_object):
self.linenum += 1
-
+ line = re.sub('#.*$', '', line) # strip trailing comments
line = line.strip()
- if not line or line[0] == '#': continue
+ if not line: continue
parts = re.split(r"\s+", line, 2)
if len(parts) < 2:
diff --git a/tools/generate-self-extracting-archive.py b/tools/generate-self-extracting-archive.py
index 5a193ab..5b0628d 100755
--- a/tools/generate-self-extracting-archive.py
+++ b/tools/generate-self-extracting-archive.py
@@ -38,7 +38,7 @@
import os
import zipfile
-_HEADER_TEMPLATE = """#!/bin/sh
+_HEADER_TEMPLATE = """#!/bin/bash
#
{comment_line}
#
@@ -92,7 +92,7 @@
dst.write(b)
_MAX_OFFSET_WIDTH = 20
-def _generate_extract_command(start, end, extract_name):
+def _generate_extract_command(start, size, extract_name):
"""Generate the extract command.
The length of this string must be constant no matter what the start and end
@@ -101,7 +101,7 @@
Args:
start: offset in bytes of the start of the wrapped file
- end: offset in bytes of the end of the wrapped file
+ size: size in bytes of the wrapped file
extract_name: of the file to create when extracted
"""
@@ -111,11 +111,11 @@
if len(start_str) != _MAX_OFFSET_WIDTH + 1:
raise Exception('Start offset too large (%d)' % start)
- end_str = ('%d' % end).rjust(_MAX_OFFSET_WIDTH)
- if len(end_str) != _MAX_OFFSET_WIDTH:
- raise Exception('End offset too large (%d)' % end)
+ size_str = ('%d' % size).rjust(_MAX_OFFSET_WIDTH)
+ if len(size_str) != _MAX_OFFSET_WIDTH:
+ raise Exception('Size too large (%d)' % size)
- return "tail -c %s $0 | head -c %s > %s\n" % (start_str, end_str, extract_name)
+ return "tail -c %s $0 | head -c %s > %s\n" % (start_str, size_str, extract_name)
def main(argv):