diff options
Diffstat (limited to 'apex/apex.go')
-rw-r--r-- | apex/apex.go | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/apex/apex.go b/apex/apex.go index fa4cb48c..a546b904 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -90,12 +90,6 @@ var ( CommandDeps: []string{"${zip2zip}"}, Description: "app bundle", }, "abi") - - apexMergeNoticeRule = pctx.StaticRule("apexMergeNoticeRule", blueprint.RuleParams{ - Command: `${mergenotice} --output $out $inputs`, - CommandDeps: []string{"${mergenotice}"}, - Description: "merge notice files into $out", - }, "inputs") ) var imageApexSuffix = ".apex" @@ -144,8 +138,6 @@ func init() { pctx.HostBinToolVariable("zip2zip", "zip2zip") pctx.HostBinToolVariable("zipalign", "zipalign") - pctx.SourcePathVariable("mergenotice", "build/soong/scripts/mergenotice.py") - android.RegisterModuleType("apex", apexBundleFactory) android.RegisterModuleType("apex_test", testApexBundleFactory) android.RegisterModuleType("apex_defaults", defaultsFactory) @@ -402,8 +394,6 @@ type apexBundle struct { container_certificate_file android.Path container_private_key_file android.Path - mergedNoticeFile android.WritablePath - // list of files to be included in this apex filesInfo []apexFile @@ -820,8 +810,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.installDir = android.PathForModuleInstall(ctx, "apex") a.filesInfo = filesInfo - a.buildNoticeFile(ctx) - if a.apexTypes.zip() { a.buildUnflattenedApex(ctx, zipApex) } @@ -835,35 +823,27 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } } -func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext) { +func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext, apexFileName string) android.OptionalPath { noticeFiles := []android.Path{} - noticeFilesString := []string{} for _, f := range a.filesInfo { if f.module != nil { notice := f.module.NoticeFile() if notice.Valid() { noticeFiles = append(noticeFiles, notice.Path()) - noticeFilesString = append(noticeFilesString, notice.Path().String()) } } } // append the notice file specified in the apex module itself if a.NoticeFile().Valid() { noticeFiles = append(noticeFiles, a.NoticeFile().Path()) - noticeFilesString = append(noticeFilesString, a.NoticeFile().Path().String()) } - if len(noticeFiles) > 0 { - a.mergedNoticeFile = android.PathForModuleOut(ctx, "NOTICE") - ctx.Build(pctx, android.BuildParams{ - Rule: apexMergeNoticeRule, - Inputs: noticeFiles, - Output: a.mergedNoticeFile, - Args: map[string]string{ - "inputs": strings.Join(noticeFilesString, " "), - }, - }) + if len(noticeFiles) == 0 { + return android.OptionalPath{} } + + return android.OptionalPathForPath( + android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.FirstUniquePaths(noticeFiles))) } func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType apexPackaging) { @@ -988,6 +968,13 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType ap } optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion) + noticeFile := a.buildNoticeFile(ctx, ctx.ModuleName()+suffix) + if noticeFile.Valid() { + // If there's a NOTICE file, embed it as an asset file in the APEX. + implicitInputs = append(implicitInputs, noticeFile.Path()) + optFlags = append(optFlags, "--assets_dir "+filepath.Dir(noticeFile.String())) + } + ctx.Build(pctx, android.BuildParams{ Rule: apexRule, Implicits: implicitInputs, @@ -1227,9 +1214,6 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", a.installDir.RelPathString())) fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+apexType.suffix()) fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable()) - if a.installable() && a.mergedNoticeFile != nil { - fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", a.mergedNoticeFile.String()) - } if len(moduleNames) > 0 { fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " ")) } |