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

Commit 7ceb14aa authored by Colin Cross's avatar Colin Cross
Browse files

Revert "Use Unique lists instead of pointers in PackagingSpec."

This reverts commit db901f84.

Bug: 376489729
Test: builds
Flag: EXEMPT bugfix
Change-Id: Ia5dfcf7f4e3c70042001e60850e366934ab14df4
parent e5b61ba3
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -16,14 +16,13 @@ package android

import (
	"fmt"
	"github.com/google/blueprint/depset"
	"path"
	"path/filepath"
	"strings"

	"github.com/google/blueprint"
	"github.com/google/blueprint/depset"
	"github.com/google/blueprint/proptools"
	"github.com/google/blueprint/uniquelist"
)

// BuildParameters describes the set of potential parameters to build a Ninja rule.
@@ -555,8 +554,8 @@ func (m *moduleContext) PackageFile(installPath InstallPath, name string, srcPat
	return m.packageFile(fullInstallPath, srcPath, false)
}

func (m *moduleContext) getAconfigPaths() Paths {
	return m.aconfigFilePaths
func (m *moduleContext) getAconfigPaths() *Paths {
	return &m.aconfigFilePaths
}

func (m *moduleContext) setAconfigPaths(paths Paths) {
@@ -571,12 +570,12 @@ func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, e
		srcPath:               srcPath,
		symlinkTarget:         "",
		executable:            executable,
		effectiveLicenseFiles: uniquelist.Make(licenseFiles),
		effectiveLicenseFiles: &licenseFiles,
		partition:             fullInstallPath.partition,
		skipInstall:           m.skipInstall(),
		aconfigPaths:          uniquelist.Make(m.getAconfigPaths()),
		aconfigPaths:          m.getAconfigPaths(),
		archType:              m.target.Arch.ArchType,
		overrides:             uniquelist.Make(overrides),
		overrides:             &overrides,
		owner:                 m.ModuleName(),
	}
	m.packagingSpecs = append(m.packagingSpecs, spec)
@@ -704,9 +703,9 @@ func (m *moduleContext) InstallSymlink(installPath InstallPath, name string, src
		executable:       false,
		partition:        fullInstallPath.partition,
		skipInstall:      m.skipInstall(),
		aconfigPaths:     uniquelist.Make(m.getAconfigPaths()),
		aconfigPaths:     m.getAconfigPaths(),
		archType:         m.target.Arch.ArchType,
		overrides:        uniquelist.Make(overrides),
		overrides:        &overrides,
		owner:            m.ModuleName(),
	})

@@ -751,9 +750,9 @@ func (m *moduleContext) InstallAbsoluteSymlink(installPath InstallPath, name str
		executable:       false,
		partition:        fullInstallPath.partition,
		skipInstall:      m.skipInstall(),
		aconfigPaths:     uniquelist.Make(m.getAconfigPaths()),
		aconfigPaths:     m.getAconfigPaths(),
		archType:         m.target.Arch.ArchType,
		overrides:        uniquelist.Make(overrides),
		overrides:        &overrides,
		owner:            m.ModuleName(),
	})

+20 −16
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import (
	"github.com/google/blueprint"
	"github.com/google/blueprint/gobtools"
	"github.com/google/blueprint/proptools"
	"github.com/google/blueprint/uniquelist"
)

// PackagingSpec abstracts a request to place a built artifact at a certain path in a package. A
@@ -44,7 +43,7 @@ type PackagingSpec struct {
	// Whether relPathInPackage should be marked as executable or not
	executable bool

	effectiveLicenseFiles uniquelist.UniqueList[Path]
	effectiveLicenseFiles *Paths

	partition string

@@ -54,13 +53,13 @@ type PackagingSpec struct {
	skipInstall bool

	// Paths of aconfig files for the built artifact
	aconfigPaths uniquelist.UniqueList[Path]
	aconfigPaths *Paths

	// ArchType of the module which produced this packaging spec
	archType ArchType

	// List of module names that this packaging spec overrides
	overrides uniquelist.UniqueList[string]
	overrides *[]string

	// Name of the module where this packaging spec is output of
	owner string
@@ -71,12 +70,12 @@ type packagingSpecGob struct {
	SrcPath               Path
	SymlinkTarget         string
	Executable            bool
	EffectiveLicenseFiles Paths
	EffectiveLicenseFiles *Paths
	Partition             string
	SkipInstall           bool
	AconfigPaths          Paths
	AconfigPaths          *Paths
	ArchType              ArchType
	Overrides             []string
	Overrides             *[]string
	Owner                 string
}

@@ -86,12 +85,12 @@ func (p *PackagingSpec) ToGob() *packagingSpecGob {
		SrcPath:               p.srcPath,
		SymlinkTarget:         p.symlinkTarget,
		Executable:            p.executable,
		EffectiveLicenseFiles: p.effectiveLicenseFiles.ToSlice(),
		EffectiveLicenseFiles: p.effectiveLicenseFiles,
		Partition:             p.partition,
		SkipInstall:           p.skipInstall,
		AconfigPaths:          p.aconfigPaths.ToSlice(),
		AconfigPaths:          p.aconfigPaths,
		ArchType:              p.archType,
		Overrides:             p.overrides.ToSlice(),
		Overrides:             p.overrides,
		Owner:                 p.owner,
	}
}
@@ -101,12 +100,12 @@ func (p *PackagingSpec) FromGob(data *packagingSpecGob) {
	p.srcPath = data.SrcPath
	p.symlinkTarget = data.SymlinkTarget
	p.executable = data.Executable
	p.effectiveLicenseFiles = uniquelist.Make(data.EffectiveLicenseFiles)
	p.effectiveLicenseFiles = data.EffectiveLicenseFiles
	p.partition = data.Partition
	p.skipInstall = data.SkipInstall
	p.aconfigPaths = uniquelist.Make(data.AconfigPaths)
	p.aconfigPaths = data.AconfigPaths
	p.archType = data.ArchType
	p.overrides = uniquelist.Make(data.Overrides)
	p.overrides = data.Overrides
	p.owner = data.Owner
}

@@ -156,7 +155,10 @@ func (p *PackagingSpec) SetRelPathInPackage(relPathInPackage string) {
}

func (p *PackagingSpec) EffectiveLicenseFiles() Paths {
	return p.effectiveLicenseFiles.ToSlice()
	if p.effectiveLicenseFiles == nil {
		return Paths{}
	}
	return *p.effectiveLicenseFiles
}

func (p *PackagingSpec) Partition() string {
@@ -169,7 +171,7 @@ func (p *PackagingSpec) SkipInstall() bool {

// Paths of aconfig files for the built artifact
func (p *PackagingSpec) GetAconfigPaths() Paths {
	return p.aconfigPaths.ToSlice()
	return *p.aconfigPaths
}

type PackageModule interface {
@@ -434,7 +436,9 @@ func (p *PackagingBase) GatherPackagingSpecsWithFilter(ctx ModuleContext, filter
			}
			all = append(all, ps)
			depNames = append(depNames, child.Name())
			overridden = append(overridden, ps.overrides.ToSlice()...)
			if ps.overrides != nil {
				overridden = append(overridden, *ps.overrides...)
			}
		}
	})