aboutsummaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2019-03-18 12:01:38 +0900
committerJiyong Park <jiyong@google.com>2019-03-21 08:05:50 +0900
commit52818fcde8265fd43ad5f331f57122ecdbe7a6be (patch)
tree9c0edd5e4f9dfcae48cb3f87ff0f10c11b3fa776 /android
parent5a3f31b28451717dd7e9d948bcaa5644de759b17 (diff)
downloadsoong-52818fcde8265fd43ad5f331f57122ecdbe7a6be.tar.gz
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
Diffstat (limited to 'android')
-rw-r--r--android/androidmk.go2
-rw-r--r--android/module.go16
2 files changed, 13 insertions, 5 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index fc34471cc..bd49e4c6f 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -319,7 +319,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
}
}
- if amod.noticeFile != nil {
+ if amod.noticeFile.Valid() {
fmt.Fprintln(&data.preamble, "LOCAL_NOTICE_FILE :=", amod.noticeFile.String())
}
diff --git a/android/module.go b/android/module.go
index afd2b714f..abf2cae43 100644
--- a/android/module.go
+++ b/android/module.go
@@ -189,6 +189,7 @@ type Module interface {
InstallInRecovery() bool
SkipInstall()
ExportedToMake() bool
+ NoticeFile() OptionalPath
AddProperties(props ...interface{})
GetProperties() []interface{}
@@ -466,7 +467,7 @@ type ModuleBase struct {
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 @@ func (a *ModuleBase) Owner() string {
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 @@ func (a *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
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(&notice, "notice")
+ } else {
+ noticePath := filepath.Join(ctx.ModuleDir(), notice)
+ a.noticeFile = ExistentPathForSource(ctx, noticePath)
}
}