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:
Bob Badour
2020-02-18 20:21:55 -08:00
parent 004d717158
commit a75b057e17
8 changed files with 56 additions and 28 deletions

View File

@@ -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(&notice, "notice")
} else {
optPath = ctx.ExpandOptionalSource(&notice, "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)