Merge "Rename FixturePreparers to GroupFixturePreparers" am: 166a488efe
am: 673bce632a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1612943 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I91b63ad522aaf956adf27e6e5d18ff815e49bf0c
This commit is contained in:
commit
661f39a01d
|
@ -61,15 +61,15 @@ import (
|
|||
// register module bar twice:
|
||||
// var Preparer1 = FixtureRegisterWithContext(RegisterModuleFooAndBar)
|
||||
// var Preparer2 = FixtureRegisterWithContext(RegisterModuleBarAndBaz)
|
||||
// var AllPreparers = FixturePreparers(Preparer1, Preparer2)
|
||||
// var AllPreparers = GroupFixturePreparers(Preparer1, Preparer2)
|
||||
//
|
||||
// However, when restructured like this it would work fine:
|
||||
// var PreparerFoo = FixtureRegisterWithContext(RegisterModuleFoo)
|
||||
// var PreparerBar = FixtureRegisterWithContext(RegisterModuleBar)
|
||||
// var PreparerBaz = FixtureRegisterWithContext(RegisterModuleBaz)
|
||||
// var Preparer1 = FixturePreparers(RegisterModuleFoo, RegisterModuleBar)
|
||||
// var Preparer2 = FixturePreparers(RegisterModuleBar, RegisterModuleBaz)
|
||||
// var AllPreparers = FixturePreparers(Preparer1, Preparer2)
|
||||
// var Preparer1 = GroupFixturePreparers(RegisterModuleFoo, RegisterModuleBar)
|
||||
// var Preparer2 = GroupFixturePreparers(RegisterModuleBar, RegisterModuleBaz)
|
||||
// var AllPreparers = GroupFixturePreparers(Preparer1, Preparer2)
|
||||
//
|
||||
// As after deduping and flattening AllPreparers would result in the following preparers being
|
||||
// applied:
|
||||
|
@ -109,7 +109,7 @@ import (
|
|||
// An exported preparer for use by other packages that need to use java modules.
|
||||
//
|
||||
// package java
|
||||
// var PrepareForIntegrationTestWithJava = FixturePreparers(
|
||||
// var PrepareForIntegrationTestWithJava = GroupFixturePreparers(
|
||||
// android.PrepareForIntegrationTestWithAndroid,
|
||||
// FixtureRegisterWithContext(RegisterAGroupOfRelatedModulesMutatorsAndSingletons),
|
||||
// FixtureRegisterWithContext(RegisterAnotherGroupOfRelatedModulesMutatorsAndSingletons),
|
||||
|
@ -144,7 +144,7 @@ import (
|
|||
// }
|
||||
//
|
||||
// package cc
|
||||
// var PrepareForTestWithCC = FixturePreparers(
|
||||
// var PrepareForTestWithCC = GroupFixturePreparers(
|
||||
// android.PrepareForArchMutator,
|
||||
// android.prepareForPrebuilts,
|
||||
// FixtureRegisterWithContext(RegisterRequiredBuildComponentsForTest),
|
||||
|
@ -153,7 +153,7 @@ import (
|
|||
//
|
||||
// package apex
|
||||
//
|
||||
// var PrepareForApex = FixturePreparers(
|
||||
// var PrepareForApex = GroupFixturePreparers(
|
||||
// ...
|
||||
// )
|
||||
//
|
||||
|
@ -285,9 +285,12 @@ func FixtureWithRootAndroidBp(contents string) FixturePreparer {
|
|||
return FixtureAddTextFile("Android.bp", contents)
|
||||
}
|
||||
|
||||
// Create a composite FixturePreparer that is equivalent to applying each of the supplied
|
||||
// FixturePreparer instances in order.
|
||||
func FixturePreparers(preparers ...FixturePreparer) FixturePreparer {
|
||||
// GroupFixturePreparers creates a composite FixturePreparer that is equivalent to applying each of
|
||||
// the supplied FixturePreparer instances in order.
|
||||
//
|
||||
// Before preparing the fixture the list of preparers is flattened by replacing each
|
||||
// instance of GroupFixturePreparers with its contents.
|
||||
func GroupFixturePreparers(preparers ...FixturePreparer) FixturePreparer {
|
||||
return &compositeFixturePreparer{dedupAndFlattenPreparers(nil, preparers)}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ func TestFixtureDedup(t *testing.T) {
|
|||
preparer3 := appendToList("preparer3")
|
||||
preparer4 := appendToList("preparer4")
|
||||
|
||||
preparer1Then2 := FixturePreparers(preparer1, preparer2)
|
||||
preparer1Then2 := GroupFixturePreparers(preparer1, preparer2)
|
||||
|
||||
preparer2Then1 := FixturePreparers(preparer2, preparer1)
|
||||
preparer2Then1 := GroupFixturePreparers(preparer2, preparer1)
|
||||
|
||||
buildDir := "build"
|
||||
factory := NewFixtureFactory(&buildDir, preparer1, preparer2, preparer1, preparer1Then2)
|
||||
|
|
|
@ -48,7 +48,7 @@ func NewTestContext(config Config) *TestContext {
|
|||
return ctx
|
||||
}
|
||||
|
||||
var PrepareForTestWithArchMutator = FixturePreparers(
|
||||
var PrepareForTestWithArchMutator = GroupFixturePreparers(
|
||||
// Configure architecture targets in the fixture config.
|
||||
FixtureModifyConfig(modifyTestConfigToSupportArchMutator),
|
||||
|
||||
|
@ -73,7 +73,7 @@ var PrepareForTestWithOverrides = FixtureRegisterWithContext(func(ctx Registrati
|
|||
})
|
||||
|
||||
// Prepares an integration test with build components from the android package.
|
||||
var PrepareForIntegrationTestWithAndroid = FixturePreparers(
|
||||
var PrepareForIntegrationTestWithAndroid = GroupFixturePreparers(
|
||||
// Mutators. Must match order in mutator.go.
|
||||
PrepareForTestWithArchMutator,
|
||||
PrepareForTestWithDefaults,
|
||||
|
|
Loading…
Reference in New Issue