diff options
| author | 2023-09-20 12:17:53 +0000 | |
|---|---|---|
| committer | 2023-09-20 14:31:17 +0000 | |
| commit | 2848be42360cc669ba1a7330df9293ca06611d84 (patch) | |
| tree | c389d33d0e881d1a5ba1209b19436949496f1324 /java | |
| parent | 5802d0795b252a13ab0fa2c0dfb5b0cb31cc3526 (diff) | |
bp2build converter for android_test_helper_app.
This module converts simply to an android_binary, but with testonly = True.
Test: new unit tests
Test: new example app
Fixes: 283518652
Change-Id: If6b7661c32caa7dada6d492cce106d96236f6205
Diffstat (limited to 'java')
| -rwxr-xr-x | java/app.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/java/app.go b/java/app.go index 1b4d279f7..c6ca22906 100755 --- a/java/app.go +++ b/java/app.go @@ -1257,6 +1257,8 @@ type AndroidTestHelperApp struct { AndroidApp appTestHelperAppProperties appTestHelperAppProperties + + android.BazelModuleBase } func (a *AndroidTestHelperApp) InstallInTestcases() bool { @@ -1288,6 +1290,7 @@ func AndroidTestHelperAppFactory() android.Module { android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) android.InitApexModule(module) + android.InitBazelModule(module) return module } @@ -1769,3 +1772,27 @@ func (at *AndroidTest) ConvertWithBp2build(ctx android.TopDownMutatorContext) { } } + +func (atha *AndroidTestHelperApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) { + if ok, commonAttrs, appAttrs := convertWithBp2build(ctx, &atha.AndroidApp); ok { + // an android_test_helper_app is an android_binary with testonly = True + commonAttrs.Testonly = proptools.BoolPtr(true) + + // additionally, it sets default values differently to android_app, + // https://cs.android.com/android/platform/superproject/main/+/main:build/soong/java/app.go;l=1273-1279;drc=e12c083198403ec694af6c625aed11327eb2bf7f + // + // installable: true (settable prop) + // use_embedded_native_libs: true (settable prop) + // lint.test: true (settable prop) + // optimize EnabledByDefault: true (blueprint mutated prop) + // AlwaysPackageNativeLibs: true (blueprint mutated prop) + // dexpreopt isTest: true (not prop) + + props := bazel.BazelTargetModuleProperties{ + Rule_class: "android_binary", + Bzl_load_location: "//build/bazel/rules/android:android_binary.bzl", + } + + ctx.CreateBazelTargetModule(props, commonAttrs, appAttrs) + } +} |