Unless overridden include LICENSE files in notices.
As a second step to removing the go/android3p instructions to copy or to link NOTICE to LICENSE, include LICENSE files in the notices, which will allow deleting all of the copied/linked NOTICE files. The change causes a few additions to the system image notice files. Test: manually built and compared before and after notices Change-Id: Ia7bc58e2eba7bed5e63934881b5298201a93bc3e
This commit is contained in:
parent
004d717158
commit
a75b057e17
8 changed files with 56 additions and 28 deletions
|
@ -236,8 +236,8 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
|
|||
}
|
||||
}
|
||||
|
||||
if amod.noticeFile.Valid() {
|
||||
a.SetString("LOCAL_NOTICE_FILE", amod.noticeFile.String())
|
||||
if len(amod.noticeFiles) > 0 {
|
||||
a.SetString("LOCAL_NOTICE_FILE", strings.Join(amod.noticeFiles.Strings(), " "))
|
||||
}
|
||||
|
||||
if host {
|
||||
|
|
|
@ -218,7 +218,7 @@ type Module interface {
|
|||
ExportedToMake() bool
|
||||
InitRc() Paths
|
||||
VintfFragments() Paths
|
||||
NoticeFile() OptionalPath
|
||||
NoticeFiles() Paths
|
||||
|
||||
AddProperties(props ...interface{})
|
||||
GetProperties() []interface{}
|
||||
|
@ -645,7 +645,7 @@ type ModuleBase struct {
|
|||
noAddressSanitizer bool
|
||||
installFiles Paths
|
||||
checkbuildFiles Paths
|
||||
noticeFile OptionalPath
|
||||
noticeFiles Paths
|
||||
|
||||
// Used by buildTargetSingleton to create checkbuild and per-directory build targets
|
||||
// Only set on the final variant of each module
|
||||
|
@ -904,8 +904,8 @@ func (m *ModuleBase) Owner() string {
|
|||
return String(m.commonProperties.Owner)
|
||||
}
|
||||
|
||||
func (m *ModuleBase) NoticeFile() OptionalPath {
|
||||
return m.noticeFile
|
||||
func (m *ModuleBase) NoticeFiles() Paths {
|
||||
return m.noticeFiles
|
||||
}
|
||||
|
||||
func (m *ModuleBase) setImageVariation(variant string) {
|
||||
|
@ -1151,12 +1151,25 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||
}
|
||||
})
|
||||
|
||||
notice := proptools.StringDefault(m.commonProperties.Notice, "NOTICE")
|
||||
m.noticeFiles = make([]Path, 0)
|
||||
optPath := OptionalPath{}
|
||||
notice := proptools.StringDefault(m.commonProperties.Notice, "")
|
||||
if module := SrcIsModule(notice); module != "" {
|
||||
m.noticeFile = ctx.ExpandOptionalSource(¬ice, "notice")
|
||||
} else {
|
||||
optPath = ctx.ExpandOptionalSource(¬ice, "notice")
|
||||
} else if notice != "" {
|
||||
noticePath := filepath.Join(ctx.ModuleDir(), notice)
|
||||
m.noticeFile = ExistentPathForSource(ctx, noticePath)
|
||||
optPath = ExistentPathForSource(ctx, noticePath)
|
||||
}
|
||||
if optPath.Valid() {
|
||||
m.noticeFiles = append(m.noticeFiles, optPath.Path())
|
||||
} else {
|
||||
for _, notice = range []string{"LICENSE", "LICENCE", "NOTICE"} {
|
||||
noticePath := filepath.Join(ctx.ModuleDir(), notice)
|
||||
optPath = ExistentPathForSource(ctx, noticePath)
|
||||
if optPath.Valid() {
|
||||
m.noticeFiles = append(m.noticeFiles, optPath.Path())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.module.GenerateAndroidBuildActions(ctx)
|
||||
|
|
|
@ -120,8 +120,8 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
|||
fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS :=", strings.Join(fi.symlinks, " "))
|
||||
}
|
||||
|
||||
if fi.module != nil && fi.module.NoticeFile().Valid() {
|
||||
fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", fi.module.NoticeFile().Path().String())
|
||||
if fi.module != nil && len(fi.module.NoticeFiles()) > 0 {
|
||||
fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", strings.Join(fi.module.NoticeFiles().Strings(), " "))
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
|
||||
|
|
|
@ -215,15 +215,15 @@ func (a *apexBundle) buildNoticeFiles(ctx android.ModuleContext, apexFileName st
|
|||
noticeFiles := []android.Path{}
|
||||
for _, f := range a.filesInfo {
|
||||
if f.module != nil {
|
||||
notice := f.module.NoticeFile()
|
||||
if notice.Valid() {
|
||||
noticeFiles = append(noticeFiles, notice.Path())
|
||||
notices := f.module.NoticeFiles()
|
||||
if len(notices) > 0 {
|
||||
noticeFiles = append(noticeFiles, notices...)
|
||||
}
|
||||
}
|
||||
}
|
||||
// append the notice file specified in the apex module itself
|
||||
if a.NoticeFile().Valid() {
|
||||
noticeFiles = append(noticeFiles, a.NoticeFile().Path())
|
||||
if len(a.NoticeFiles()) > 0 {
|
||||
noticeFiles = append(noticeFiles, a.NoticeFiles()...)
|
||||
}
|
||||
|
||||
if len(noticeFiles) == 0 {
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
14
java/app.go
14
java/app.go
|
@ -390,16 +390,20 @@ func (a *AndroidApp) noticeBuildActions(ctx android.ModuleContext) {
|
|||
return false
|
||||
}
|
||||
|
||||
path := child.(android.Module).NoticeFile()
|
||||
if path.Valid() {
|
||||
noticePathSet[path.Path()] = true
|
||||
paths := child.(android.Module).NoticeFiles()
|
||||
if len(paths) > 0 {
|
||||
for _, path := range paths {
|
||||
noticePathSet[path] = true
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
// If the app has one, add it too.
|
||||
if a.NoticeFile().Valid() {
|
||||
noticePathSet[a.NoticeFile().Path()] = true
|
||||
if len(a.NoticeFiles()) > 0 {
|
||||
for _, path := range a.NoticeFiles() {
|
||||
noticePathSet[path] = true
|
||||
}
|
||||
}
|
||||
|
||||
if len(noticePathSet) == 0 {
|
||||
|
|
Loading…
Reference in a new issue