diff options
Diffstat (limited to 'apex')
-rw-r--r-- | apex/apex.go | 20 | ||||
-rw-r--r-- | apex/apex_test.go | 31 | ||||
-rw-r--r-- | apex/builder.go | 9 |
3 files changed, 38 insertions, 22 deletions
diff --git a/apex/apex.go b/apex/apex.go index 557b9b74c..9d7af189b 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -842,10 +842,12 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { } addDependenciesForNativeModules(ctx, deps, target, imageVariation) - ctx.AddFarVariationDependencies([]blueprint.Variation{ - {Mutator: "os", Variation: target.OsVariation()}, - {Mutator: "arch", Variation: target.ArchVariation()}, - }, shBinaryTag, a.properties.Sh_binaries...) + if isPrimaryAbi { + ctx.AddFarVariationDependencies([]blueprint.Variation{ + {Mutator: "os", Variation: target.OsVariation()}, + {Mutator: "arch", Variation: target.ArchVariation()}, + }, shBinaryTag, a.properties.Sh_binaries...) + } } // Common-arch dependencies come next @@ -2073,8 +2075,10 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, return true // track transitive dependencies case *java.AndroidAppImport: vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, ap)...) + addAconfigFiles(vctx, ctx, child) case *java.AndroidTestHelperApp: vctx.filesInfo = append(vctx.filesInfo, apexFilesForAndroidApp(ctx, ap)...) + addAconfigFiles(vctx, ctx, child) case *java.AndroidAppSet: appDir := "app" if ap.Privileged() { @@ -2088,6 +2092,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, af := newApexFile(ctx, ap.OutputFile(), ap.BaseModuleName(), appDirName, appSet, ap) af.certificate = java.PresignedCertificate vctx.filesInfo = append(vctx.filesInfo, af) + addAconfigFiles(vctx, ctx, child) default: ctx.PropertyErrorf("apps", "%q is not an android_app module", depName) } @@ -2116,6 +2121,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, case prebuiltTag: if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok { vctx.filesInfo = append(vctx.filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName)) + addAconfigFiles(vctx, ctx, child) } else { ctx.PropertyErrorf("prebuilts", "%q is not a prebuilt_etc module", depName) } @@ -2139,6 +2145,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, af := apexFileForExecutable(ctx, ccTest) af.class = nativeTest vctx.filesInfo = append(vctx.filesInfo, af) + addAconfigFiles(vctx, ctx, child) } return true // track transitive dependencies } else { @@ -2228,11 +2235,13 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, } vctx.filesInfo = append(vctx.filesInfo, af) + addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies } else if rm, ok := child.(*rust.Module); ok { af := apexFileForRustLibrary(ctx, rm) af.transitiveDep = true vctx.filesInfo = append(vctx.filesInfo, af) + addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies } } else if cc.IsTestPerSrcDepTag(depTag) { @@ -2261,6 +2270,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, af := apexFileForRustLibrary(ctx, rustm) af.transitiveDep = true vctx.filesInfo = append(vctx.filesInfo, af) + addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies } } else if rust.IsRlibDepTag(depTag) { @@ -2279,6 +2289,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, return false } vctx.filesInfo = append(vctx.filesInfo, af) + addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies default: ctx.PropertyErrorf("bootclasspath_fragments", @@ -2293,6 +2304,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, if profileAf := apexFileForJavaModuleProfile(ctx, child.(javaModule)); profileAf != nil { vctx.filesInfo = append(vctx.filesInfo, *profileAf) } + addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies default: ctx.PropertyErrorf("systemserverclasspath_fragments", diff --git a/apex/apex_test.go b/apex/apex_test.go index 02dc6e60b..54d2d08ff 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -5046,6 +5046,7 @@ func TestApexWithShBinary(t *testing.T) { key: "myapex.key", sh_binaries: ["myscript"], updatable: false, + compile_multilib: "both", } apex_key { @@ -6198,7 +6199,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { `) }) - t.Run("Co-existing unflagged apexes should create a duplicate deapexer error in hiddenapi processing", func(t *testing.T) { + t.Run("Co-existing unflagged apexes should create a duplicate module error", func(t *testing.T) { bp := ` // Source apex { @@ -6272,7 +6273,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { } ` - testDexpreoptWithApexes(t, bp, "Multiple installable prebuilt APEXes provide ambiguous deapexers: prebuilt_myapex.v1 and prebuilt_myapex.v2", preparer, fragment) + testDexpreoptWithApexes(t, bp, "Multiple prebuilt modules prebuilt_myapex.v1 and prebuilt_myapex.v2 have been marked as preferred for this source module", preparer, fragment) }) } @@ -11119,10 +11120,10 @@ func TestAconfigFilesJavaDeps(t *testing.T) { t.Fatalf("Expected 5 commands, got %d in:\n%s", len(copyCmds), s) } - ensureMatches(t, copyCmds[4], "^cp -f .*/aconfig_flags.pb .*/image.apex$") - ensureMatches(t, copyCmds[5], "^cp -f .*/package.map .*/image.apex$") - ensureMatches(t, copyCmds[6], "^cp -f .*/flag.map .*/image.apex$") - ensureMatches(t, copyCmds[7], "^cp -f .*/flag.val .*/image.apex$") + ensureMatches(t, copyCmds[4], "^cp -f .*/aconfig_flags.pb .*/image.apex/etc$") + ensureMatches(t, copyCmds[5], "^cp -f .*/package.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[6], "^cp -f .*/flag.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[7], "^cp -f .*/flag.val .*/image.apex/etc$") inputs := []string{ "my_aconfig_declarations_foo/intermediate.pb", @@ -11243,10 +11244,10 @@ func TestAconfigFilesJavaAndCcDeps(t *testing.T) { t.Fatalf("Expected 12 commands, got %d in:\n%s", len(copyCmds), s) } - ensureMatches(t, copyCmds[8], "^cp -f .*/aconfig_flags.pb .*/image.apex$") - ensureMatches(t, copyCmds[9], "^cp -f .*/package.map .*/image.apex$") - ensureMatches(t, copyCmds[10], "^cp -f .*/flag.map .*/image.apex$") - ensureMatches(t, copyCmds[11], "^cp -f .*/flag.val .*/image.apex$") + ensureMatches(t, copyCmds[8], "^cp -f .*/aconfig_flags.pb .*/image.apex/etc$") + ensureMatches(t, copyCmds[9], "^cp -f .*/package.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[10], "^cp -f .*/flag.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[11], "^cp -f .*/flag.val .*/image.apex/etc$") inputs := []string{ "my_aconfig_declarations_foo/intermediate.pb", @@ -11384,13 +11385,15 @@ func TestAconfigFilesRustDeps(t *testing.T) { t.Fatalf("Expected 26 commands, got %d in:\n%s", len(copyCmds), s) } - ensureMatches(t, copyCmds[22], "^cp -f .*/aconfig_flags.pb .*/image.apex$") - ensureMatches(t, copyCmds[23], "^cp -f .*/package.map .*/image.apex$") - ensureMatches(t, copyCmds[24], "^cp -f .*/flag.map .*/image.apex$") - ensureMatches(t, copyCmds[25], "^cp -f .*/flag.val .*/image.apex$") + ensureMatches(t, copyCmds[22], "^cp -f .*/aconfig_flags.pb .*/image.apex/etc$") + ensureMatches(t, copyCmds[23], "^cp -f .*/package.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[24], "^cp -f .*/flag.map .*/image.apex/etc$") + ensureMatches(t, copyCmds[25], "^cp -f .*/flag.val .*/image.apex/etc$") inputs := []string{ "my_aconfig_declarations_foo/intermediate.pb", + "my_aconfig_declarations_bar/intermediate.pb", + "my_aconfig_declarations_baz/intermediate.pb", "my_rust_binary/android_arm64_armv8-a_apex10000/myapex/aconfig_merged.pb", } VerifyAconfigRule(t, &mod, "combine_aconfig_declarations", inputs, "android_common_myapex/aconfig_flags.pb", "", "") diff --git a/apex/builder.go b/apex/builder.go index e49cf28fd..6ad282ab6 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -645,6 +645,7 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { prebuiltSdkToolsBinDir := filepath.Join("prebuilts", "sdk", "tools", runtime.GOOS, "bin") defaultReadOnlyFiles := []string{"apex_manifest.json", "apex_manifest.pb"} + aconfigDest := imageDir.Join(ctx, "etc").String() if len(a.aconfigFiles) > 0 { apexAconfigFile := android.PathForModuleOut(ctx, "aconfig_flags.pb") ctx.Build(pctx, android.BuildParams{ @@ -657,9 +658,9 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { }, }) - copyCommands = append(copyCommands, "cp -f "+apexAconfigFile.String()+" "+imageDir.String()) + copyCommands = append(copyCommands, "cp -f "+apexAconfigFile.String()+" "+aconfigDest) implicitInputs = append(implicitInputs, apexAconfigFile) - defaultReadOnlyFiles = append(defaultReadOnlyFiles, apexAconfigFile.Base()) + defaultReadOnlyFiles = append(defaultReadOnlyFiles, "etc/"+apexAconfigFile.Base()) for _, info := range createStorageInfo { outputFile := android.PathForModuleOut(ctx, info.Output_file) @@ -675,9 +676,9 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { }, }) - copyCommands = append(copyCommands, "cp -f "+outputFile.String()+" "+imageDir.String()) + copyCommands = append(copyCommands, "cp -f "+outputFile.String()+" "+aconfigDest) implicitInputs = append(implicitInputs, outputFile) - defaultReadOnlyFiles = append(defaultReadOnlyFiles, outputFile.Base()) + defaultReadOnlyFiles = append(defaultReadOnlyFiles, "etc/"+outputFile.Base()) } } |