summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go46
1 files changed, 31 insertions, 15 deletions
diff --git a/java/java.go b/java/java.go
index 275abbe35..6d53e1e32 100644
--- a/java/java.go
+++ b/java/java.go
@@ -915,6 +915,10 @@ type TestOptions struct {
// a list of extra test configuration files that should be installed with the module.
Extra_test_configs []string `android:"path,arch_variant"`
+
+ // Extra <option> tags to add to the auto generated test xml file. The "key"
+ // is optional in each of these.
+ Tradefed_options []tradefed.Option
}
type testProperties struct {
@@ -1192,9 +1196,18 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
defaultUnitTest := !inList("tradefed", j.properties.Libs) && !inList("cts", j.testProperties.Test_suites)
j.testProperties.Test_options.Unit_test = proptools.BoolPtr(defaultUnitTest)
}
-
- j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template,
- j.testProperties.Test_suites, configs, j.testProperties.Auto_gen_config, j.testProperties.Test_options.Unit_test)
+ j.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{
+ TestConfigProp: j.testProperties.Test_config,
+ TestConfigTemplateProp: j.testProperties.Test_config_template,
+ TestSuites: j.testProperties.Test_suites,
+ Config: configs,
+ OptionsForAutogenerated: j.testProperties.Test_options.Tradefed_options,
+ AutoGenConfig: j.testProperties.Auto_gen_config,
+ UnitTest: j.testProperties.Test_options.Unit_test,
+ DeviceTemplate: "${JavaTestConfigTemplate}",
+ HostTemplate: "${JavaHostTestConfigTemplate}",
+ HostUnitTestTemplate: "${JavaHostUnitTestConfigTemplate}",
+ })
j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data)
@@ -1239,8 +1252,13 @@ func (j *TestHelperLibrary) GenerateAndroidBuildActions(ctx android.ModuleContex
}
func (j *JavaTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.prebuiltTestProperties.Test_config, nil,
- j.prebuiltTestProperties.Test_suites, nil, nil, nil)
+ j.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{
+ TestConfigProp: j.prebuiltTestProperties.Test_config,
+ TestSuites: j.prebuiltTestProperties.Test_suites,
+ DeviceTemplate: "${JavaTestConfigTemplate}",
+ HostTemplate: "${JavaHostTestConfigTemplate}",
+ HostUnitTestTemplate: "${JavaHostUnitTestConfigTemplate}",
+ })
j.Import.GenerateAndroidBuildActions(ctx)
}
@@ -2738,14 +2756,6 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
Rule_class: "java_library",
Bzl_load_location: "//build/bazel/rules/java:library.bzl",
}
-
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, attrs)
- neverlinkProp := true
- neverLinkAttrs := &javaLibraryAttributes{
- Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
- Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
- }
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name + "-neverlink"}, neverLinkAttrs)
} else {
attrs.Common_srcs = bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.properties.Common_srcs))
@@ -2753,10 +2763,16 @@ func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
Rule_class: "kt_jvm_library",
Bzl_load_location: "@rules_kotlin//kotlin:jvm_library.bzl",
}
- // TODO (b/244210934): create neverlink-duplicate target once kt_jvm_library supports neverlink attribute
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, attrs)
}
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name}, attrs)
+ neverlinkProp := true
+ neverLinkAttrs := &javaLibraryAttributes{
+ Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
+ Neverlink: bazel.BoolAttribute{Value: &neverlinkProp},
+ }
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: name + "-neverlink"}, neverLinkAttrs)
+
}
type javaBinaryHostAttributes struct {