diff options
Diffstat (limited to 'apex/builder.go')
-rw-r--r-- | apex/builder.go | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/apex/builder.go b/apex/builder.go index ca24f2cff..0108d068a 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -61,6 +61,7 @@ func init() { pctx.HostBinToolVariable("zipalign", "zipalign") pctx.HostBinToolVariable("jsonmodify", "jsonmodify") pctx.HostBinToolVariable("conv_apex_manifest", "conv_apex_manifest") + pctx.HostBinToolVariable("extract_apks", "extract_apks") } var ( @@ -189,7 +190,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs, var jniLibs []string for _, fi := range a.filesInfo { if fi.isJniLib { - jniLibs = append(jniLibs, fi.builtFile.Base()) + jniLibs = append(jniLibs, fi.Stem()) } } if len(jniLibs) > 0 { @@ -246,7 +247,7 @@ func (a *apexBundle) buildNoticeFiles(ctx android.ModuleContext, apexFileName st return android.NoticeOutputs{} } - return android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.FirstUniquePaths(noticeFiles)) + return android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.SortedUniquePaths(noticeFiles)) } func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.OutputPath { @@ -350,6 +351,19 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { symlinkDest := android.PathForModuleOut(ctx, "image"+suffix, symlinkPath).String() copyCommands = append(copyCommands, "ln -sfn "+filepath.Base(destPath)+" "+symlinkDest) } + for _, d := range fi.dataPaths { + // TODO(eakammer): This is now the third repetition of ~this logic for test paths, refactoring should be possible + relPath := d.Rel() + dataPath := d.String() + if !strings.HasSuffix(dataPath, relPath) { + panic(fmt.Errorf("path %q does not end with %q", dataPath, relPath)) + } + + dataDest := android.PathForModuleOut(ctx, "image"+suffix, fi.apexRelativePath(relPath)).String() + + copyCommands = append(copyCommands, "cp -f "+d.String()+" "+dataDest) + implicitInputs = append(implicitInputs, d) + } } // TODO(jiyong): use RuleBuilder @@ -403,9 +417,12 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"} var executablePaths []string // this also includes dirs for _, f := range a.filesInfo { - pathInApex := filepath.Join(f.installDir, f.builtFile.Base()) + pathInApex := f.Path() if f.installDir == "bin" || strings.HasPrefix(f.installDir, "bin/") { executablePaths = append(executablePaths, pathInApex) + for _, d := range f.dataPaths { + readOnlyPaths = append(readOnlyPaths, filepath.Join(f.installDir, d.Rel())) + } for _, s := range f.symlinks { executablePaths = append(executablePaths, filepath.Join(f.installDir, s)) } @@ -453,11 +470,11 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { } targetSdkVersion := ctx.Config().DefaultAppTargetSdk() + // TODO(b/157078772): propagate min_sdk_version to apexer. minSdkVersion := ctx.Config().DefaultAppTargetSdk() if a.minSdkVersion(ctx) == android.SdkVersion_Android10 { minSdkVersion = strconv.Itoa(a.minSdkVersion(ctx)) - targetSdkVersion = strconv.Itoa(a.minSdkVersion(ctx)) } if java.UseApiFingerprint(ctx) { @@ -565,19 +582,27 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { } a.outputFile = android.PathForModuleOut(ctx, a.Name()+suffix) + rule := java.Signapk + args := map[string]string{ + "certificates": a.container_certificate_file.String() + " " + a.container_private_key_file.String(), + "flags": "-a 4096", //alignment + } + implicits := android.Paths{ + a.container_certificate_file, + a.container_private_key_file, + } + if ctx.Config().IsEnvTrue("RBE_SIGNAPK") { + rule = java.SignapkRE + args["implicits"] = strings.Join(implicits.Strings(), ",") + args["outCommaList"] = a.outputFile.String() + } ctx.Build(pctx, android.BuildParams{ - Rule: java.Signapk, + Rule: rule, Description: "signapk", Output: a.outputFile, Input: unsignedOutputFile, - Implicits: []android.Path{ - a.container_certificate_file, - a.container_private_key_file, - }, - Args: map[string]string{ - "certificates": a.container_certificate_file.String() + " " + a.container_private_key_file.String(), - "flags": "-a 4096", //alignment - }, + Implicits: implicits, + Args: args, }) // Install to $OUT/soong/{target,host}/.../apex @@ -642,7 +667,7 @@ func (a *apexBundle) buildFilesInfo(ctx android.ModuleContext) { apexBundleName := a.Name() for _, fi := range a.filesInfo { dir := filepath.Join("apex", apexBundleName, fi.installDir) - target := ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile) + target := ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.Stem(), fi.builtFile) for _, sym := range fi.symlinks { ctx.InstallSymlink(android.PathForModuleInstall(ctx, dir), sym, target) } |