aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorusta <usta@google.com>2023-03-13 15:38:27 -0400
committerUsta (Tsering) Shrestha <usta@google.com>2023-03-14 19:12:26 +0000
commitd1dd74bb275f5f5e309217e58938bac044a73680 (patch)
tree4bd5490a1813a55206260bdb3963a5c9b0dd8267 /scripts
parent947644587ff349c9e6366a053f5d03c664692a1a (diff)
downloadbazel-d1dd74bb275f5f5e309217e58938bac044a73680.tar.gz
warn against non-default product for perf tests
Test: TARGET_PRODUCT=aosp_x86 && incremental-build.py Bug: NA Change-Id: I09850c70ed8b03e37bebeb87e79351d8ada2f02e
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/incremental_build/incremental_build.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/scripts/incremental_build/incremental_build.py b/scripts/incremental_build/incremental_build.py
index c451bdf4..61749af6 100755
--- a/scripts/incremental_build/incremental_build.py
+++ b/scripts/incremental_build/incremental_build.py
@@ -65,14 +65,24 @@ def _prepare_env() -> (Mapping[str, str], str):
'SOONG_UI_NINJA_ARGS': get_soong_ui_ninja_args()
}
env = {**os.environ, **overrides}
- if not os.environ.get('TARGET_PRODUCT'):
- # TODO: Switch to oriole when it works
- env['TARGET_PRODUCT'] = 'cf_x86_64_phone' \
- if util.get_top_dir().joinpath('vendor/google/build').exists() \
- else 'aosp_cf_x86_64_phone'
- if not os.environ.get('TARGET_BUILD_VARIANT'):
- env['TARGET_BUILD_VARIANT'] = 'eng'
-
+ # TODO: Switch to oriole when it works
+ default_product: Final[str] = 'cf_x86_64_phone' \
+ if util.get_top_dir().joinpath('vendor/google/build').exists() \
+ else 'aosp_cf_x86_64_phone'
+ target_product = os.environ.get('TARGET_PRODUCT') or default_product
+ variant = os.environ.get('TARGET_BUILD_VARIANT') or 'eng'
+
+ if target_product != default_product or variant != 'eng':
+ if util.is_interactive_shell():
+ response = input(f'Are you sure you want {target_product}-{variant} '
+ f'and not {default_product}-eng? [Y/n]')
+ if response.upper() != 'Y':
+ sys.exit(1)
+ else:
+ logging.warning(
+ f'Using {target_product}-{variant} instead of {default_product}-eng')
+ env['TARGET_PRODUCT'] = target_product
+ env['TARGET_BUILD_VARIANT'] = variant
pretty_env_str = [f'{k}={v}' for (k, v) in env.items()]
pretty_env_str.sort()
return env, '\n'.join(pretty_env_str)