Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6940b789 authored by Dennis Shen's avatar Dennis Shen Committed by Gerrit Code Review
Browse files

Merge "Treat system_ext as system in container designation" into main

parents 187e280d b3681ad5
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#

# 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)
# $(2): installed aconfig flags file (out)
# $(3): the partition (in)
# $(4): input aconfig files for the partition (in)
define generate-partition-aconfig-flag-file
$(eval $(strip $(1)): PRIVATE_OUT := $(strip $(1)))
$(eval $(strip $(1)): PRIVATE_IN := $(strip $(4)))
@@ -36,12 +35,14 @@ $(strip $(1)): $(ACONFIG) $(strip $(4))
	mkdir -p $$(dir $$(PRIVATE_OUT))
	$$(if $$(PRIVATE_IN), \
		$$(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) \
	)
$(call copy-one-file, $(1), $(2))
endef


# Create a summary file of build flags for each partition
# $(1): built 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))
endef


$(foreach partition, $(_FLAG_PARTITIONS), \
	$(eval aconfig_flag_summaries_protobuf.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/aconfig_flags.pb) \
	$(eval $(call generate-partition-aconfig-flag-file, \
			$(TARGET_OUT_FLAGS)/$(partition)/aconfig_flags.pb, \
			$(aconfig_flag_summaries_protobuf.$(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) \
				)), \
				) \
				$(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_val.$(partition):=) \
)
+12 −2
Original line number Diff line number Diff line
@@ -79,8 +79,18 @@ pub fn parse_flags(
            .read_to_string(&mut contents)
            .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())?;

        // 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!(
            package == flag_declarations.package(),
            "failed to parse {}: expected package {}, got {}",