Optionally embed NOTICE files in apks.
If embed_notices or ALWAYS_EMBED_NOTICES is set, collect NOTICE files
from all dependencies of the android_app, merge them with the app's own
one (if exists), transform it to HTML, gzip it, and put it as an asset
in the final APK output.
Bug: 135460391
Test: app_test.go + Built Mainline modules
Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
Merged-In: I52d92e2fd19b3f5f396100424665c5cc344190d8
(cherry picked from commit 5b425e2e20
)
This commit is contained in:
10
java/aar.go
10
java/aar.go
@@ -17,6 +17,7 @@ package java
|
||||
import (
|
||||
"android/soong/android"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
@@ -78,6 +79,7 @@ type aapt struct {
|
||||
rroDirs []rroDir
|
||||
rTxt android.Path
|
||||
extraAaptPackagesFile android.Path
|
||||
noticeFile android.OptionalPath
|
||||
isLibrary bool
|
||||
uncompressedJNI bool
|
||||
useEmbeddedDex bool
|
||||
@@ -150,10 +152,16 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, mani
|
||||
assetFiles = append(assetFiles, androidResourceGlob(ctx, dir)...)
|
||||
}
|
||||
|
||||
assetDirStrings := assetDirs.Strings()
|
||||
if a.noticeFile.Valid() {
|
||||
assetDirStrings = append(assetDirStrings, filepath.Dir(a.noticeFile.Path().String()))
|
||||
assetFiles = append(assetFiles, a.noticeFile.Path())
|
||||
}
|
||||
|
||||
linkFlags = append(linkFlags, "--manifest "+manifestPath.String())
|
||||
linkDeps = append(linkDeps, manifestPath)
|
||||
|
||||
linkFlags = append(linkFlags, android.JoinWithPrefix(assetDirs.Strings(), "-A "))
|
||||
linkFlags = append(linkFlags, android.JoinWithPrefix(assetDirStrings, "-A "))
|
||||
linkDeps = append(linkDeps, assetFiles...)
|
||||
|
||||
// SDK version flags
|
||||
|
Reference in New Issue
Block a user