summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorDan Shi <dshi@google.com>2019-09-26 11:41:36 -0700
committerDan Shi <dshi@google.com>2019-09-26 13:29:28 -0700
commit6ffaaa830dd7311509aa07322810013a874ff8e6 (patch)
tree97a96fc9a4b31cbbe2f979618578d4aba2180dbb /java/java.go
parent505bcb88ed57676208353ba89c329d7edce1c814 (diff)
Allow test to specify whether or not to auto-generate test config
Attribute `auto_gen_config` is added to test modules. Test config will be generated if: the attribute is not set and AndroidTest.xml doesn't exists or the attribute is set to true, whether or not AndroidTest.xml exists. Test config will NOT be auto-generated if: the attribute is not set and AndroidTest.xml exists or the attribute is set to false, whether or not AndroidTest.xml exists. Bug: 141684102 Test: build test module with auto_gen_config set to true Change-Id: I64fb003a83d8c32a967835e5f8d12fe4476043be
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go
index 4dd6a490e..ce72c2760 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1685,6 +1685,11 @@ type testProperties struct {
// list of files or filegroup modules that provide data that should be installed alongside
// the test
Data []string `android:"path"`
+
+ // Flag to indicate whether or not to create test config automatically. If AndroidTest.xml
+ // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true
+ // explicitly.
+ Auto_gen_config *bool
}
type testHelperLibraryProperties struct {
@@ -1709,7 +1714,8 @@ type TestHelperLibrary struct {
}
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template, j.testProperties.Test_suites)
+ j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template,
+ j.testProperties.Test_suites, j.testProperties.Auto_gen_config)
j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data)
j.Library.GenerateAndroidBuildActions(ctx)