Add filegroup support to notice property.
Also, replace all notice file references with the parent directory
pattern(../) with filegroups.
Bug: 118899640
Test: Manual build
Change-Id: I841345d747f41a3bb5beea66ad87a979734c39a4
diff --git a/android/androidmk.go b/android/androidmk.go
index 493ba97..f150768 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -277,8 +277,8 @@
}
}
- if amod.commonProperties.Notice != nil {
- fmt.Fprintln(&data.preamble, "LOCAL_NOTICE_FILE :=", "$(LOCAL_PATH)/"+*amod.commonProperties.Notice)
+ if amod.noticeFile != nil {
+ fmt.Fprintln(&data.preamble, "LOCAL_NOTICE_FILE :=", amod.noticeFile.String())
}
if host {
diff --git a/android/module.go b/android/module.go
index bf49ca2..f249306 100644
--- a/android/module.go
+++ b/android/module.go
@@ -441,6 +441,7 @@
noAddressSanitizer bool
installFiles Paths
checkbuildFiles Paths
+ noticeFile Path
// Used by buildTargetSingleton to create checkbuild and per-directory build targets
// Only set on the final variant of each module
@@ -789,6 +790,11 @@
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 = ctx.ExpandSource(*a.commonProperties.Notice, "notice")
+ }
}
if a == ctx.FinalModule().(Module).base() {
diff --git a/android/mutator.go b/android/mutator.go
index b9c44e8..b77c2f0 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -207,6 +207,11 @@
func depsMutator(ctx BottomUpMutatorContext) {
if m, ok := ctx.Module().(Module); ok && m.Enabled() {
m.DepsMutator(ctx)
+
+ // For filegroup-based notice file references.
+ if m.base().commonProperties.Notice != nil {
+ ExtractSourceDeps(ctx, m.base().commonProperties.Notice)
+ }
}
}