Notice support for APEX
Notice file for an APEX is created by merging notice files for the
modules included in it (plus the notice file for the APEX itself if
specified).
Notice files having the same content are not duplicated; it is emitted
only once.
Bug: 128701495
Test: m (apex_test is amended)
Test: m and inspect $(PRODUCT_OUT)/obj/NOTICE.txt to check there are
license entries for /system/apex/*.apex files
Change-Id: I169d91038291a6c71615de97cf5b03174afab5d4
diff --git a/android/module.go b/android/module.go
index afd2b71..abf2cae 100644
--- a/android/module.go
+++ b/android/module.go
@@ -189,6 +189,7 @@
InstallInRecovery() bool
SkipInstall()
ExportedToMake() bool
+ NoticeFile() OptionalPath
AddProperties(props ...interface{})
GetProperties() []interface{}
@@ -466,7 +467,7 @@
noAddressSanitizer bool
installFiles Paths
checkbuildFiles Paths
- noticeFile Path
+ noticeFile OptionalPath
// Used by buildTargetSingleton to create checkbuild and per-directory build targets
// Only set on the final variant of each module
@@ -667,6 +668,10 @@
return String(a.commonProperties.Owner)
}
+func (a *ModuleBase) NoticeFile() OptionalPath {
+ return a.noticeFile
+}
+
func (a *ModuleBase) generateModuleTarget(ctx ModuleContext) {
allInstalledFiles := Paths{}
allCheckbuildFiles := Paths{}
@@ -852,9 +857,12 @@
a.installFiles = append(a.installFiles, ctx.installFiles...)
a.checkbuildFiles = append(a.checkbuildFiles, ctx.checkbuildFiles...)
- if a.commonProperties.Notice != nil {
- // For filegroup-based notice file references.
- a.noticeFile = PathForModuleSrc(ctx, *a.commonProperties.Notice)
+ notice := proptools.StringDefault(a.commonProperties.Notice, "NOTICE")
+ if m := SrcIsModule(notice); m != "" {
+ a.noticeFile = ctx.ExpandOptionalSource(¬ice, "notice")
+ } else {
+ noticePath := filepath.Join(ctx.ModuleDir(), notice)
+ a.noticeFile = ExistentPathForSource(ctx, noticePath)
}
}