Peter Wen | 52efd3192 | 2018-01-31 22:04:52 | [diff] [blame] | 1 | # Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """Presubmit script for android buildbot. |
| 6 | |
| 7 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| 8 | details on the presubmit API built into depot_tools. |
| 9 | """ |
| 10 | |
Keren Zhu | afbefc9 | 2021-06-30 18:40:20 | [diff] [blame] | 11 | USE_PYTHON3 = True |
| 12 | |
Peter Wen | 52efd3192 | 2018-01-31 22:04:52 | [diff] [blame] | 13 | |
| 14 | def CommonChecks(input_api, output_api): |
| 15 | base_android_jni_generator_dir = input_api.PresubmitLocalPath() |
| 16 | |
| 17 | env = dict(input_api.environ) |
| 18 | env.update({ |
Eric Stevenson | d00e9a1 | 2019-05-22 15:55:11 | [diff] [blame] | 19 | 'PYTHONPATH': base_android_jni_generator_dir, |
| 20 | 'PYTHONDONTWRITEBYTECODE': '1', |
Peter Wen | 52efd3192 | 2018-01-31 22:04:52 | [diff] [blame] | 21 | }) |
| 22 | |
Andrew Grieve | de87fa01 | 2022-07-05 18:55:37 | [diff] [blame^] | 23 | return input_api.RunTests( |
| 24 | input_api.canned_checks.GetUnitTests( |
| 25 | input_api, |
| 26 | output_api, |
| 27 | run_on_python2=False, |
| 28 | unit_tests=[ |
| 29 | input_api.os_path.join(base_android_jni_generator_dir, |
| 30 | 'jni_generator_tests.py') |
| 31 | ], |
| 32 | env=env, |
| 33 | )) |
Peter Wen | 52efd3192 | 2018-01-31 22:04:52 | [diff] [blame] | 34 | |
| 35 | |
| 36 | def CheckChangeOnUpload(input_api, output_api): |
Eric Stevenson | d00e9a1 | 2019-05-22 15:55:11 | [diff] [blame] | 37 | return CommonChecks(input_api, output_api) |
Peter Wen | 52efd3192 | 2018-01-31 22:04:52 | [diff] [blame] | 38 | |
| 39 | |
| 40 | def CheckChangeOnCommit(input_api, output_api): |
Eric Stevenson | d00e9a1 | 2019-05-22 15:55:11 | [diff] [blame] | 41 | return CommonChecks(input_api, output_api) |