Merge "Treat system_ext as system in container designation" into main am: 6940b7898d am: b0d8105009

Original change: https://android-review.googlesource.com/c/platform/build/+/3261300

Change-Id: I2fa3f3306cd29b7d730020fd015930dfbc899f7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Dennis Shen
2024-09-13 02:20:12 +00:00
committed by Automerger Merge Worker
2 changed files with 28 additions and 12 deletions

View File

@@ -18,7 +18,7 @@
# #
# TODO: Should we do all of the images in $(IMAGES_TO_BUILD)? # TODO: Should we do all of the images in $(IMAGES_TO_BUILD)?
_FLAG_PARTITIONS := product system system_ext vendor _FLAG_PARTITIONS := product system vendor
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@@ -28,7 +28,6 @@ _FLAG_PARTITIONS := product system system_ext vendor
# $(1): built aconfig flags file (out) # $(1): built aconfig flags file (out)
# $(2): installed aconfig flags file (out) # $(2): installed aconfig flags file (out)
# $(3): the partition (in) # $(3): the partition (in)
# $(4): input aconfig files for the partition (in)
define generate-partition-aconfig-flag-file define generate-partition-aconfig-flag-file
$(eval $(strip $(1)): PRIVATE_OUT := $(strip $(1))) $(eval $(strip $(1)): PRIVATE_OUT := $(strip $(1)))
$(eval $(strip $(1)): PRIVATE_IN := $(strip $(4))) $(eval $(strip $(1)): PRIVATE_IN := $(strip $(4)))
@@ -36,12 +35,14 @@ $(strip $(1)): $(ACONFIG) $(strip $(4))
mkdir -p $$(dir $$(PRIVATE_OUT)) mkdir -p $$(dir $$(PRIVATE_OUT))
$$(if $$(PRIVATE_IN), \ $$(if $$(PRIVATE_IN), \
$$(ACONFIG) dump --dedup --format protobuf --out $$(PRIVATE_OUT) \ $$(ACONFIG) dump --dedup --format protobuf --out $$(PRIVATE_OUT) \
--filter container:$$(strip $(3)) $$(addprefix --cache ,$$(PRIVATE_IN)), \ --filter container:$(strip $(3)) \
$$(addprefix --cache ,$$(PRIVATE_IN)), \
echo -n > $$(PRIVATE_OUT) \ echo -n > $$(PRIVATE_OUT) \
) )
$(call copy-one-file, $(1), $(2)) $(call copy-one-file, $(1), $(2))
endef endef
# Create a summary file of build flags for each partition # Create a summary file of build flags for each partition
# $(1): built aconfig flags file (out) # $(1): built aconfig flags file (out)
# $(2): installed aconfig flags file (out) # $(2): installed aconfig flags file (out)
@@ -59,16 +60,22 @@ $(strip $(1)): $(ACONFIG) $(strip $(3))
$(call copy-one-file, $(1), $(2)) $(call copy-one-file, $(1), $(2))
endef endef
$(foreach partition, $(_FLAG_PARTITIONS), \ $(foreach partition, $(_FLAG_PARTITIONS), \
$(eval aconfig_flag_summaries_protobuf.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/aconfig_flags.pb) \ $(eval aconfig_flag_summaries_protobuf.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/aconfig_flags.pb) \
$(eval $(call generate-partition-aconfig-flag-file, \ $(eval $(call generate-partition-aconfig-flag-file, \
$(TARGET_OUT_FLAGS)/$(partition)/aconfig_flags.pb, \ $(TARGET_OUT_FLAGS)/$(partition)/aconfig_flags.pb, \
$(aconfig_flag_summaries_protobuf.$(partition)), \ $(aconfig_flag_summaries_protobuf.$(partition)), \
$(partition), \ $(partition), \
$(sort $(foreach m,$(call register-names-for-partition, $(partition)), \ $(sort \
$(foreach m, $(call register-names-for-partition, $(partition)), \
$(ALL_MODULES.$(m).ACONFIG_FILES) \ $(ALL_MODULES.$(m).ACONFIG_FILES) \
)), \ ) \
$(if $(filter system, $(partition)), \
$(foreach m, $(call register-names-for-partition, system_ext), \
$(ALL_MODULES.$(m).ACONFIG_FILES) \
) \
) \
) \
)) \ )) \
) )
@@ -175,4 +182,3 @@ $(foreach partition, $(_FLAG_PARTITIONS), \
$(eval aconfig_storage_flag_map.$(partition):=) \ $(eval aconfig_storage_flag_map.$(partition):=) \
$(eval aconfig_storage_flag_val.$(partition):=) \ $(eval aconfig_storage_flag_val.$(partition):=) \
) )

View File

@@ -79,8 +79,18 @@ pub fn parse_flags(
.read_to_string(&mut contents) .read_to_string(&mut contents)
.with_context(|| format!("failed to read {}", input.source))?; .with_context(|| format!("failed to read {}", input.source))?;
let flag_declarations = aconfig_protos::flag_declarations::try_from_text_proto(&contents) let mut flag_declarations =
aconfig_protos::flag_declarations::try_from_text_proto(&contents)
.with_context(|| input.error_context())?; .with_context(|| input.error_context())?;
// system_ext flags should be treated as system flags as we are combining /system_ext
// and /system as one container
// TODO: remove this logic when we start enforcing that system_ext cannot be set as
// container in aconfig declaration files.
if flag_declarations.container() == "system_ext" {
flag_declarations.set_container(String::from("system"));
}
ensure!( ensure!(
package == flag_declarations.package(), package == flag_declarations.package(),
"failed to parse {}: expected package {}, got {}", "failed to parse {}: expected package {}, got {}",