Distinguish the intent of PackagingSpec

A PackagingSpec actually means either of two: an installation of a file
(i.e. putting the file on a filesystem image), or a simple gathering.
However, so far, the two different intents was not visible in
PackagingSpecs returns from TransitivePackagingSpecs().

With this change, the two different intents are recorded in
PackagingSpec. A PackagingSpec has a boolean field which records the
value of the SkipInstall() of the module where the PackagingSpec was
created from.

This could be used by a module like android_system_image which wants to
follow the "installation" semantic. For example, the module type doesn't
want to include a stub variant of a shared lib.

This change doesn't make use of the new field, yet.

Bug: 335506668
Test: go test ./...
Change-Id: If0106642a11ba804630df79b4c5ebd608a77a6b1
This commit is contained in:
Jiyong Park
2024-04-30 21:24:21 +09:00
parent 5c3c3274fe
commit 4152b192e0
2 changed files with 12 additions and 0 deletions

View File

@@ -476,6 +476,7 @@ func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, e
executable: executable,
effectiveLicenseFiles: &licenseFiles,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
}
m.packagingSpecs = append(m.packagingSpecs, spec)
return spec
@@ -599,6 +600,7 @@ func (m *moduleContext) InstallSymlink(installPath InstallPath, name string, src
symlinkTarget: relPath,
executable: false,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
})
return fullInstallPath
@@ -640,6 +642,7 @@ func (m *moduleContext) InstallAbsoluteSymlink(installPath InstallPath, name str
symlinkTarget: absPath,
executable: false,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
})
return fullInstallPath

View File

@@ -43,6 +43,11 @@ type PackagingSpec struct {
effectiveLicenseFiles *Paths
partition string
// Whether this packaging spec represents an installation of the srcPath (i.e. this struct
// is created via InstallFile or InstallSymlink) or a simple packaging (i.e. created via
// PackageFile).
skipInstall bool
}
// Get file name of installed package
@@ -74,6 +79,10 @@ func (p *PackagingSpec) Partition() string {
return p.partition
}
func (p *PackagingSpec) SkipInstall() bool {
return p.skipInstall
}
type PackageModule interface {
Module
packagingBase() *PackagingBase