Include license information for vendor and host snapshots
In addition to the license text files, include license kinds information to json file. Also, use the original paths of license text files that are copied to NOTICE_FILES directory. This will be used when generating snapshots from the snapshot build. Bug: 271539873 Test: m vendor-snapshot Change-Id: I0c0427bb66f2c1fca322d5554aa66220a3b62fb3
This commit is contained in:
11
cc/util.go
11
cc/util.go
@@ -100,17 +100,6 @@ func makeSymlinkCmd(linkDirOnDevice string, linkName string, target string) stri
|
||||
"ln -sf " + target + " " + filepath.Join(dir, linkName)
|
||||
}
|
||||
|
||||
func combineNoticesRule(ctx android.SingletonContext, paths android.Paths, out string) android.OutputPath {
|
||||
outPath := android.PathForOutput(ctx, out)
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: android.Cat,
|
||||
Inputs: paths,
|
||||
Output: outPath,
|
||||
Description: "combine notices for " + out,
|
||||
})
|
||||
return outPath
|
||||
}
|
||||
|
||||
// Dump a map to a list file as:
|
||||
//
|
||||
// {key1} {value1}
|
||||
|
@@ -160,7 +160,7 @@ type snapshotJsonFlags struct {
|
||||
MinSdkVersion string `json:",omitempty"`
|
||||
}
|
||||
|
||||
var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotSingleton, ctx android.SingletonContext, snapshotArchDir string) android.Paths {
|
||||
var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotSingleton, ctx android.SingletonContext, snapshotArchDir string) snapshot.SnapshotPaths {
|
||||
/*
|
||||
Vendor snapshot zipped artifacts directory structure for cc modules:
|
||||
{SNAPSHOT_ARCH}/
|
||||
@@ -195,10 +195,10 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
||||
*/
|
||||
|
||||
var snapshotOutputs android.Paths
|
||||
var snapshotNotices android.Paths
|
||||
|
||||
includeDir := filepath.Join(snapshotArchDir, "include")
|
||||
configsDir := filepath.Join(snapshotArchDir, "configs")
|
||||
noticeDir := filepath.Join(snapshotArchDir, "NOTICE_FILES")
|
||||
|
||||
installedNotices := make(map[string]bool)
|
||||
installedConfigs := make(map[string]bool)
|
||||
@@ -228,7 +228,7 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
||||
prop := snapshotJsonFlags{}
|
||||
|
||||
// Common properties among snapshots.
|
||||
prop.ModuleName = ctx.ModuleName(m)
|
||||
prop.InitBaseSnapshotPropsWithName(m, ctx.ModuleName(m))
|
||||
if supportsVndkExt(s.Image) && m.IsVndkExt() {
|
||||
// vndk exts are installed to /vendor/lib(64)?/vndk(-sp)?
|
||||
if m.IsVndkSp() {
|
||||
@@ -406,13 +406,10 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
||||
headers = append(headers, m.SnapshotHeaders()...)
|
||||
}
|
||||
|
||||
if len(m.EffectiveLicenseFiles()) > 0 {
|
||||
noticeName := ctx.ModuleName(m) + ".txt"
|
||||
noticeOut := filepath.Join(noticeDir, noticeName)
|
||||
// skip already copied notice file
|
||||
if !installedNotices[noticeOut] {
|
||||
installedNotices[noticeOut] = true
|
||||
snapshotOutputs = append(snapshotOutputs, combineNoticesRule(ctx, m.EffectiveLicenseFiles(), noticeOut))
|
||||
for _, notice := range m.EffectiveLicenseFiles() {
|
||||
if _, ok := installedNotices[notice.String()]; !ok {
|
||||
installedNotices[notice.String()] = true
|
||||
snapshotNotices = append(snapshotNotices, notice)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -422,7 +419,7 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
||||
snapshotOutputs = append(snapshotOutputs, copyFile(ctx, header, filepath.Join(includeDir, header.String()), s.Fake))
|
||||
}
|
||||
|
||||
return snapshotOutputs
|
||||
return snapshot.SnapshotPaths{OutputFiles: snapshotOutputs, NoticeFiles: snapshotNotices}
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Reference in New Issue
Block a user