Add test data dependencies to APEX.

Test: soong go tests

Bug: 155820504
Change-Id: If96d82c27f19953e34efb31f2111f1643c0c4008
This commit is contained in:
Liz Kammer
2020-05-12 15:26:55 -07:00
parent c81f967ddd
commit 1c14a21994
7 changed files with 61 additions and 3 deletions

View File

@@ -149,7 +149,7 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{entries}
}
func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, entries *android.AndroidMkEntries) {
func AndroidMkDataPaths(data android.Paths) []string {
var testFiles []string
for _, d := range data {
rel := d.Rel()
@@ -160,6 +160,11 @@ func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, entries *a
path = strings.TrimSuffix(path, rel)
testFiles = append(testFiles, path+":"+rel)
}
return testFiles
}
func androidMkWriteTestData(data android.Paths, ctx AndroidMkContext, entries *android.AndroidMkEntries) {
testFiles := AndroidMkDataPaths(data)
if len(testFiles) > 0 {
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
entries.AddStrings("LOCAL_TEST_DATA", testFiles...)

View File

@@ -1395,6 +1395,15 @@ func (c *Module) IsTestPerSrcAllTestsVariation() bool {
return ok && test.isAllTestsVariation()
}
func (c *Module) DataPaths() android.Paths {
if p, ok := c.installer.(interface {
dataPaths() android.Paths
}); ok {
return p.dataPaths()
}
return nil
}
func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string {
// Returns the name suffix for product and vendor variants. If the VNDK version is not
// "current", it will append the VNDK version to the name suffix.

View File

@@ -160,6 +160,10 @@ func (test *testBinary) srcs() []string {
return test.baseCompiler.Properties.Srcs
}
func (test *testBinary) dataPaths() android.Paths {
return test.data
}
func (test *testBinary) isAllTestsVariation() bool {
stem := test.binaryDecorator.Properties.Stem
return stem != nil && *stem == ""