summaryrefslogtreecommitdiff
path: root/java/app.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/app.go')
-rwxr-xr-xjava/app.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/java/app.go b/java/app.go
index e7e52d471..1731970b3 100755
--- a/java/app.go
+++ b/java/app.go
@@ -984,8 +984,11 @@ type appTestProperties struct {
// The name of the android_app module that the tests will run against.
Instrumentation_for *string
- // if specified, the instrumentation target package name in the manifest is overwritten by it.
+ // If specified, the instrumentation target package name in the manifest is overwritten by it.
Instrumentation_target_package *string
+
+ // If specified, the mainline module package name in the test config is overwritten by it.
+ Mainline_package_name *string
}
type AndroidTest struct {
@@ -1063,6 +1066,11 @@ func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig androi
FlagWithArg("--package-name ", *a.overridableAppProperties.Package_name)
}
+ if a.appTestProperties.Mainline_package_name != nil {
+ fixNeeded = true
+ command.FlagWithArg("--mainline-package-name ", *a.appTestProperties.Mainline_package_name)
+ }
+
if fixNeeded {
rule.Build("fix_test_config", "fix test config")
return fixedConfig
@@ -1524,7 +1532,6 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
appAttrs.javaCommonAttributes = commonAttrs
appAttrs.bazelAapt = aapt
appAttrs.Deps = deps
- ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: a.Name()}, appAttrs)
} else {
ktName := a.Name() + "_kt"
commonAttrs.Common_srcs = bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, a.properties.Common_srcs))
@@ -1545,11 +1552,12 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
appAttrs.bazelAapt = &bazelAapt{Manifest: aapt.Manifest}
appAttrs.Deps = bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + ktName})
- ctx.CreateBazelTargetModule(
- props,
- android.CommonAttributes{Name: a.Name()},
- appAttrs,
- )
}
+ ctx.CreateBazelTargetModule(
+ props,
+ android.CommonAttributes{Name: a.Name()},
+ appAttrs,
+ )
+
}