Merge "Add java_test and java_test_host"
This commit is contained in:
@@ -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 {
|
func (prebuilt *Import) AndroidMk() android.AndroidMkData {
|
||||||
return android.AndroidMkData{
|
return android.AndroidMkData{
|
||||||
Class: "JAVA_LIBRARIES",
|
Class: "JAVA_LIBRARIES",
|
||||||
|
55
java/java.go
55
java/java.go
@@ -39,6 +39,8 @@ func init() {
|
|||||||
android.RegisterModuleType("java_library_host", LibraryHostFactory)
|
android.RegisterModuleType("java_library_host", LibraryHostFactory)
|
||||||
android.RegisterModuleType("java_binary", BinaryFactory)
|
android.RegisterModuleType("java_binary", BinaryFactory)
|
||||||
android.RegisterModuleType("java_binary_host", BinaryHostFactory)
|
android.RegisterModuleType("java_binary_host", BinaryHostFactory)
|
||||||
|
android.RegisterModuleType("java_test", TestFactory)
|
||||||
|
android.RegisterModuleType("java_test_host", TestHostFactory)
|
||||||
android.RegisterModuleType("java_import", ImportFactory)
|
android.RegisterModuleType("java_import", ImportFactory)
|
||||||
android.RegisterModuleType("java_import_host", ImportFactoryHost)
|
android.RegisterModuleType("java_import_host", ImportFactoryHost)
|
||||||
|
|
||||||
@@ -1208,6 +1210,59 @@ func LibraryHostFactory() android.Module {
|
|||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Java Junit Tests
|
||||||
|
//
|
||||||
|
|
||||||
|
type testProperties struct {
|
||||||
|
// If true, add a static dependency on the platform junit library. Defaults to true.
|
||||||
|
Junit *bool
|
||||||
|
|
||||||
|
// list of compatibility suites (for example "cts", "vts") that the module should be
|
||||||
|
// installed into.
|
||||||
|
Test_suites []string `android:"arch_variant"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Test struct {
|
||||||
|
Library
|
||||||
|
|
||||||
|
testProperties testProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
j.deps(ctx)
|
||||||
|
if j.testProperties.Junit == nil || *j.testProperties.Junit == true {
|
||||||
|
ctx.AddDependency(ctx.Module(), staticLibTag, "junit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestFactory() android.Module {
|
||||||
|
module := &Test{}
|
||||||
|
|
||||||
|
module.AddProperties(
|
||||||
|
&module.Module.properties,
|
||||||
|
&module.Module.deviceProperties,
|
||||||
|
&module.Module.protoProperties,
|
||||||
|
&module.testProperties)
|
||||||
|
|
||||||
|
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||||
|
android.InitDefaultableModule(module)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestHostFactory() android.Module {
|
||||||
|
module := &Test{}
|
||||||
|
|
||||||
|
module.AddProperties(
|
||||||
|
&module.Module.properties,
|
||||||
|
&module.Module.protoProperties,
|
||||||
|
&module.testProperties)
|
||||||
|
|
||||||
|
InitJavaModule(module, android.HostSupported)
|
||||||
|
android.InitDefaultableModule(module)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Java Binaries (.jar file plus wrapper script)
|
// Java Binaries (.jar file plus wrapper script)
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user