Merge "Unless overridden include LICENSE files in notices."

This commit is contained in:
Bob Badour
2020-02-26 20:37:22 +00:00
committed by Gerrit Code Review
8 changed files with 56 additions and 28 deletions

View File

@@ -117,6 +117,17 @@ func copyFile(ctx android.SingletonContext, path android.Path, out string) andro
return outPath
}
func combineNotices(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
}
func writeStringToFile(ctx android.SingletonContext, content, out string) android.OutputPath {
outPath := android.PathForOutput(ctx, out)
ctx.Build(pctx, android.BuildParams{

View File

@@ -661,14 +661,14 @@ func (c *vendorSnapshotSingleton) GenerateBuildActions(ctx android.SingletonCont
headers = append(headers, exportedHeaders(ctx, l)...)
}
if m.NoticeFile().Valid() {
if len(m.NoticeFiles()) > 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, copyFile(
ctx, m.NoticeFile().Path(), noticeOut))
snapshotOutputs = append(snapshotOutputs, combineNotices(
ctx, m.NoticeFiles(), noticeOut))
}
}
})

View File

@@ -644,13 +644,13 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
moduleNames[stem] = ctx.ModuleName(m)
modulePaths[stem] = ctx.ModuleDir(m)
if m.NoticeFile().Valid() {
if len(m.NoticeFiles()) > 0 {
noticeName := stem + ".txt"
// skip already copied notice file
if _, ok := noticeBuilt[noticeName]; !ok {
noticeBuilt[noticeName] = true
snapshotOutputs = append(snapshotOutputs, copyFile(
ctx, m.NoticeFile().Path(), filepath.Join(noticeDir, noticeName)))
snapshotOutputs = append(snapshotOutputs, combineNotices(
ctx, m.NoticeFiles(), filepath.Join(noticeDir, noticeName)))
}
}