Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.
Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
diff --git a/java/androidmk.go b/java/androidmk.go
index 544322e..4eae81e 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -106,10 +106,11 @@
if len(j.testProperties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
strings.Join(j.testProperties.Test_suites, " "))
+ } else {
+ fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE := null-suite")
}
- if j.testProperties.Test_config != nil {
- fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=",
- *j.testProperties.Test_config)
+ if j.testConfig != nil {
+ fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", j.testConfig.String())
}
})
@@ -247,10 +248,11 @@
if len(a.testProperties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
strings.Join(a.testProperties.Test_suites, " "))
+ } else {
+ fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE := null-suite")
}
- if a.testProperties.Test_config != nil {
- fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=",
- *a.testProperties.Test_config)
+ if a.testConfig != nil {
+ fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", a.testConfig.String())
}
})
diff --git a/java/app.go b/java/app.go
index ef591b7..0ca7a2b 100644
--- a/java/app.go
+++ b/java/app.go
@@ -22,6 +22,7 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/tradefed"
)
func init() {
@@ -221,6 +222,8 @@
appTestProperties appTestProperties
testProperties testProperties
+
+ testConfig android.Path
}
func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -231,6 +234,13 @@
}
a.generateAndroidBuildActions(ctx)
+
+ a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.manifestPath)
+}
+
+func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) {
+ android.ExtractSourceDeps(ctx, a.testProperties.Test_config)
+ a.AndroidApp.DepsMutator(ctx)
}
func AndroidTestFactory() android.Module {
diff --git a/java/java.go b/java/java.go
index c912368..8fe4f35 100644
--- a/java/java.go
+++ b/java/java.go
@@ -29,6 +29,7 @@
"android/soong/android"
"android/soong/java/config"
+ "android/soong/tradefed"
)
func init() {
@@ -1362,6 +1363,14 @@
Library
testProperties testProperties
+
+ testConfig android.Path
+}
+
+func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config)
+
+ j.Library.GenerateAndroidBuildActions(ctx)
}
func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -1369,6 +1378,7 @@
if BoolDefault(j.testProperties.Junit, true) {
ctx.AddDependency(ctx.Module(), staticLibTag, "junit")
}
+ android.ExtractSourceDeps(ctx, j.testProperties.Test_config)
}
func TestFactory() android.Module {