Merge "Fix kernel module build of custom image"
diff --git a/core/definitions.mk b/core/definitions.mk
index 0fd023a..981c6cb 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2329,6 +2329,7 @@
define add-jar-resources-to-package
rm -rf $(3)
mkdir -p $(3)
+ zipinfo -1 $(2) > /dev/null
unzip -qo $(2) -d $(3) $$(zipinfo -1 $(2) | grep -v -E "\.class$$")
$(JAR) uf $(1) $(call jar-args-sorted-files-in-directory,$(3))
endef
diff --git a/core/envsetup.rbc b/core/envsetup.rbc
index 451623b..69c4989 100644
--- a/core/envsetup.rbc
+++ b/core/envsetup.rbc
@@ -188,9 +188,18 @@
if g["HOST_BUILD_TYPE"] not in ["release", "debug"]:
fail("HOST_BUILD_TYPE must be either release or debug, not '%s'" % g["HOST_BUILD_TYPE"])
+ g.update([
+ ("TARGET_COPY_OUT_VENDOR", "||VENDOR-PATH-PH||"),
+ ("TARGET_COPY_OUT_PRODUCT", "||PRODUCT-PATH-PH||"),
+ ("TARGET_COPY_OUT_PRODUCT_SERVICES", "||PRODUCT-PATH-PH||"),
+ ("TARGET_COPY_OUT_SYSTEM_EXT", "||SYSTEM_EXT-PATH-PH||"),
+ ("TARGET_COPY_OUT_ODM", "||ODM-PATH-PH||"),
+ ("TARGET_COPY_OUT_VENDOR_DLKM", "||VENDOR_DLKM-PATH-PH||"),
+ ("TARGET_COPY_OUT_ODM_DLKM", "||ODM_DLKM-PATH-PH||"),
+ ])
+
# TODO(asmundak): there is more stuff in envsetup.mk lines 249-292, but
# it does not seem to affect product configuration. Revisit this.
-
g["ART_APEX_JARS"] = [
"com.android.art:core-oj",
"com.android.art:core-libart",
diff --git a/core/main.mk b/core/main.mk
index e0fb58d..7b41ba2 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -120,9 +120,6 @@
ifndef SKIP_BOOT_JARS_CHECK
SKIP_BOOT_JARS_CHECK := true
endif
-# Mainline modules prebuilts do not support coverage. Build them from source.
-# See b/159241638
-MODULE_BUILD_FROM_SOURCE := true
endif
ifdef TARGET_ARCH_SUITE
diff --git a/core/product.mk b/core/product.mk
index f6347e8..9aaf5eb 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -372,11 +372,6 @@
_product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES
_product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES
-# A list of <overridden-apex>:<override-apex> pairs that specifies APEX module
-# overrides to be applied to the APEX names in the boot jar variables
-# (PRODUCT_BOOT_JARS, PRODUCT_APEX_BOOT_JARS etc).
-_product_list_vars += PRODUCT_BOOT_JAR_MODULE_OVERRIDES
-
# Controls for whether different partitions are built for the current product.
_product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE
_product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE
diff --git a/core/product_config.mk b/core/product_config.mk
index 403c6be..7bed376 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -285,19 +285,6 @@
# All APEX jars come after /system and /system_ext jars, so adding core-icu4j at the end of the list
PRODUCT_BOOT_JARS += com.android.i18n:core-icu4j
-# Replaces references to overridden boot jar modules in a boot jars variable.
-# $(1): Name of a boot jars variable with <apex>:<jar> pairs.
-define replace-boot-jar-module-overrides
- $(foreach pair,$(PRODUCT_BOOT_JAR_MODULE_OVERRIDES),\
- $(eval _rbjmo_from := $(call word-colon,1,$(pair)))\
- $(eval _rbjmo_to := $(call word-colon,2,$(pair)))\
- $(eval $(1) := $(patsubst $(_rbjmo_from):%,$(_rbjmo_to):%,$($(1)))))
-endef
-
-$(call replace-boot-jar-module-overrides,PRODUCT_BOOT_JARS)
-$(call replace-boot-jar-module-overrides,PRODUCT_APEX_BOOT_JARS)
-$(call replace-boot-jar-module-overrides,ART_APEX_JARS)
-
# The extra system server jars must be appended at the end after common system server jars.
PRODUCT_SYSTEM_SERVER_JARS += $(PRODUCT_SYSTEM_SERVER_JARS_EXTRA)
diff --git a/core/product_config.rbc b/core/product_config.rbc
index 3714448..f7ce7aa 100644
--- a/core/product_config.rbc
+++ b/core/product_config.rbc
@@ -463,6 +463,28 @@
print(message)
+def __mkparse_pattern(pattern):
+ """Parses Make's patsubst pattern."""
+ in_escape = False
+ res = []
+ acc = ""
+ for c in pattern.elems():
+ if in_escape:
+ in_escape = False
+ acc += c
+ elif c == '\\':
+ in_escape = True
+ elif c == '%' and not res:
+ res.append(acc)
+ acc = ''
+ else:
+ acc += c
+ if in_escape:
+ acc += '\\'
+ res.append(acc)
+ return res
+
+
def __mkpatsubst_word(parsed_pattern,parsed_subst, word):
(before, after) = parsed_pattern
if not word.startswith(before):
@@ -480,16 +502,14 @@
Tokenizes `s` (unless it is already a list), and then performs a simple
wildcard substitution (in other words, `foo%bar` pattern is equivalent to
the regular expression `^foo(.*)bar$, and the first `%` in replacement is
- $1 in regex terms). Escaping % is not supported
+ $1 in regex terms).
"""
- if pattern.find("\\") >= 0:
- fail("'\\' in pattern is not allowed")
- parsed_pattern = pattern.split("%", 1)
+ parsed_pattern = __mkparse_pattern(pattern)
words = s if type(s) == "list" else _mkstrip(s).split(" ")
if len(parsed_pattern) == 1:
out_words = [ replacement if x == pattern else x for x in words]
else:
- parsed_replacement = replacement.split("%", 1)
+ parsed_replacement = __mkparse_pattern(replacement)
out_words = [__mkpatsubst_word(parsed_pattern, parsed_replacement, x) for x in words]
return out_words if type(s) == "list" else " ".join(out_words)
@@ -522,6 +542,22 @@
return s.replace(old, new)
+def _product_copy_files_by_pattern(src, dest, s):
+ """Creates a copy list.
+
+ For each item in a given list, create <from>:<to> pair, where <from> and
+ <to> are the results of applying Make-style patsubst of <src> and <dest>
+ respectively. E.g. the result of calling this function with
+ ("foo/%", "bar/%", ["a", "b"]) will be
+ ["foo/a:bar/a", "foo/b:bar/b"].
+ """
+ parsed_src = __mkparse_pattern(src)
+ parsed_dest = __mkparse_pattern(dest)
+ parsed_percent = ["", ""]
+ words = s if type(s) == "list" else _mkstrip(s).split(" ")
+ return [ __mkpatsubst_word(parsed_percent, parsed_src, x) + ":" + __mkpatsubst_word(parsed_percent, parsed_dest, x) for x in words]
+
+
def __get_options():
"""Returns struct containing runtime global settings."""
settings = dict(
@@ -577,6 +613,7 @@
mksubst = _mksubst,
printvars = _printvars,
product_configuration = _product_configuration,
+ product_copy_files_by_pattern = _product_copy_files_by_pattern,
require_artifacts_in_path = _require_artifacts_in_path,
require_artifacts_in_path_relaxed = _require_artifacts_in_path_relaxed,
setdefault = _setdefault,
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index de3d63d..d121484 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -369,6 +369,7 @@
profcollectd \
profcollectctl \
remount \
+ servicedispatcher \
showmap \
sqlite3 \
ss \
diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk
index 4d46358..e6db0f8 100644
--- a/target/product/emulator_vendor.mk
+++ b/target/product/emulator_vendor.mk
@@ -37,7 +37,7 @@
#watchdog tiggers reboot because location service is not
#responding, disble it for now.
-#still keep it on internal master as it is still working
+#still keep it on internal main (master) as it is still working
#once it is fixed in aosp, remove this block of comment.
#PRODUCT_VENDOR_PROPERTIES += \
#config.disable_location=true
diff --git a/target/product/virtual_ab_ota/compression_with_xor.mk b/target/product/virtual_ab_ota/compression_with_xor.mk
new file mode 100644
index 0000000..7d92532
--- /dev/null
+++ b/target/product/virtual_ab_ota/compression_with_xor.mk
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2021 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.
+#
+
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/compression.mk)
+
+
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.xor.enabled=true
diff --git a/tests/run.rbc b/tests/run.rbc
index 15f6212..35ae19d 100644
--- a/tests/run.rbc
+++ b/tests/run.rbc
@@ -43,6 +43,9 @@
assert_eq("azx b", rblf.mkpatsubst("az", "AZ", "azx b"))
assert_eq(["azx", "b"], rblf.mkpatsubst("az", "AZ", ["azx", "b"]))
assert_eq("ABC", rblf.mkpatsubst("abc", "ABC", "abc"))
+assert_eq(["%/foo"], rblf.mkpatsubst("%", "\\%/%", ["foo"]))
+assert_eq(["foo/%"], rblf.mkpatsubst("%", "%/%", ["foo"]))
+assert_eq(["from/a:to/a", "from/b:to/b"], rblf.product_copy_files_by_pattern("from/%", "to/%", "a b"))
globals, config = rblf.product_configuration("test/device", init)
assert_eq(
diff --git a/tools/rbcrun/host.go b/tools/rbcrun/host.go
index 1e43334..b3dd499 100644
--- a/tools/rbcrun/host.go
+++ b/tools/rbcrun/host.go
@@ -118,7 +118,7 @@
if err := starlark.UnpackPositionalArgs(b.Name(), args, kwargs, 1, &path); err != nil {
return starlark.None, err
}
- if stat, err := os.Stat(path); err != nil || stat.IsDir() {
+ if _, err := os.Stat(path); err != nil {
return starlark.False, nil
}
return starlark.True, nil
diff --git a/tools/rbcrun/testdata/file_ops.star b/tools/rbcrun/testdata/file_ops.star
index e1f1ac2..31631ef 100644
--- a/tools/rbcrun/testdata/file_ops.star
+++ b/tools/rbcrun/testdata/file_ops.star
@@ -4,6 +4,7 @@
def test():
myname = "file_ops.star"
+ assert.true(rblf_file_exists("."), "./ exists ")
assert.true(rblf_file_exists(myname), "the file %s does exist" % myname)
assert.true(not rblf_file_exists("no_such_file"), "the file no_such_file does not exist")
files = rblf_wildcard("*.star")
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 97cfee9..f30e382 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -449,6 +449,13 @@
return vabc_enabled
@property
+ def is_vabc_xor(self):
+ vendor_prop = self.info_dict.get("vendor.build.prop")
+ vabc_xor_enabled = vendor_prop and \
+ vendor_prop.GetProp("ro.virtual_ab.compression.xor.enabled") == "true"
+ return vabc_xor_enabled
+
+ @property
def vendor_suppressed_vabc(self):
vendor_prop = self.info_dict.get("vendor.build.prop")
vabc_suppressed = vendor_prop and \
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 1f3022b..366b51a 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -1091,6 +1091,9 @@
if target_info.vendor_suppressed_vabc:
logger.info("Vendor suppressed VABC. Disabling")
OPTIONS.disable_vabc = True
+ if not target_info.is_vabc_xor or OPTIONS.disable_vabc:
+ logger.info("VABC XOR Not supported, disabling")
+ OPTIONS.enable_vabc_xor = False
additional_args = []
# Prepare custom images.