diff options
| author | 2019-03-26 14:01:02 +0000 | |
|---|---|---|
| committer | 2019-03-26 14:01:02 +0000 | |
| commit | d637872f440cb3400700fffb34edcdb8ca637b91 (patch) | |
| tree | 5c0502cecdd9da44a2530b2d093285f386c8e6ff /java/java.go | |
| parent | 0aad00631ae8f4735f7fdbdeb99c9a7da542e514 (diff) | |
| parent | 42df144fd4c18171b76ed15e6c4e8ab4cf9749cd (diff) | |
Merge "Add java_test_helper_library"
Diffstat (limited to 'java/java.go')
| -rw-r--r-- | java/java.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go index 1fd0a9e31..beee1a5b5 100644 --- a/java/java.go +++ b/java/java.go @@ -41,6 +41,7 @@ func init() { android.RegisterModuleType("java_binary", BinaryFactory) android.RegisterModuleType("java_binary_host", BinaryHostFactory) android.RegisterModuleType("java_test", TestFactory) + android.RegisterModuleType("java_test_helper_library", TestHelperLibraryFactory) android.RegisterModuleType("java_test_host", TestHostFactory) android.RegisterModuleType("java_import", ImportFactory) android.RegisterModuleType("java_import_host", ImportFactoryHost) @@ -1536,6 +1537,12 @@ type testProperties struct { Data []string `android:"path"` } +type testHelperLibraryProperties struct { + // 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 @@ -1545,6 +1552,12 @@ type Test struct { data android.Paths } +type TestHelperLibrary struct { + Library + + testHelperLibraryProperties testHelperLibraryProperties +} + 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.data = android.PathsForModuleSrc(ctx, j.testProperties.Data) @@ -1552,6 +1565,10 @@ func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.Library.GenerateAndroidBuildActions(ctx) } +func (j *TestHelperLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { + j.Library.GenerateAndroidBuildActions(ctx) +} + // java_test builds a and links sources into a `.jar` file for the device, and possibly for the host as well, and // creates an `AndroidTest.xml` file to allow running the test with `atest` or a `TEST_MAPPING` file. // @@ -1577,6 +1594,21 @@ func TestFactory() android.Module { return module } +// java_test_helper_library creates a java library and makes sure that it is added to the appropriate test suite. +func TestHelperLibraryFactory() android.Module { + module := &TestHelperLibrary{} + + module.AddProperties( + &module.Module.properties, + &module.Module.deviceProperties, + &module.Module.dexpreoptProperties, + &module.Module.protoProperties, + &module.testHelperLibraryProperties) + + InitJavaModule(module, android.HostAndDeviceSupported) + return module +} + // java_test_host builds a and links sources into a `.jar` file for the host, and creates an `AndroidTest.xml` file to // allow running the test with `atest` or a `TEST_MAPPING` file. // |