diff options
Diffstat (limited to 'apex/apex.go')
-rw-r--r-- | apex/apex.go | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/apex/apex.go b/apex/apex.go index 4e72d09a6..220eb0043 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -47,13 +47,15 @@ var ( Description: "fs_config ${out}", }, "ro_paths", "exec_paths") - injectApexDependency = pctx.StaticRule("injectApexDependency", blueprint.RuleParams{ + apexManifestRule = pctx.StaticRule("apexManifestRule", blueprint.RuleParams{ Command: `rm -f $out && ${jsonmodify} $in ` + `-a provideNativeLibs ${provideNativeLibs} ` + - `-a requireNativeLibs ${requireNativeLibs} -o $out`, + `-a requireNativeLibs ${requireNativeLibs} ` + + `${opt} ` + + `-o $out`, CommandDeps: []string{"${jsonmodify}"}, - Description: "Inject dependency into ${out}", - }, "provideNativeLibs", "requireNativeLibs") + Description: "prepare ${out}", + }, "provideNativeLibs", "requireNativeLibs", "opt") // TODO(b/113233103): make sure that file_contexts is sane, i.e., validate // against the binary policy using sefcontext_compiler -p <policy>. @@ -150,7 +152,6 @@ var ( var ( whitelistNoApex = map[string][]string{ "apex_test_build_features": []string{"libbinder"}, - "com.android.media": []string{"libbinder"}, "com.android.media.swcodec": []string{"libbinder"}, "test_com.android.media.swcodec": []string{"libbinder"}, "com.android.vndk": []string{"libbinder"}, @@ -1223,18 +1224,28 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.installDir = android.PathForModuleInstall(ctx, "apex") a.filesInfo = filesInfo + // prepare apex_manifest.json a.manifestOut = android.PathForModuleOut(ctx, "apex_manifest.json") - // put dependency({provide|require}NativeLibs) in apex_manifest.json manifestSrc := android.PathForModuleSrc(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json")) + + // put dependency({provide|require}NativeLibs) in apex_manifest.json provideNativeLibs = android.SortedUniqueStrings(provideNativeLibs) requireNativeLibs = android.SortedUniqueStrings(android.RemoveListFromList(requireNativeLibs, provideNativeLibs)) + + // apex name can be overridden + optCommands := []string{} + if a.properties.Apex_name != nil { + optCommands = append(optCommands, "-v name "+*a.properties.Apex_name) + } + ctx.Build(pctx, android.BuildParams{ - Rule: injectApexDependency, + Rule: apexManifestRule, Input: manifestSrc, Output: a.manifestOut, Args: map[string]string{ "provideNativeLibs": strings.Join(provideNativeLibs, " "), "requireNativeLibs": strings.Join(requireNativeLibs, " "), + "opt": strings.Join(optCommands, " "), }, }) @@ -1448,6 +1459,12 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType ap optFlags = append(optFlags, "--no_hashtree") } + if a.properties.Apex_name != nil { + // If apex_name is set, apexer can skip checking if key name matches with apex name. + // Note that apex_manifest is also mended. + optFlags = append(optFlags, "--do_not_check_keyname") + } + ctx.Build(pctx, android.BuildParams{ Rule: apexRule, Implicits: implicitInputs, |