summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rwxr-xr-xjava/app.go10
-rw-r--r--java/app_test.go5
2 files changed, 14 insertions, 1 deletions
diff --git a/java/app.go b/java/app.go
index 52348086e..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
diff --git a/java/app_test.go b/java/app_test.go
index 3fb67c188..c77f29d23 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -2330,12 +2330,14 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
srcs: ["b.java"],
package_name: "com.android.bar.test",
instrumentation_for: "foo",
+ mainline_package_name: "com.android.bar",
}
override_android_test {
name: "baz_test",
base: "foo_test",
package_name: "com.android.baz.test",
+ mainline_package_name: "com.android.baz",
}
`)
@@ -2354,6 +2356,7 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
expectedFlags: []string{
"--manifest out/soong/.intermediates/bar_test/android_common/manifest_fixer/AndroidManifest.xml",
"--package-name com.android.bar.test",
+ "--mainline-package-name com.android.bar",
},
},
{
@@ -2363,6 +2366,8 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
"--manifest out/soong/.intermediates/foo_test/android_common_baz_test/manifest_fixer/AndroidManifest.xml",
"--package-name com.android.baz.test",
"--test-file-name baz_test.apk",
+ "out/soong/.intermediates/foo_test/android_common_baz_test/test_config_fixer/AndroidTest.xml",
+ "--mainline-package-name com.android.baz",
},
},
}