Support data properties in java_test and android_test
am: d96ca35779
Change-Id: I644e716c7fc249468115144b44d4dc273a8fd846
This commit is contained in:
@@ -114,6 +114,8 @@ func (j *Test) AndroidMk() android.AndroidMkData {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
androidMkWriteTestData(j.data, &data)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +257,7 @@ func (a *AndroidTest) AndroidMk() android.AndroidMkData {
|
|||||||
fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", a.testConfig.String())
|
fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", a.testConfig.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
androidMkWriteTestData(a.data, &data)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
@@ -375,3 +378,15 @@ func (ddoc *Droiddoc) AndroidMk() android.AndroidMkData {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func androidMkWriteTestData(data android.Paths, ret *android.AndroidMkData) {
|
||||||
|
var testFiles []string
|
||||||
|
for _, d := range data {
|
||||||
|
testFiles = append(testFiles, d.String()+":"+d.Rel())
|
||||||
|
}
|
||||||
|
if len(testFiles) > 0 {
|
||||||
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
|
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUPPORT_FILES := "+strings.Join(testFiles, " "))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -224,6 +224,7 @@ type AndroidTest struct {
|
|||||||
testProperties testProperties
|
testProperties testProperties
|
||||||
|
|
||||||
testConfig android.Path
|
testConfig android.Path
|
||||||
|
data android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
@@ -236,10 +237,12 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.generateAndroidBuildActions(ctx)
|
a.generateAndroidBuildActions(ctx)
|
||||||
|
|
||||||
a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.manifestPath)
|
a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.manifestPath)
|
||||||
|
a.data = ctx.ExpandSources(a.testProperties.Data, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
android.ExtractSourceDeps(ctx, a.testProperties.Test_config)
|
android.ExtractSourceDeps(ctx, a.testProperties.Test_config)
|
||||||
|
android.ExtractSourcesDeps(ctx, a.testProperties.Data)
|
||||||
a.AndroidApp.DepsMutator(ctx)
|
a.AndroidApp.DepsMutator(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1357,6 +1357,10 @@ type testProperties struct {
|
|||||||
// the name of the test configuration (for example "AndroidTest.xml") that should be
|
// the name of the test configuration (for example "AndroidTest.xml") that should be
|
||||||
// installed with the module.
|
// installed with the module.
|
||||||
Test_config *string `android:"arch_variant"`
|
Test_config *string `android:"arch_variant"`
|
||||||
|
|
||||||
|
// list of files or filegroup modules that provide data that should be installed alongside
|
||||||
|
// the test
|
||||||
|
Data []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Test struct {
|
type Test struct {
|
||||||
@@ -1365,10 +1369,12 @@ type Test struct {
|
|||||||
testProperties testProperties
|
testProperties testProperties
|
||||||
|
|
||||||
testConfig android.Path
|
testConfig android.Path
|
||||||
|
data android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config)
|
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config)
|
||||||
|
j.data = ctx.ExpandSources(j.testProperties.Data, nil)
|
||||||
|
|
||||||
j.Library.GenerateAndroidBuildActions(ctx)
|
j.Library.GenerateAndroidBuildActions(ctx)
|
||||||
}
|
}
|
||||||
@@ -1379,6 +1385,7 @@ func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
ctx.AddDependency(ctx.Module(), staticLibTag, "junit")
|
ctx.AddDependency(ctx.Module(), staticLibTag, "junit")
|
||||||
}
|
}
|
||||||
android.ExtractSourceDeps(ctx, j.testProperties.Test_config)
|
android.ExtractSourceDeps(ctx, j.testProperties.Test_config)
|
||||||
|
android.ExtractSourcesDeps(ctx, j.testProperties.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFactory() android.Module {
|
func TestFactory() android.Module {
|
||||||
|
Reference in New Issue
Block a user