diff options
| author | Yu Liu <yudiliu@google.com> | 2024-02-29 18:28:28 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-02-29 18:28:28 +0000 |
| commit | c82851b46d3e48c3a9a3b50ac7fe7184023e838a (patch) | |
| tree | 55275dc83dbdf606f550f0f9d95f40c53bceb3ae /apex | |
| parent | 341f6c7223346cf98c9c98e3e8711ff0a366cc05 (diff) | |
| parent | 4782aa50bf07df45e81ecde87cb420c66957000c (diff) | |
Merge "Some tweaks to the aconfig flag collection logic" into main am: 6c2cd90232 am: 4782aa50bf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2983533
Change-Id: I91948e96a5df217441135f631040e80a060197d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'apex')
| -rw-r--r-- | apex/apex.go | 10 | ||||
| -rw-r--r-- | apex/apex_test.go | 26 | ||||
| -rw-r--r-- | apex/builder.go | 9 |
3 files changed, 29 insertions, 16 deletions
diff --git a/apex/apex.go b/apex/apex.go index 1954a7eaf..4b37d0f03 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2072,8 +2072,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() { @@ -2087,6 +2089,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) } @@ -2115,6 +2118,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) } @@ -2138,6 +2142,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 { @@ -2223,11 +2228,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) { @@ -2256,6 +2263,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) { @@ -2274,6 +2282,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", @@ -2288,6 +2297,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 cc2d4ef17..74d6de8c7 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -11128,10 +11128,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", @@ -11252,10 +11252,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", @@ -11393,13 +11393,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()) } } |
