aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-27 14:34:27 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-27 14:34:27 +0000
commitbd638bb764233cb36535034b0e6235fd9cff5c36 (patch)
treef267f7d06f311d31086aeb550f0c09e366875324
parent51215a1ce85d6a63c2259b6d38464c46bcfba48c (diff)
parent05e33fad7748f7e42643278a72a8ae859b3f4431 (diff)
downloadsoong-android13-frc-extservices-release.tar.gz
Merge cherrypicks of [19049995] into tm-frc-extservices-release.t_frc_ext_330443000android13-frc-extservices-release
Change-Id: I8953ad12bdd558a6e8b5377bd9ea34dd2f22d5f3
-rwxr-xr-xjava/app.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/java/app.go b/java/app.go
index 94e6fb950..41419ba78 100755
--- a/java/app.go
+++ b/java/app.go
@@ -589,6 +589,16 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)
+ var noticeAssetPath android.WritablePath
+ if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
+ // The rule to create the notice file can't be generated yet, as the final output path
+ // for the apk isn't known yet. Add the path where the notice file will be generated to the
+ // aapt rules now before calling aaptBuildActions, the rule to create the notice file will
+ // be generated later.
+ noticeAssetPath = android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
+ a.aapt.noticeFile = android.OptionalPathForPath(noticeAssetPath)
+ }
+
// Process all building blocks, from AAPT to certificates.
a.aaptBuildActions(ctx)
@@ -663,7 +673,8 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
}
- if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
+ if a.aapt.noticeFile.Valid() {
+ // Generating the notice file rule has to be here after a.outputFile is known.
noticeFile := android.PathForModuleOut(ctx, "NOTICE.html.gz")
android.BuildNoticeHtmlOutputFromLicenseMetadata(
ctx, noticeFile, "", "",
@@ -672,13 +683,11 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
android.PathForModuleInstall(ctx).String() + "/",
a.outputFile.String(),
})
- noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().Text("cp").
Input(noticeFile).
Output(noticeAssetPath)
builder.Build("notice_dir", "Building notice dir")
- a.aapt.noticeFile = android.OptionalPathForPath(noticeAssetPath)
}
for _, split := range a.aapt.splits {