summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/PRESUBMIT.py
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/PRESUBMIT.py')
-rw-r--r--chrome/common/extensions/PRESUBMIT.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome/common/extensions/PRESUBMIT.py b/chrome/common/extensions/PRESUBMIT.py
new file mode 100644
index 0000000..4370630
--- /dev/null
+++ b/chrome/common/extensions/PRESUBMIT.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# Copyright (c) 2009 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.
+
+import os.path
+
+# When files in these directories are changed, we display a warning.
+DEPENDENT_DIRS = set([
+ os.path.normpath("chrome/common/extensions/api"),
+ os.path.normpath("chrome/common/extensions/docs")
+])
+
+# Except for these directories.
+BLACKLIST_DIRS = set([
+ os.path.normpath("chrome/common/extensions/docs/server")
+])
+
+REBUILD_WARNING = """
+This change modifies file(s) which the extension docs depend on. You must
+rebuild the extension docs.
+
+Build by running the build.py script in chrome/common/extensions/docs/build/.
+
+Be sure to include any modified resulting static files
+(/common/extension/docs/*.html) in your final changelist.
+"""
+
+def CheckChange(input_api, output_api):
+ for f in input_api.AffectedFiles():
+ dir = os.path.normpath(input_api.os_path.dirname(f.LocalPath()))
+ while len(dir):
+ if dir in BLACKLIST_DIRS:
+ return []
+ if dir in DEPENDENT_DIRS:
+ return [output_api.PresubmitPromptWarning(REBUILD_WARNING)]
+ dir = os.path.dirname(dir)
+ return []
+
+def CheckChangeOnUpload(input_api, output_api):
+ return CheckChange(input_api, output_api)
+
+def CheckChangeOnCommit(input_api, output_api):
+ return CheckChange(input_api, output_api)