Add java_test and java_test_host

java_test is equivalent to a java_library with a default junit
dependency and marked as a test in Make for installation and
automatic AndroidTest.xml generation.

Bug: 70770641
Test: m checkbuild
Change-Id: I9ca97521e952d121db46abff6f24f274dd7a3ad7
This commit is contained in:
Colin Cross
2018-04-09 18:40:24 -07:00
parent f19b9bb981
commit 05638fc76f
2 changed files with 68 additions and 0 deletions

View File

@@ -97,6 +97,19 @@ func (library *Library) AndroidMk() android.AndroidMkData {
}
}
func (j *Test) AndroidMk() android.AndroidMkData {
data := j.Library.AndroidMk()
data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests")
if len(j.testProperties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
strings.Join(j.testProperties.Test_suites, " "))
}
})
return data
}
func (prebuilt *Import) AndroidMk() android.AndroidMkData {
return android.AndroidMkData{
Class: "JAVA_LIBRARIES",