Add support for android_test modules

android_test module are APKs that can be run as tests, either
as standalone unit tests or as instrumentation tests for another
APK.

Test: m checkbuild
Change-Id: I16661701637e4048fd99442029c3e195ebf373a4
This commit is contained in:
Colin Cross
2018-05-22 11:11:52 -07:00
parent e467f44f9b
commit ae5caf554c
5 changed files with 188 additions and 17 deletions

View File

@@ -228,6 +228,19 @@ func (app *AndroidApp) AndroidMk() android.AndroidMkData {
}
}
func (a *AndroidTest) AndroidMk() android.AndroidMkData {
data := a.AndroidApp.AndroidMk()
data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests")
if len(a.testProperties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
strings.Join(a.testProperties.Test_suites, " "))
}
})
return data
}
func (a *AndroidLibrary) AndroidMk() android.AndroidMkData {
data := a.Library.AndroidMk()