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 Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
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"
|
||||
@@ -80,6 +81,7 @@ type aapt struct {
|
||||
rTxt android.Path
|
||||
extraAaptPackagesFile android.Path
|
||||
mergedManifestFile android.Path
|
||||
noticeFile android.OptionalPath
|
||||
isLibrary bool
|
||||
useEmbeddedNativeLibs bool
|
||||
useEmbeddedDex bool
|
||||
@@ -154,10 +156,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