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

Side by Side Diff: third_party/polymer/v1_0/find_unused_elements.py

Issue 1984963002: Roll Polymer elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/python2 1 #!/usr/bin/python2
2 2
3 # Copyright 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Identifies Polymer elements that downloaded but not used by Chrome. 7 """Identifies Polymer elements that downloaded but not used by Chrome.
8 8
9 Only finds "first-order" unused elements; re-run after removing unused elements 9 Only finds "first-order" unused elements; re-run after removing unused elements
10 to check if other elements have become unused. 10 to check if other elements have become unused.
11 """ 11 """
12 12
13 import os 13 import os
14 import re 14 import re
15 import subprocess 15 import subprocess
16 16
17 17
18 class UnusedElementsDetector(object): 18 class UnusedElementsDetector(object):
19 """Finds unused Polymer elements.""" 19 """Finds unused Polymer elements."""
20 20
21 # Unused elements to ignore because we plan to use them soon. 21 # Unused elements to ignore because we plan to use them soon.
22 __WHITELIST = ( 22 __WHITELIST = (
23 # TODO(tsergeant): Use element or remove from whitelist.
24 'app-layout',
23 # TODO(dschuyler): Use element or remove from whitelist. 25 # TODO(dschuyler): Use element or remove from whitelist.
24 'carbon-route', 26 'app-route',
25 # Necessary for closure. 27 # Necessary for closure.
26 'polymer-externs', 28 'polymer-externs',
27 ) 29 )
28 30
29 def __init__(self): 31 def __init__(self):
30 polymer_dir = os.path.dirname(os.path.realpath(__file__)) 32 polymer_dir = os.path.dirname(os.path.realpath(__file__))
31 self.__COMPONENTS_DIR = os.path.join(polymer_dir, 'components-chromium') 33 self.__COMPONENTS_DIR = os.path.join(polymer_dir, 'components-chromium')
32 34
33 @staticmethod 35 @staticmethod
34 def __StripHtmlComments(filename): 36 def __StripHtmlComments(filename):
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 # scripts). 152 # scripts).
151 if re.search('/%s' % element_dir, 153 if re.search('/%s' % element_dir,
152 self.__StripComments( 154 self.__StripComments(
153 os.path.join(dirpath, filename))): 155 os.path.join(dirpath, filename))):
154 return True 156 return True
155 return False 157 return False
156 158
157 159
158 if __name__ == '__main__': 160 if __name__ == '__main__':
159 UnusedElementsDetector().Run() 161 UnusedElementsDetector().Run()
OLDNEW
« no previous file with comments | « third_party/polymer/v1_0/components_summary.txt ('k') | third_party/polymer/v1_0/rsync_exclude.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698