summaryrefslogtreecommitdiff
path: root/apex/builder.go
diff options
context:
space:
mode:
author Wei Sheng Shih <wilsonshih@google.com> 2022-04-01 02:05:36 +0000
committer Bob Badour <bbadour@google.com> 2022-04-01 14:10:53 +0000
commit77807b3c277723161a193aea2a9df1e464448c3d (patch)
treeaa4308c05738ee38894901471f83e52c11746ba8 /apex/builder.go
parent2a5c090c31bf6152f9e5954273c06cd34a21092e (diff)
Revert "Build notice files from license metadata."
This reverts commit 43c2dcaef609c4a268bfab6c95ed924af4ead6b1. Reason for revert: suspect build break Bug: 227682036 Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97 Change-Id: Ibfb8b4fefc264f52f32ba661c269a9cd625d800a
Diffstat (limited to 'apex/builder.go')
-rw-r--r--apex/builder.go37
1 files changed, 32 insertions, 5 deletions
diff --git a/apex/builder.go b/apex/builder.go
index 50c8dd122..8c5f99bf5 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -305,6 +305,32 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
return output.OutputPath
}
+// buildNoticeFiles creates a buile rule for aggregating notice files from the modules that
+// contributes to this APEX. The notice files are merged into a big notice file.
+func (a *apexBundle) buildNoticeFiles(ctx android.ModuleContext, apexFileName string) android.NoticeOutputs {
+ var noticeFiles android.Paths
+
+ a.WalkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
+ if externalDep {
+ // As soon as the dependency graph crosses the APEX boundary, don't go further.
+ return false
+ }
+ noticeFiles = append(noticeFiles, to.NoticeFiles()...)
+ return true
+ })
+
+ // TODO(jiyong): why do we need this? WalkPayloadDeps should have already covered this.
+ for _, fi := range a.filesInfo {
+ noticeFiles = append(noticeFiles, fi.noticeFiles...)
+ }
+
+ if len(noticeFiles) == 0 {
+ return android.NoticeOutputs{}
+ }
+
+ return android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.SortedUniquePaths(noticeFiles))
+}
+
// buildInstalledFilesFile creates a build rule for the installed-files.txt file where the list of
// files included in this APEX is shown. The text file is dist'ed so that people can see what's
// included in the APEX without actually downloading and extracting it.
@@ -616,11 +642,12 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
optFlags = append(optFlags, "--logging_parent ", a.overridableProperties.Logging_parent)
}
- // Create a NOTICE file, and embed it as an asset file in the APEX.
- a.htmlGzNotice = android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
- android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, a.htmlGzNotice)
- implicitInputs = append(implicitInputs, a.htmlGzNotice)
- optFlags = append(optFlags, "--assets_dir "+filepath.Dir(a.htmlGzNotice.String()))
+ a.mergedNotices = a.buildNoticeFiles(ctx, a.Name()+suffix)
+ if a.mergedNotices.HtmlGzOutput.Valid() {
+ // If there's a NOTICE file, embed it as an asset file in the APEX.
+ implicitInputs = append(implicitInputs, a.mergedNotices.HtmlGzOutput.Path())
+ optFlags = append(optFlags, "--assets_dir "+filepath.Dir(a.mergedNotices.HtmlGzOutput.String()))
+ }
if (moduleMinSdkVersion.GreaterThan(android.SdkVersion_Android10) && !a.shouldGenerateHashtree()) && !compressionEnabled {
// Apexes which are supposed to be installed in builtin dirs(/system, etc)