Support testing versioned/unversioned sdk Android.bp files separately
Previously, the only way to test the Android.bp file generated by the sdk module was to test both the unversioned and versioned parts together. This change allows them to be tested separately. Bug: 180479010 Test: m nothing Change-Id: I3d695bcfbff030a6da393283ab30ec0979fb2826
This commit is contained in:
@@ -572,12 +572,20 @@ func (t pruneEmptySetTransformer) transformPropertySetAfterContents(name string,
|
||||
}
|
||||
|
||||
func generateBpContents(contents *generatedContents, bpFile *bpFile) {
|
||||
generateFilteredBpContents(contents, bpFile, func(*bpModule) bool {
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func generateFilteredBpContents(contents *generatedContents, bpFile *bpFile, moduleFilter func(module *bpModule) bool) {
|
||||
contents.Printfln("// This is auto-generated. DO NOT EDIT.")
|
||||
for _, bpModule := range bpFile.order {
|
||||
contents.Printfln("")
|
||||
contents.Printfln("%s {", bpModule.moduleType)
|
||||
outputPropertySet(contents, bpModule.bpPropertySet)
|
||||
contents.Printfln("}")
|
||||
if moduleFilter(bpModule) {
|
||||
contents.Printfln("")
|
||||
contents.Printfln("%s {", bpModule.moduleType)
|
||||
outputPropertySet(contents, bpModule.bpPropertySet)
|
||||
contents.Printfln("}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,6 +647,22 @@ func (s *sdk) GetAndroidBpContentsForTests() string {
|
||||
return contents.content.String()
|
||||
}
|
||||
|
||||
func (s *sdk) GetUnversionedAndroidBpContentsForTests() string {
|
||||
contents := &generatedContents{}
|
||||
generateFilteredBpContents(contents, s.builderForTests.bpFile, func(module *bpModule) bool {
|
||||
return !strings.Contains(module.properties["name"].(string), "@")
|
||||
})
|
||||
return contents.content.String()
|
||||
}
|
||||
|
||||
func (s *sdk) GetVersionedAndroidBpContentsForTests() string {
|
||||
contents := &generatedContents{}
|
||||
generateFilteredBpContents(contents, s.builderForTests.bpFile, func(module *bpModule) bool {
|
||||
return strings.Contains(module.properties["name"].(string), "@")
|
||||
})
|
||||
return contents.content.String()
|
||||
}
|
||||
|
||||
type snapshotBuilder struct {
|
||||
ctx android.ModuleContext
|
||||
sdk *sdk
|
||||
|
Reference in New Issue
Block a user