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

Commit dcca9dbe authored by Priyanka Advani (xWF)'s avatar Priyanka Advani (xWF) Committed by Gerrit Code Review
Browse files

Revert "Add baseProps and fsProps into system bp generation"

This reverts commit a077b940.

Reason for revert: Droidmonitor created revert due to b/374143532. Will be verifying through ABTD before submission.

Change-Id: If1a408d4be11e232b475af456f4b7a83cdf0683d
parent a077b940
Loading
Loading
Loading
Loading
+30 −49
Original line number Diff line number Diff line
@@ -339,58 +339,23 @@ var (
// Creates a soong module to build the given partition. Returns false if we can't support building
// it.
func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partitionType string) bool {
	baseProps := generateBaseProps(proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)))

	fsProps, supported := generateFsProps(ctx, partitionType)
	if !supported {
		return false
	}

	var module android.Module
	if partitionType == "system" {
		module = ctx.CreateModule(filesystem.SystemImageFactory, baseProps, fsProps)
	} else {
		// Explicitly set the partition.
		fsProps.Partition_type = proptools.StringPtr(partitionType)
		module = ctx.CreateModule(filesystem.FilesystemFactory, baseProps, fsProps)
	}
	module.HideFromMake()
	return true
}

type filesystemBaseProperty struct {
	baseProps := &struct {
		Name             *string
		Compile_multilib *string
}

func generateBaseProps(namePtr *string) *filesystemBaseProperty {
	return &filesystemBaseProperty{
		Name:             namePtr,
	}{
		Name:             proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)),
		Compile_multilib: proptools.StringPtr("both"),
	}
}

func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*filesystem.FilesystemProperties, bool) {
	fsProps := &filesystem.FilesystemProperties{}

	partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
	specificPartitionVars := partitionVars.PartitionQualifiedVariables[partitionType]

	// BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE
	fsType := specificPartitionVars.BoardFileSystemType
	if fsType == "" {
		fsType = "ext4" //default
	}
	fsProps.Type = proptools.StringPtr(fsType)
	if filesystem.GetFsTypeFromString(ctx, *fsProps.Type).IsUnknown() {
		// Currently the android_filesystem module type only supports a handful of FS types like ext4, erofs
		return nil, false
	}

	// Don't build this module on checkbuilds, the soong-built partitions are still in-progress
	// and sometimes don't build.
	fsProps.Unchecked_module = proptools.BoolPtr(true)

	partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
	specificPartitionVars := partitionVars.PartitionQualifiedVariables[partitionType]

	// BOARD_AVB_ENABLE
	fsProps.Use_avb = proptools.BoolPtr(partitionVars.BoardAvbEnable)
	// BOARD_AVB_KEY_PATH
@@ -403,6 +368,16 @@ func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*fil
	}

	fsProps.Partition_name = proptools.StringPtr(partitionType)
	// BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE
	fsType := specificPartitionVars.BoardFileSystemType
	if fsType == "" {
		fsType = "ext4" //default
	}
	fsProps.Type = proptools.StringPtr(fsType)
	if filesystem.GetFsTypeFromString(ctx, *fsProps.Type).IsUnknown() {
		// Currently the android_filesystem module type only supports a handful of FS types like ext4, erofs
		return false
	}

	fsProps.Base_dir = proptools.StringPtr(partitionType)

@@ -433,8 +408,16 @@ func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*fil
	// - filesystemProperties.Build_logtags
	// - filesystemProperties.Fsverity.Libs
	// - systemImageProperties.Linker_config_src

	return fsProps, true
	var module android.Module
	if partitionType == "system" {
		module = ctx.CreateModule(filesystem.SystemImageFactory, baseProps, fsProps)
	} else {
		// Explicitly set the partition.
		fsProps.Partition_type = proptools.StringPtr(partitionType)
		module = ctx.CreateModule(filesystem.FilesystemFactory, baseProps, fsProps)
	}
	module.HideFromMake()
	return true
}

func (f *filesystemCreator) createDiffTest(ctx android.ModuleContext, partitionType string) android.Path {
@@ -507,21 +490,19 @@ func (f *filesystemCreator) GenerateAndroidBuildActions(ctx android.ModuleContex
	ctx.Phony("soong_generated_filesystem_tests", diffTestFiles...)
}

// TODO: assemble baseProps and fsProps here
func generateBpContent(ctx android.EarlyModuleContext, partitionType string) string {
	// Currently only system partition is supported
	if partitionType != "system" {
		return ""
	}

	baseProps := generateBaseProps(proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)))
	fsProps, _ := generateFsProps(ctx, partitionType)

	deps := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).fsDeps
	depProps := &android.PackagingProperties{
		Deps: android.NewSimpleConfigurable(fullyQualifiedModuleNames(deps[partitionType])),
	}

	result, err := proptools.RepackProperties([]interface{}{baseProps, fsProps, depProps})
	result, err := proptools.RepackProperties([]interface{}{depProps})
	if err != nil {
		ctx.ModuleErrorf(err.Error())
	}