Keep dependency files out of the apk file.
Bug: 227682036
Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97
Change-Id: I1a9775af7c652191bb1ce3b97c1cb9365b469c19
diff --git a/java/app.go b/java/app.go
index 5b1daa4..21ee34e 100755
--- a/java/app.go
+++ b/java/app.go
@@ -586,10 +586,16 @@
}
a.onDeviceDir = android.InstallPathToOnDevicePath(ctx, a.installDir)
- noticeFile := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
- android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, noticeFile)
if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
- a.aapt.noticeFile = android.OptionalPathForPath(noticeFile)
+ noticeFile := android.PathForModuleOut(ctx, "NOTICE.html.gz")
+ android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, noticeFile)
+ 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)
}
a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)