Merge "Properly package aconfig files for vendor partition" into main am: a1df1a5937
am: 10d22de5d3
am: 59d425941b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2875174 Change-Id: I285a847312ed43f40a10dbee1d5c9a4189fdcae8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -230,3 +230,12 @@ func mergeAconfigFiles(ctx android.ModuleContext, inputs android.Paths) android.
|
|||||||
|
|
||||||
return android.Paths{output}
|
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[""])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -104,3 +104,61 @@ func testIncorrectCCCodegenModeHelper(t *testing.T, bpMode string, err string) {
|
|||||||
}
|
}
|
||||||
`, bpMode))
|
`, 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")
|
||||||
|
}
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"android/soong/aconfig"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -133,8 +134,7 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
entries.SetString("SOONG_SDK_VARIANT_MODULES",
|
entries.SetString("SOONG_SDK_VARIANT_MODULES",
|
||||||
"$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))")
|
"$(SOONG_SDK_VARIANT_MODULES) $(patsubst %.sdk,%,$(LOCAL_MODULE))")
|
||||||
}
|
}
|
||||||
// TODO(b/311155208): The container here should be system.
|
aconfig.SetAconfigFileMkEntries(c.AndroidModuleBase(), entries, c.mergedAconfigFiles)
|
||||||
entries.SetPaths("LOCAL_ACONFIG_FILES", c.mergedAconfigFiles[""])
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
||||||
|
@@ -19,6 +19,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"android/soong/aconfig"
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
@@ -128,9 +129,7 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
if library.dexpreopter.configPath != nil {
|
if library.dexpreopter.configPath != nil {
|
||||||
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath)
|
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath)
|
||||||
}
|
}
|
||||||
// TODO(b/311155208): The container here should be system.
|
aconfig.SetAconfigFileMkEntries(&library.ModuleBase, entries, library.mergedAconfigFiles)
|
||||||
|
|
||||||
entries.SetPaths("LOCAL_ACONFIG_FILES", library.mergedAconfigFiles[""])
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -307,8 +306,7 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
if len(binary.dexpreopter.builtInstalled) > 0 {
|
if len(binary.dexpreopter.builtInstalled) > 0 {
|
||||||
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled)
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled)
|
||||||
}
|
}
|
||||||
// TODO(b/311155208): The container here should be system.
|
aconfig.SetAconfigFileMkEntries(&binary.ModuleBase, entries, binary.mergedAconfigFiles)
|
||||||
entries.SetPaths("LOCAL_ACONFIG_FILES", binary.mergedAconfigFiles[""])
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
||||||
@@ -461,8 +459,7 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
||||||
|
|
||||||
if app.Name() != "framework-res" {
|
if app.Name() != "framework-res" {
|
||||||
// TODO(b/311155208): The container here should be system.
|
aconfig.SetAconfigFileMkEntries(&app.ModuleBase, entries, app.mergedAconfigFiles)
|
||||||
entries.SetPaths("LOCAL_ACONFIG_FILES", app.mergedAconfigFiles[""])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -540,8 +537,7 @@ func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile)
|
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile)
|
||||||
entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile)
|
entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile)
|
||||||
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||||
// TODO(b/311155208): The container here should be system.
|
aconfig.SetAconfigFileMkEntries(&a.ModuleBase, entries, a.mergedAconfigFiles)
|
||||||
entries.SetPaths("LOCAL_ACONFIG_FILES", a.mergedAconfigFiles[""])
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return entriesList
|
return entriesList
|
||||||
|
@@ -17,6 +17,7 @@ package rust
|
|||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"android/soong/aconfig"
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -66,8 +67,7 @@ func (mod *Module) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
if mod.UseVndk() {
|
if mod.UseVndk() {
|
||||||
entries.SetBool("LOCAL_USE_VNDK", true)
|
entries.SetBool("LOCAL_USE_VNDK", true)
|
||||||
}
|
}
|
||||||
// TODO(b/311155208): The container here should be system.
|
aconfig.SetAconfigFileMkEntries(mod.AndroidModuleBase(), entries, mod.mergedAconfigFiles)
|
||||||
entries.SetPaths("LOCAL_ACONFIG_FILES", mod.mergedAconfigFiles[""])
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user