diff options
Diffstat (limited to 'apex/builder.go')
| -rw-r--r-- | apex/builder.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apex/builder.go b/apex/builder.go index a66e1e0fc..fc4bf8a22 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -397,6 +397,12 @@ func (a *apexBundle) buildBundleConfig(ctx android.ModuleContext) android.Output return output.OutputPath } +func markManifestTestOnly(ctx android.ModuleContext, androidManifestFile android.Path) android.Path { + return java.ManifestFixer(ctx, androidManifestFile, java.ManifestFixerParams{ + TestOnly: true, + }) +} + // buildUnflattendApex creates build rules to build an APEX using apexer. func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { apexType := a.properties.ApexType @@ -595,8 +601,15 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { if a.properties.AndroidManifest != nil { androidManifestFile := android.PathForModuleSrc(ctx, proptools.String(a.properties.AndroidManifest)) + + if a.testApex { + androidManifestFile = markManifestTestOnly(ctx, androidManifestFile) + } + implicitInputs = append(implicitInputs, androidManifestFile) optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String()) + } else if a.testApex { + optFlags = append(optFlags, "--test_only") } // Determine target/min sdk version from the context |