Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2017 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 changes affecting chrome/android/webapk/shell_apk | |
| 6 | |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | |
| 8 for more details about the presubmit API built into depot_tools. | |
| 9 """ | |
| 10 | |
| 11 | |
| 12 SRC_LOCAL_PATH = r'src/org/chromium/webapk/shell_apk' | |
| 13 ANDROID_MANIFEST_LOCAL_PATH = r'AndroidManifest.xml' | |
| 14 SHELL_APK_VERSION_LOCAL_PATH = r'shell_apk_version.gni' | |
| 15 | |
| 16 | |
| 17 def _CommonChecks(input_api, output_api): | |
| 18 """Checks common to both upload and commit.""" | |
| 19 # affected_files is list of files affected by this change. The paths are | |
| 20 # relative to the directory containing PRESUBMIT.py. | |
| 21 affected_files = [ | |
| 22 input_api.os_path.relpath(f, input_api.PresubmitLocalPath()) | |
| 23 for f in input_api.AbsoluteLocalPaths() | |
| 24 ] | |
| 25 | |
| 26 problems = [] | |
| 27 | |
| 28 shell_apk_version_update_needed = False | |
| 29 shell_apk_version_is_updated = False | |
| 30 for f in affected_files: | |
| 31 if f.startswith(SRC_LOCAL_PATH): | |
|
pkotwicz
2017/04/21 20:17:30
We should also check whether any files in res/ wer
F
2017/04/26 19:59:24
Done.
| |
| 32 shell_apk_version_update_needed = True | |
| 33 problems.append(f) | |
| 34 elif f == ANDROID_MANIFEST_LOCAL_PATH: | |
| 35 shell_apk_version_update_needed = True | |
| 36 problems.append(f) | |
| 37 elif f == SHELL_APK_VERSION_LOCAL_PATH: | |
| 38 shell_apk_version_is_updated = True | |
| 39 | |
| 40 if shell_apk_version_update_needed and not shell_apk_version_is_updated: | |
| 41 return [output_api.PresubmitPromptWarning( | |
| 42 '%s needs to be updated for shell APK version due to changes in:' % | |
| 43 SHELL_APK_VERSION_LOCAL_PATH, items=problems)] | |
|
pkotwicz
2017/04/21 20:17:30
This is not quite right.
The correct sequence of
hartmanng
2017/04/21 20:34:28
We could change things around to make this work, b
| |
| 44 | |
| 45 return [] | |
| 46 | |
| 47 | |
| 48 def CheckChangeOnUpload(input_api, output_api): | |
| 49 return _CommonChecks(input_api, output_api) | |
| 50 | |
| 51 | |
| 52 def CheckChangeOnCommit(input_api, output_api): | |
| 53 return _CommonChecks(input_api, output_api) | |
| OLD | NEW |