Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1716)

Unified Diff: chrome/android/webapk/shell_apk/PRESUBMIT.py

Issue 2830343002: Add PRESUBMIT script to enforce WebAPK shell apk version update (Closed)
Patch Set: Add PRESUBMIT script to enforce WebAPK shell apk version update Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/webapk/shell_apk/PRESUBMIT.py
diff --git a/chrome/android/webapk/shell_apk/PRESUBMIT.py b/chrome/android/webapk/shell_apk/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc5b88eafc871ec2b553fa527a4853e0bf530032
--- /dev/null
+++ b/chrome/android/webapk/shell_apk/PRESUBMIT.py
@@ -0,0 +1,53 @@
+# Copyright (c) 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Presubmit script for changes affecting chrome/android/webapk/shell_apk
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details about the presubmit API built into depot_tools.
+"""
+
+
+SRC_LOCAL_PATH = r'src/org/chromium/webapk/shell_apk'
+ANDROID_MANIFEST_LOCAL_PATH = r'AndroidManifest.xml'
+SHELL_APK_VERSION_LOCAL_PATH = r'shell_apk_version.gni'
+
+
+def _CommonChecks(input_api, output_api):
+ """Checks common to both upload and commit."""
+ # affected_files is list of files affected by this change. The paths are
+ # relative to the directory containing PRESUBMIT.py.
+ affected_files = [
+ input_api.os_path.relpath(f, input_api.PresubmitLocalPath())
+ for f in input_api.AbsoluteLocalPaths()
+ ]
+
+ problems = []
+
+ shell_apk_version_update_needed = False
+ shell_apk_version_is_updated = False
+ for f in affected_files:
+ 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.
+ shell_apk_version_update_needed = True
+ problems.append(f)
+ elif f == ANDROID_MANIFEST_LOCAL_PATH:
+ shell_apk_version_update_needed = True
+ problems.append(f)
+ elif f == SHELL_APK_VERSION_LOCAL_PATH:
+ shell_apk_version_is_updated = True
+
+ if shell_apk_version_update_needed and not shell_apk_version_is_updated:
+ return [output_api.PresubmitPromptWarning(
+ '%s needs to be updated for shell APK version due to changes in:' %
+ 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
+
+ return []
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ return _CommonChecks(input_api, output_api)
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ return _CommonChecks(input_api, output_api)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698