Merge "Convert shared customizer functions to return FixturePreparers" am: 7ba0448314
am: 47e8b9af4e
am: 85ca23b70e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647197 Change-Id: I223001416be6cc38c55ae4415536a0740a43e48f
This commit is contained in:
commit
710c370485
|
@ -70,20 +70,16 @@ func testApex(t *testing.T, bp string, handlers ...interface{}) *android.TestCon
|
|||
// deprecated
|
||||
type testCustomizer func(fs map[string][]byte, config android.Config)
|
||||
|
||||
func withFiles(files map[string][]byte) testCustomizer {
|
||||
return func(fs map[string][]byte, config android.Config) {
|
||||
for k, v := range files {
|
||||
fs[k] = v
|
||||
}
|
||||
}
|
||||
func withFiles(files android.MockFS) android.FixturePreparer {
|
||||
return files.AddToFixture()
|
||||
}
|
||||
|
||||
func withTargets(targets map[android.OsType][]android.Target) testCustomizer {
|
||||
return func(fs map[string][]byte, config android.Config) {
|
||||
func withTargets(targets map[android.OsType][]android.Target) android.FixturePreparer {
|
||||
return android.FixtureModifyConfig(func(config android.Config) {
|
||||
for k, v := range targets {
|
||||
config.Targets[k] = v
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// withNativeBridgeTargets sets configuration with targets including:
|
||||
|
@ -91,7 +87,8 @@ func withTargets(targets map[android.OsType][]android.Target) testCustomizer {
|
|||
// - X86 (secondary)
|
||||
// - Arm64 on X86_64 (native bridge)
|
||||
// - Arm on X86 (native bridge)
|
||||
func withNativeBridgeEnabled(_ map[string][]byte, config android.Config) {
|
||||
var withNativeBridgeEnabled = android.FixtureModifyConfig(
|
||||
func(config android.Config) {
|
||||
config.Targets[android.Android] = []android.Target{
|
||||
{Os: android.Android, Arch: android.Arch{ArchType: android.X86_64, ArchVariant: "silvermont", Abi: []string{"arm64-v8a"}},
|
||||
NativeBridge: android.NativeBridgeDisabled, NativeBridgeHostArchName: "", NativeBridgeRelativePath: ""},
|
||||
|
@ -102,21 +99,26 @@ func withNativeBridgeEnabled(_ map[string][]byte, config android.Config) {
|
|||
{Os: android.Android, Arch: android.Arch{ArchType: android.Arm, ArchVariant: "armv7-a-neon", Abi: []string{"armeabi-v7a"}},
|
||||
NativeBridge: android.NativeBridgeEnabled, NativeBridgeHostArchName: "x86", NativeBridgeRelativePath: "arm"},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
func withManifestPackageNameOverrides(specs []string) android.FixturePreparer {
|
||||
return android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||
variables.ManifestPackageNameOverrides = specs
|
||||
})
|
||||
}
|
||||
|
||||
func withManifestPackageNameOverrides(specs []string) testCustomizer {
|
||||
return func(fs map[string][]byte, config android.Config) {
|
||||
config.TestProductVariables.ManifestPackageNameOverrides = specs
|
||||
}
|
||||
}
|
||||
var withBinder32bit = android.FixtureModifyProductVariables(
|
||||
func(variables android.FixtureProductVariables) {
|
||||
variables.Binder32bit = proptools.BoolPtr(true)
|
||||
},
|
||||
)
|
||||
|
||||
func withBinder32bit(_ map[string][]byte, config android.Config) {
|
||||
config.TestProductVariables.Binder32bit = proptools.BoolPtr(true)
|
||||
}
|
||||
|
||||
func withUnbundledBuild(_ map[string][]byte, config android.Config) {
|
||||
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
|
||||
}
|
||||
var withUnbundledBuild = android.FixtureModifyProductVariables(
|
||||
func(variables android.FixtureProductVariables) {
|
||||
variables.Unbundled_build = proptools.BoolPtr(true)
|
||||
},
|
||||
)
|
||||
|
||||
var emptyFixtureFactory = android.NewFixtureFactory(&buildDir)
|
||||
|
||||
|
|
Loading…
Reference in New Issue