Merge "bp2build converter for android_test_helper_app." into main am: 72e22018c3 am: 915ddd751b am: 47eb84435b am: 0c83759827 am: 9444e10496

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2757525

Change-Id: Iad45e344f465500e9fa7f86845e74e0d1e6fd27a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jingwen Chen
2023-09-21 18:42:38 +00:00
committed by Automerger Merge Worker
4 changed files with 134 additions and 0 deletions

View File

@@ -1258,6 +1258,8 @@ type AndroidTestHelperApp struct {
AndroidApp
appTestHelperAppProperties appTestHelperAppProperties
android.BazelModuleBase
}
func (a *AndroidTestHelperApp) InstallInTestcases() bool {
@@ -1289,6 +1291,7 @@ func AndroidTestHelperAppFactory() android.Module {
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
android.InitApexModule(module)
android.InitBazelModule(module)
return module
}
@@ -1799,3 +1802,27 @@ func (at *AndroidTest) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
}
}
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)
}
}