Convert robolectric_test's module-info.json to song
This produces this diff, which I beleive is beneign:
https://paste.googleplex.com/4846726910050304
Bug: 389720048
Test: diff'd module-info.json
Change-Id: I531644d208a0a9d0fb2166d158f77e671554e5d8
diff --git a/java/java.go b/java/java.go
index 66550d5..a5e1be7 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1070,6 +1070,10 @@
setOutputFiles(ctx, j.Module)
+ j.javaLibraryModuleInfoJSON(ctx)
+}
+
+func (j *Library) javaLibraryModuleInfoJSON(ctx android.ModuleContext) *android.ModuleInfoJSON {
moduleInfoJSON := ctx.ModuleInfoJSON()
moduleInfoJSON.Class = []string{"JAVA_LIBRARIES"}
if j.implementationAndResourcesJar != nil {
@@ -1092,6 +1096,7 @@
moduleInfoJSON.Disabled = true
j.dexpreopter.ModuleInfoJSONForApex(ctx)
}
+ return moduleInfoJSON
}
func (j *Library) getJarInstallDir(ctx android.ModuleContext) android.InstallPath {
diff --git a/java/robolectric.go b/java/robolectric.go
index ff0c850..ed3fc9a 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -261,6 +261,19 @@
setExtraJavaInfo(ctx, r, javaInfo)
android.SetProvider(ctx, JavaInfoProvider, javaInfo)
}
+
+ moduleInfoJSON := r.javaLibraryModuleInfoJSON(ctx)
+ if _, ok := r.testConfig.(android.WritablePath); ok {
+ moduleInfoJSON.AutoTestConfig = []string{"true"}
+ }
+ if r.testConfig != nil {
+ moduleInfoJSON.TestConfig = append(moduleInfoJSON.TestConfig, r.testConfig.String())
+ }
+ if len(r.testProperties.Test_suites) > 0 {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, r.testProperties.Test_suites...)
+ } else {
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "null-suite")
+ }
}
func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile android.ModuleOutPath) {