Loading aconfig/aconfig_declarations.go +9 −0 Original line number Diff line number Diff line Loading @@ -230,3 +230,12 @@ func mergeAconfigFiles(ctx android.ModuleContext, inputs android.Paths) android. return android.Paths{output} } func SetAconfigFileMkEntries(m *android.ModuleBase, entries *android.AndroidMkEntries, aconfigFiles map[string]android.Paths) { if m.InstallInVendor() { entries.SetPaths("LOCAL_ACONFIG_FILES", aconfigFiles["vendor"]) } else { // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", aconfigFiles[""]) } } aconfig/codegen/cc_aconfig_library_test.go +58 −0 Original line number Diff line number Diff line Loading @@ -104,3 +104,61 @@ func testIncorrectCCCodegenModeHelper(t *testing.T, bpMode string, err string) { } `, bpMode)) } func TestAndroidMkCcLibrary(t *testing.T) { bp := ` aconfig_declarations { name: "my_aconfig_declarations_foo", package: "com.example.package", srcs: ["foo.aconfig"], container: "vendor", } cc_aconfig_library { name: "my_cc_aconfig_library_foo", aconfig_declarations: "my_aconfig_declarations_foo", vendor_available: true, } aconfig_declarations { name: "my_aconfig_declarations_bar", package: "com.example.package", srcs: ["bar.aconfig"], } cc_aconfig_library { name: "my_cc_aconfig_library_bar", aconfig_declarations: "my_aconfig_declarations_bar", vendor_available: true, } cc_library { name: "my_cc_library", srcs: [ "src/foo.cc", ], static_libs: [ "my_cc_aconfig_library_foo", "my_cc_aconfig_library_bar", ], vendor: true, } cc_library { name: "server_configurable_flags", srcs: ["server_configurable_flags.cc"], } ` result := android.GroupFixturePreparers( PrepareForTestWithAconfigBuildComponents, cc.PrepareForTestWithCcDefaultModules). ExtendWithErrorHandler(android.FixtureExpectsNoErrors).RunTestWithBp(t, bp) module := result.ModuleForTests("my_cc_library", "android_arm64_armv8-a_shared").Module() entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0] makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"] android.AssertIntEquals(t, "len(LOCAL_ACONFIG_FILES)", 1, len(makeVar)) android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb") } cc/androidmk.go +2 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package cc import ( "android/soong/aconfig" "github.com/google/blueprint/proptools" "fmt" Loading Loading @@ -133,8 +134,7 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries { entries.SetString("SOONG_SDK_VARIANT_MODULES", "$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))") } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", c.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(c.AndroidModuleBase(), entries, c.mergedAconfigFiles) }, }, ExtraFooters: []android.AndroidMkExtraFootersFunc{ Loading java/androidmk.go +5 −9 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import ( "io" "strings" "android/soong/aconfig" "android/soong/android" "github.com/google/blueprint/proptools" Loading Loading @@ -128,9 +129,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries { if library.dexpreopter.configPath != nil { entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath) } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", library.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&library.ModuleBase, entries, library.mergedAconfigFiles) }, }, }) Loading Loading @@ -307,8 +306,7 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries { if len(binary.dexpreopter.builtInstalled) > 0 { entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled) } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", binary.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&binary.ModuleBase, entries, binary.mergedAconfigFiles) }, }, ExtraFooters: []android.AndroidMkExtraFootersFunc{ Loading Loading @@ -461,8 +459,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries { entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports) if app.Name() != "framework-res" { // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", app.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&app.ModuleBase, entries, app.mergedAconfigFiles) } }, }, Loading Loading @@ -540,8 +537,7 @@ func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries { entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile) entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true) // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", a.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&a.ModuleBase, entries, a.mergedAconfigFiles) }) return entriesList Loading rust/androidmk.go +2 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package rust import ( "path/filepath" "android/soong/aconfig" "android/soong/android" ) Loading Loading @@ -66,8 +67,7 @@ func (mod *Module) AndroidMkEntries() []android.AndroidMkEntries { if mod.UseVndk() { entries.SetBool("LOCAL_USE_VNDK", true) } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", mod.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(mod.AndroidModuleBase(), entries, mod.mergedAconfigFiles) }, }, } Loading Loading
aconfig/aconfig_declarations.go +9 −0 Original line number Diff line number Diff line Loading @@ -230,3 +230,12 @@ func mergeAconfigFiles(ctx android.ModuleContext, inputs android.Paths) android. return android.Paths{output} } func SetAconfigFileMkEntries(m *android.ModuleBase, entries *android.AndroidMkEntries, aconfigFiles map[string]android.Paths) { if m.InstallInVendor() { entries.SetPaths("LOCAL_ACONFIG_FILES", aconfigFiles["vendor"]) } else { // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", aconfigFiles[""]) } }
aconfig/codegen/cc_aconfig_library_test.go +58 −0 Original line number Diff line number Diff line Loading @@ -104,3 +104,61 @@ func testIncorrectCCCodegenModeHelper(t *testing.T, bpMode string, err string) { } `, bpMode)) } func TestAndroidMkCcLibrary(t *testing.T) { bp := ` aconfig_declarations { name: "my_aconfig_declarations_foo", package: "com.example.package", srcs: ["foo.aconfig"], container: "vendor", } cc_aconfig_library { name: "my_cc_aconfig_library_foo", aconfig_declarations: "my_aconfig_declarations_foo", vendor_available: true, } aconfig_declarations { name: "my_aconfig_declarations_bar", package: "com.example.package", srcs: ["bar.aconfig"], } cc_aconfig_library { name: "my_cc_aconfig_library_bar", aconfig_declarations: "my_aconfig_declarations_bar", vendor_available: true, } cc_library { name: "my_cc_library", srcs: [ "src/foo.cc", ], static_libs: [ "my_cc_aconfig_library_foo", "my_cc_aconfig_library_bar", ], vendor: true, } cc_library { name: "server_configurable_flags", srcs: ["server_configurable_flags.cc"], } ` result := android.GroupFixturePreparers( PrepareForTestWithAconfigBuildComponents, cc.PrepareForTestWithCcDefaultModules). ExtendWithErrorHandler(android.FixtureExpectsNoErrors).RunTestWithBp(t, bp) module := result.ModuleForTests("my_cc_library", "android_arm64_armv8-a_shared").Module() entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0] makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"] android.AssertIntEquals(t, "len(LOCAL_ACONFIG_FILES)", 1, len(makeVar)) android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb") }
cc/androidmk.go +2 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package cc import ( "android/soong/aconfig" "github.com/google/blueprint/proptools" "fmt" Loading Loading @@ -133,8 +134,7 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries { entries.SetString("SOONG_SDK_VARIANT_MODULES", "$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))") } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", c.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(c.AndroidModuleBase(), entries, c.mergedAconfigFiles) }, }, ExtraFooters: []android.AndroidMkExtraFootersFunc{ Loading
java/androidmk.go +5 −9 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import ( "io" "strings" "android/soong/aconfig" "android/soong/android" "github.com/google/blueprint/proptools" Loading Loading @@ -128,9 +129,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries { if library.dexpreopter.configPath != nil { entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath) } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", library.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&library.ModuleBase, entries, library.mergedAconfigFiles) }, }, }) Loading Loading @@ -307,8 +306,7 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries { if len(binary.dexpreopter.builtInstalled) > 0 { entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled) } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", binary.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&binary.ModuleBase, entries, binary.mergedAconfigFiles) }, }, ExtraFooters: []android.AndroidMkExtraFootersFunc{ Loading Loading @@ -461,8 +459,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries { entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports) if app.Name() != "framework-res" { // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", app.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&app.ModuleBase, entries, app.mergedAconfigFiles) } }, }, Loading Loading @@ -540,8 +537,7 @@ func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries { entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile) entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true) // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", a.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(&a.ModuleBase, entries, a.mergedAconfigFiles) }) return entriesList Loading
rust/androidmk.go +2 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package rust import ( "path/filepath" "android/soong/aconfig" "android/soong/android" ) Loading Loading @@ -66,8 +67,7 @@ func (mod *Module) AndroidMkEntries() []android.AndroidMkEntries { if mod.UseVndk() { entries.SetBool("LOCAL_USE_VNDK", true) } // TODO(b/311155208): The container here should be system. entries.SetPaths("LOCAL_ACONFIG_FILES", mod.mergedAconfigFiles[""]) aconfig.SetAconfigFileMkEntries(mod.AndroidModuleBase(), entries, mod.mergedAconfigFiles) }, }, } Loading