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

Unified Diff: third_party/polymer/PRESUBMIT.py

Issue 582873003: Polymer elements added to third_party/polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « third_party/polymer/LICENSE.polymer ('k') | third_party/polymer/README.chromium » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/polymer/PRESUBMIT.py
diff --git a/third_party/polymer/PRESUBMIT.py b/third_party/polymer/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..cc99f2b26387fe209a464a66b4882d802cbeb99d
--- /dev/null
+++ b/third_party/polymer/PRESUBMIT.py
@@ -0,0 +1,56 @@
+# Copyright 2014 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.
+
+"""Chromium presubmit script for third_party/polymer.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details on the presubmit API built into gcl.
+"""
+
+import os
+import json
+
+def _CheckBowerDependencies(input_api, output_api):
+ os_path = input_api.os_path
+ cwd = input_api.PresubmitLocalPath()
+ components_dir = os_path.join(cwd, 'components')
+ bower_json_path = os_path.join(cwd, 'bower.json')
+
+ for f in input_api.AffectedFiles(include_dirs=True):
+ p = f.AbsoluteLocalPath()
+ if p == bower_json_path or p.startswith(components_dir):
+ break
+ else:
+ return []
+
+ bower_dependencies = \
+ set(json.load(open(bower_json_path))['dependencies'].keys())
+ installed_components = set(p for p in os.listdir(components_dir))
+ # Add web-animations-js because we keep it in a separate directory
+ # '../third_party/web-animations-js'.
+ installed_components.add('web-animations-js')
+
+ if bower_dependencies == installed_components:
+ return []
+
+ problems = []
+
+ if installed_components - bower_dependencies:
+ problems.append(output_api.PresubmitError(
+ 'Found components that are not listed in bower.json.',
+ items = list(installed_components - bower_dependencies)))
+
+ if bower_dependencies - installed_components:
+ problems.append(output_api.PresubmitError(
+ 'Some of the Bower dependencies are not installed.',
+ items = list(bower_dependencies - installed_components)))
+
+ return problems
+
+def CheckChangeOnUpload(input_api, output_api):
+ return _CheckBowerDependencies(input_api, output_api)
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ return _CheckBowerDependencies(input_api, output_api)
« no previous file with comments | « third_party/polymer/LICENSE.polymer ('k') | third_party/polymer/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698