Merge "Allow init_rc files to be installed in ramdisk"
diff --git a/core/Makefile b/core/Makefile
index 5bbf70f..8f460b4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -976,11 +976,14 @@
INTERNAL_INIT_BOOT_IMAGE_ARGS :=
-ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
- ifneq ($(BUILDING_INIT_BOOT_IMAGE),true)
- INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
- else
- INTERNAL_INIT_BOOT_IMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
+# TODO(b/229701033): clean up BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK.
+ifneq ($(BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK),true)
+ ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ ifneq ($(BUILDING_INIT_BOOT_IMAGE),true)
+ INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
+ else
+ INTERNAL_INIT_BOOT_IMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
+ endif
endif
endif
@@ -1765,8 +1768,12 @@
$(BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE) \
,erofs),)
INTERNAL_USERIMAGES_DEPS += $(MKEROFS)
+ifeq ($(BOARD_EROFS_USE_LEGACY_COMPRESSION),true)
+BOARD_EROFS_COMPRESSOR ?= "lz4"
+else
BOARD_EROFS_COMPRESSOR ?= "lz4hc,9"
endif
+endif
ifneq ($(filter \
$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) \
@@ -1912,6 +1919,7 @@
$(if $(BOARD_EROFS_COMPRESSOR),$(hide) echo "erofs_default_compressor=$(BOARD_EROFS_COMPRESSOR)" >> $(1))
$(if $(BOARD_EROFS_PCLUSTER_SIZE),$(hide) echo "erofs_pcluster_size=$(BOARD_EROFS_PCLUSTER_SIZE)" >> $(1))
$(if $(BOARD_EROFS_SHARE_DUP_BLOCKS),$(hide) echo "erofs_share_dup_blocks=$(BOARD_EROFS_SHARE_DUP_BLOCKS)" >> $(1))
+$(if $(BOARD_EROFS_USE_LEGACY_COMPRESSION),$(hide) echo "erofs_use_legacy_compression=$(BOARD_EROFS_USE_LEGACY_COMPRESSION)" >> $(1))
$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
@@ -2004,6 +2012,8 @@
$(hide) echo "recovery_as_boot=true" >> $(1))
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
$(hide) echo "system_root_image=true" >> $(1))
+$(if $(filter true,$(BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK)),\
+ $(hide) echo "gki_boot_image_without_ramdisk=true" >> $(1))
$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
$(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\
$(hide) echo "use_dynamic_partition_size=true" >> $(1))
diff --git a/core/base_rules.mk b/core/base_rules.mk
index f358356..7ea9b52 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -721,6 +721,7 @@
endif
ifdef LOCAL_MULTILIB
multi_arch := true
+# These conditionals allow this functionality to be mimicked in Soong
else ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
multi_arch := true
diff --git a/core/config.mk b/core/config.mk
index 7af600f..e9dedfd 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -427,21 +427,6 @@
$(hide) $(HOST_NM) -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true)
endef
-GOMA_POOL :=
-RBE_POOL :=
-GOMA_OR_RBE_POOL :=
-# When goma or RBE are enabled, kati will be passed --default_pool=local_pool to put
-# most rules into the local pool. Explicitly set the pool to "none" for rules that
-# should be run outside the local pool, i.e. with -j500.
-ifneq (,$(filter-out false,$(USE_GOMA)))
- GOMA_POOL := none
- GOMA_OR_RBE_POOL := none
-else ifneq (,$(filter-out false,$(USE_RBE)))
- RBE_POOL := none
- GOMA_OR_RBE_POOL := none
-endif
-.KATI_READONLY := GOMA_POOL RBE_POOL GOMA_OR_RBE_POOL
-
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ccache.mk
include $(BUILD_SYSTEM)/goma.mk
@@ -1233,6 +1218,39 @@
$(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/)
endef
+GOMA_POOL :=
+RBE_POOL :=
+GOMA_OR_RBE_POOL :=
+# When goma or RBE are enabled, kati will be passed --default_pool=local_pool to put
+# most rules into the local pool. Explicitly set the pool to "none" for rules that
+# should be run outside the local pool, i.e. with -j500.
+ifneq (,$(filter-out false,$(USE_GOMA)))
+ GOMA_POOL := none
+ GOMA_OR_RBE_POOL := none
+else ifneq (,$(filter-out false,$(USE_RBE)))
+ RBE_POOL := none
+ GOMA_OR_RBE_POOL := none
+endif
+.KATI_READONLY := GOMA_POOL RBE_POOL GOMA_OR_RBE_POOL
+
+JAVAC_NINJA_POOL :=
+R8_NINJA_POOL :=
+D8_NINJA_POOL :=
+
+ifneq ($(filter-out false,$(USE_RBE)),)
+ ifdef RBE_JAVAC
+ JAVAC_NINJA_POOL := $(RBE_POOL)
+ endif
+ ifdef RBE_R8
+ R8_NINJA_POOL := $(RBE_POOL)
+ endif
+ ifdef RBE_D8
+ D8_NINJA_POOL := $(RBE_POOL)
+ endif
+endif
+
+.KATI_READONLY := JAVAC_NINJA_POOL R8_NINJA_POOL D8_NINJA_POOL
+
# These goals don't need to collect and include Android.mks/CleanSpec.mks
# in the source tree.
dont_bother_goals := out product-graph
diff --git a/core/definitions.mk b/core/definitions.mk
index a6bac16..0d72473 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -570,21 +570,16 @@
$(call generated-sources-dir-for,META,lic,)
endef
-TARGETS_MISSING_LICENSE_METADATA:=
-
###########################################################
# License metadata targets corresponding to targets in $(1)
###########################################################
define corresponding-license-metadata
-$(strip $(filter-out 0p,$(foreach target, $(sort $(1)), \
+$(strip $(foreach target, $(sort $(1)), \
$(if $(strip $(ALL_MODULES.$(target).META_LIC)), \
$(ALL_MODULES.$(target).META_LIC), \
$(if $(strip $(ALL_TARGETS.$(target).META_LIC)), \
$(ALL_TARGETS.$(target).META_LIC), \
- $(eval TARGETS_MISSING_LICENSE_METADATA += $(target)) \
- ) \
- ) \
-)))
+ $(call append-path,$(call license-metadata-dir),$(patsubst $(OUT_DIR)%,out%,$(target).meta_lic))))))
endef
###########################################################
@@ -722,7 +717,6 @@
$(strip \
$(eval _tgt := $(subst //,/,$(strip $(1)))) \
$(eval ALL_NON_MODULES += $(_tgt)) \
- $(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_KINDS := $(strip $(2))) \
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_CONDITIONS := $(strip $(3))) \
$(eval ALL_NON_MODULES.$(_tgt).NOTICES := $(strip $(4))) \
@@ -763,7 +757,6 @@
$(strip \
$(eval _tgt := $(subst //,/,$(strip $(1)))) \
$(eval ALL_NON_MODULES += $(_tgt)) \
- $(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_KINDS := $(strip $(2))) \
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_CONDITIONS := $(strip $(3))) \
$(eval ALL_NON_MODULES.$(_tgt).NOTICES := $(strip $(4))) \
@@ -836,7 +829,6 @@
$(strip \
$(eval _tgt := $(strip $(1))) \
$(eval ALL_NON_MODULES += $(_tgt)) \
- $(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
$(eval ALL_NON_MODULES.$(_tgt).DEPENDENCIES := $(strip $(ALL_NON_MODULES.$(_tgt).DEPENDENCIES) $(2))) \
)
endef
@@ -853,7 +845,6 @@
$(strip \
$(eval _tgt := $(strip $(1))) \
$(eval ALL_NON_MODULES += $(_tgt)) \
- $(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
$(eval ALL_NON_MODULES.$(_tgt).DEPENDENCIES := $(strip $(ALL_NON_MODULES.$(_tgt).DEPENDENCIES) $(2))) \
$(eval ALL_NON_MODULES.$(_tgt).IS_CONTAINER := true) \
$(eval ALL_NON_MODULES.$(_tgt).ROOT_MAPPINGS := $(strip $(ALL_NON_MODULES.$(_tgt).ROOT_MAPPINGS) $(3))) \
@@ -865,13 +856,12 @@
###########################################################
define report-missing-licenses-rule
.PHONY: reportmissinglicenses
-reportmissinglicenses: PRIVATE_NON_MODULES:=$(sort $(NON_MODULES_WITHOUT_LICENSE_METADATA) $(TARGETS_MISSING_LICENSE_METADATA))
+reportmissinglicenses: PRIVATE_NON_MODULES:=$(sort $(NON_MODULES_WITHOUT_LICENSE_METADATA))
reportmissinglicenses: PRIVATE_COPIED_FILES:=$(sort $(filter $(NON_MODULES_WITHOUT_LICENSE_METADATA),$(foreach _pair,$(PRODUCT_COPY_FILES), $(PRODUCT_OUT)/$(call word-colon,2,$(_pair)))))
reportmissinglicenses:
@echo Reporting $$(words $$(PRIVATE_NON_MODULES)) targets without license metadata
$$(foreach t,$$(PRIVATE_NON_MODULES),if ! [ -h $$(t) ]; then echo No license metadata for $$(t) >&2; fi;)
$$(foreach t,$$(PRIVATE_COPIED_FILES),if ! [ -h $$(t) ]; then echo No license metadata for copied file $$(t) >&2; fi;)
- echo $$(words $$(PRIVATE_NON_MODULES)) targets missing license metadata >&2
endef
@@ -924,8 +914,13 @@
$(foreach t,$(sort $(ALL_0P_TARGETS)), \
$(eval ALL_TARGETS.$(t).META_LIC := 0p) \
) \
+ $(foreach t,$(sort $(ALL_NON_MODULES)), \
+ $(eval ALL_TARGETS.$(t).META_LIC := $(call append-path,$(_dir),$(patsubst $(OUT_DIR)%,out%,$(t).meta_lic))) \
+ ) \
$(foreach t,$(sort $(ALL_NON_MODULES)),$(eval $(call non-module-license-metadata-rule,$(t)))) \
$(foreach m,$(sort $(ALL_MODULES)),$(eval $(call license-metadata-rule,$(m)))) \
+ $(eval $(call report-missing-licenses-rule)) \
+ $(eval $(call report-all-notice-library-names-rule)) \
$(eval $(call build-all-license-metadata-rule)))
endef
diff --git a/core/distdir.mk b/core/distdir.mk
index 23ae48f..aad8ff3 100644
--- a/core/distdir.mk
+++ b/core/distdir.mk
@@ -45,56 +45,6 @@
$(eval _all_dist_goal_output_pairs += $$(goal):$$(dst))))
endef
-.PHONY: shareprojects
-#shareprojects:
-
-define __share-projects-rule
-$(1) : PRIVATE_TARGETS := $(2)
-$(1) : $(2) | $(COMPLIANCE_LISTSHARE)
- $(hide) rm -f $$@
-ifeq (,$(strip $(2)))
- touch $$@
-else
- $(COMPLIANCE_LISTSHARE) $$(PRIVATE_TARGETS) > $$@
-endif
-endef
-
-# build list of projects to share in $(1) for dist targets in $(2)
-#
-# $(1): the intermediate project sharing file
-# $(2): the dist files to base the sharing on
-define _share-projects-rule
-$(eval $(call __share-projects-rule,$(1),$(call corresponding-license-metadata,$(2))))
-endef
-
-# Add a build dependency
-#
-# $(1): the goal phony target
-# $(2): the intermediate shareprojects file
-define _share-projects-dep
-$(1): $(2)
-endef
-
-define _add_projects_to_share
-$(strip $(eval _idir := $(call intermediates-dir-for,PACKAGING,shareprojects))) \
-$(strip $(eval _goals := $(sort $(_all_dist_goals)))) \
-$(strip $(eval _opairs := $(sort $(_all_dist_goal_output_pairs)))) \
-$(strip $(eval _dpairs := $(sort $(_all_dist_src_dst_pairs)))) \
-$(strip $(eval _allt :=)) \
-$(foreach goal,$(_goals), \
- $(eval _f := $(_idir)/$(goal).shareprojects) \
- $(call dist-for-goals,$(goal),$(_f)) \
- $(eval _targets :=) \
- $(foreach op,$(filter $(goal):%,$(_opairs)),$(foreach p,$(filter %:$(call word-colon,2,$(op)),$(_dpairs)),$(eval _targets += $(call word-colon,1,$(p))))) \
- $(eval _allt += $(_targets)) \
- $(eval $(call _share-projects-rule,$(_f),$(_targets))) \
-)\
-$(eval _f := $(_idir)/all.shareprojects)\
-$(eval $(call _share-projects-dep,shareprojects,$(_f))) \
-$(call dist-for-goals,shareprojects,$(_f))\
-$(eval $(call _share-projects-rule,$(_f),$(sort $(_allt))))
-endef
-
#------------------------------------------------------------------
# To be used at the end of the build to collect all the uses of
# dist-for-goals, and write them into a file for the packaging step to use.
@@ -102,15 +52,6 @@
# $(1): The file to write
define dist-write-file
$(strip \
- $(call _add_projects_to_share)\
- $(if $(strip $(ANDROID_REQUIRE_LICENSE_METADATA)),\
- $(if $(strip $(ANDROID_REQUIRE_LICENSE_METADATA)),\
- $(foreach target,$(sort $(TARGETS_MISSING_LICENSE_METADATA)),$(warning target $(target) missing license metadata)))\
- $(if $(strip $(TARGETS_MISSING_LICENSE_METADATA)),\
- $(if $(filter true error,$(ANDROID_REQUIRE_LICENSE_METADATA)),\
- $(error $(words $(sort $(TARGETS_MISSING_LICENSE_METADATA))) targets need license metadata))))\
- $(eval $(call report-missing-licenses-rule)) \
- $(eval $(call report-all-notice-library-names-rule)) \
$(KATI_obsolete_var dist-for-goals,Cannot be used after dist-write-file) \
$(foreach goal,$(sort $(_all_dist_goals)), \
$(eval $$(goal): _dist_$$(goal))) \
diff --git a/core/product_config.rbc b/core/product_config.rbc
index 917475a..0189323 100644
--- a/core/product_config.rbc
+++ b/core/product_config.rbc
@@ -104,6 +104,11 @@
seen = {item: 0 for item in value_list}
return sorted(seen.keys()) if _options.rearrange == "sort" else seen.keys()
+def __sort_pcm_names(pcm_names):
+ # We have to add an extension back onto the pcm names when sorting,
+ # or else the sort order could be wrong when one is a prefix of another.
+ return [x[:-3] for x in sorted([y + ".mk" for y in pcm_names], reverse=True)]
+
def _product_configuration(top_pcm_name, top_pcm, input_variables_init):
"""Creates configuration."""
@@ -167,7 +172,7 @@
# so children.keys() will be ordered by the inherit() calls
configs[name] = (pcm, handle.cfg, children.keys(), False)
- for child_name in sorted(children, reverse = True):
+ for child_name in __sort_pcm_names(children.keys()):
if child_name not in configs:
configs[child_name] = (children[child_name], None, [], False)
pcm_stack.append(child_name)
@@ -202,7 +207,7 @@
pcm_name, before = pcm_stack.pop()
if before:
pcm_stack.append((pcm_name, False))
- for child in sorted(configs[pcm_name][2], reverse = True):
+ for child in __sort_pcm_names(configs[pcm_name][2]):
pcm_stack.append((child, True))
else:
configs_postfix.append(pcm_name)
@@ -400,10 +405,26 @@
"""Gets to the value of the variable in the namespace."""
return g.get(_soong_config_namespaces_key, {}).get(nsname, {}).get(var, None)
-
-def _abspath(path):
+def _abspath(paths):
"""Provided for compatibility, to be removed later."""
- return path
+ cwd = rblf_shell('pwd')
+ results = []
+ for path in __words(paths):
+ if path[0] != "/":
+ path = cwd + "/" + path
+
+ resultparts = []
+ for part in path.split('/'):
+ if part == "." or part == "":
+ continue
+ elif part == "..":
+ if resultparts:
+ resultparts.pop()
+ else:
+ resultparts.append(part)
+ results.append("/" + "/".join(resultparts))
+
+ return " ".join(results)
def _addprefix(prefix, string_or_list):
diff --git a/core/rbe.mk b/core/rbe.mk
index e399ec1..370d4bd 100644
--- a/core/rbe.mk
+++ b/core/rbe.mk
@@ -14,10 +14,6 @@
# limitations under the License.
#
-JAVAC_NINJA_POOL :=
-R8_NINJA_POOL :=
-D8_NINJA_POOL :=
-
# Notice: this works only with Google's RBE service.
ifneq ($(filter-out false,$(USE_RBE)),)
ifdef RBE_DIR
@@ -88,20 +84,16 @@
ifdef RBE_JAVAC
JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac --exec_strategy=$(javac_exec_strategy) --platform=$(java_r8_d8_platform))
- JAVAC_NINJA_POOL := $(RBE_POOL)
endif
ifdef RBE_R8
R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
- R8_NINJA_POOL := $(RBE_POOL)
endif
ifdef RBE_D8
D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
- D8_NINJA_POOL := $(RBE_POOL)
endif
rbe_dir :=
endif
-.KATI_READONLY := JAVAC_NINJA_POOL R8_NINJA_POOL D8_NINJA_POOL
diff --git a/core/tasks/host-unit-tests.mk b/core/tasks/host-unit-tests.mk
index ed2f2a6..4453c29 100644
--- a/core/tasks/host-unit-tests.mk
+++ b/core/tasks/host-unit-tests.mk
@@ -39,7 +39,7 @@
echo $$shared_lib >> $@-host-libs.list; \
done
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
- $(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list \
+ $(hide) $(SOONG_ZIP) -L 0 -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list \
-P target -C $(PRODUCT_OUT) -l $@-target.list \
-P host/testcases -C $(HOST_OUT) -l $@-host-libs.list
rm -f $@.list $@-host.list $@-target.list $@-host-libs.list
diff --git a/tests/prefixed_sort_order/base-secondary.rbc b/tests/prefixed_sort_order/base-secondary.rbc
new file mode 100644
index 0000000..5446e8f
--- /dev/null
+++ b/tests/prefixed_sort_order/base-secondary.rbc
@@ -0,0 +1,21 @@
+# Copyright 2022 Google LLC
+#
+# 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
+#
+# https://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.
+
+load("//build/make/core:product_config.rbc", "rblf")
+
+def init(g, handle):
+ cfg = rblf.cfg(handle)
+
+ g.setdefault("MY_VAR", [])
+ g["MY_VAR"] += ["foo"]
diff --git a/tests/prefixed_sort_order/base.rbc b/tests/prefixed_sort_order/base.rbc
new file mode 100644
index 0000000..05b0d5d
--- /dev/null
+++ b/tests/prefixed_sort_order/base.rbc
@@ -0,0 +1,21 @@
+# Copyright 2022 Google LLC
+#
+# 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
+#
+# https://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.
+
+load("//build/make/core:product_config.rbc", "rblf")
+
+def init(g, handle):
+ cfg = rblf.cfg(handle)
+
+ g.setdefault("MY_VAR", [])
+ g["MY_VAR"] += ["bar"]
diff --git a/tests/prefixed_sort_order/product.rbc b/tests/prefixed_sort_order/product.rbc
new file mode 100644
index 0000000..619b2c0
--- /dev/null
+++ b/tests/prefixed_sort_order/product.rbc
@@ -0,0 +1,29 @@
+# Copyright 2022 Google LLC
+#
+# 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
+#
+# https://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.
+
+load("//build/make/core:product_config.rbc", "rblf")
+load(":base.rbc", _base_init = "init")
+load(":base-secondary.rbc", _base_secondary_init = "init")
+
+def init(g, handle):
+ cfg = rblf.cfg(handle)
+
+ # It's important that base-secondary uses a dash, an underscore won't expose the sort order issue:
+ # >>> sorted(["base", "base-secondary"])
+ # ['base', 'base-secondary']
+ # >>> sorted(["base.mk", "base-secondary.mk"])
+ # ['base-secondary.mk', 'base.mk']
+
+ rblf.inherit(handle, "base", _base_init)
+ rblf.inherit(handle, "base-secondary", _base_secondary_init)
diff --git a/tests/prefixed_sort_order/test.rbc b/tests/prefixed_sort_order/test.rbc
new file mode 100644
index 0000000..e59a509
--- /dev/null
+++ b/tests/prefixed_sort_order/test.rbc
@@ -0,0 +1,26 @@
+# Copyright 2022 Google LLC
+#
+# 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
+#
+# https://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.
+
+load("//build/make/core:product_config.rbc", "rblf")
+load("//build/make/tests/input_variables.rbc", input_variables_init = "init")
+load(":product.rbc", "init")
+
+
+def assert_eq(expected, actual):
+ if expected != actual:
+ fail("Expected '%s', got '%s'" % (expected, actual))
+
+def test():
+ (globals, globals_base) = rblf.product_configuration("test/device", init, input_variables_init)
+ assert_eq(["foo", "bar"], globals["MY_VAR"])
diff --git a/tests/run.rbc b/tests/run.rbc
index 56ba394..2d35e85 100644
--- a/tests/run.rbc
+++ b/tests/run.rbc
@@ -27,6 +27,7 @@
load(":board_input_vars.rbc", board_input_vars_init = "init")
load("//build/make/tests/single_value_inheritance:test.rbc", test_single_value_inheritance = "test")
load("//build/make/tests/artifact_path_requirements:test.rbc", test_artifact_path_requirements = "test")
+load("//build/make/tests/prefixed_sort_order:test.rbc", test_prefixed_sort_order = "test")
def assert_eq(expected, actual):
if expected != actual:
@@ -72,6 +73,14 @@
assert_eq("", rblf.notdir("/"))
assert_eq("", rblf.notdir(""))
+cwd = rblf_shell('pwd')
+assert_eq(cwd+"/foo/bar", rblf.abspath("foo/bar"))
+assert_eq(cwd+"/bar", rblf.abspath("foo/.././bar"))
+assert_eq(cwd+"/bar", rblf.abspath("foo/..////bar//"))
+assert_eq("/foo/baz", rblf.abspath("/foo/bar/../baz"))
+assert_eq(cwd+"/foo/bar "+cwd+"/foo/baz", rblf.abspath("foo/bar foo/baz"))
+assert_eq("/baz", rblf.abspath("/../../../../../../../../../../../../../../../../baz"))
+
assert_eq(
["build/make/tests/board.rbc", "build/make/tests/board_input_vars.rbc"],
rblf.expand_wildcard("build/make/tests/board*.rbc")
@@ -142,3 +151,4 @@
test_single_value_inheritance()
test_artifact_path_requirements()
+test_prefixed_sort_order()
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index e33b581..9049622 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -348,6 +348,8 @@
build_command.extend(["-C", prop_dict["erofs_pcluster_size"]])
if "erofs_share_dup_blocks" in prop_dict:
build_command.extend(["--chunksize", "4096"])
+ if "erofs_use_legacy_compression" in prop_dict:
+ build_command.extend(["-E", "legacy-compress"])
build_command.extend([out_file, in_dir])
if "erofs_sparse_flag" in prop_dict and not disable_sparse:
@@ -653,6 +655,7 @@
"erofs_pcluster_size",
"erofs_share_dup_blocks",
"erofs_sparse_flag",
+ "erofs_use_legacy_compression",
"squashfs_sparse_flag",
"system_f2fs_compress",
"system_f2fs_sldc_flags",
@@ -698,6 +701,7 @@
(True, "avb_{}_hashtree_enable", "avb_hashtree_enable"),
(True, "avb_{}_key_path", "avb_key_path"),
(True, "avb_{}_salt", "avb_salt"),
+ (True, "erofs_use_legacy_compression", "erofs_use_legacy_compression"),
(True, "ext4_share_dup_blocks", "ext4_share_dup_blocks"),
(True, "{}_base_fs_file", "base_fs_file"),
(True, "{}_disable_sparse", "disable_sparse"),
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index bd3af68..4816a23 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1782,6 +1782,9 @@
if info_dict.get("recovery_as_boot") == "true":
return True # the recovery-as-boot boot.img has a RECOVERY ramdisk.
+ if info_dict.get("gki_boot_image_without_ramdisk") == "true":
+ return False # A GKI boot.img has no ramdisk since Android-13.
+
if info_dict.get("system_root_image") == "true":
# The ramdisk content is merged into the system.img, so there is NO
# ramdisk in the boot.img or boot-<kernel version>.img.