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

Side by Side Diff: Source/devtools/scripts/concatenate_application_code.py

Issue 676993002: DevTools: Remove the "stylesheets" field from module descriptors at build time (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 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 """ 7 """
8 Release: 8 Release:
9 - Concatenates autostart modules, application modules' module.json descriptors , 9 - Concatenates autostart modules, application modules' module.json descriptors ,
10 and the application loader into a single script. 10 and the application loader into a single script.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 else: 145 else:
146 assert resource_path 146 assert resource_path
147 147
148 def _release_module_descriptors(self): 148 def _release_module_descriptors(self):
149 module_descriptors = self.descriptors.modules 149 module_descriptors = self.descriptors.modules
150 result = [] 150 result = []
151 for name in module_descriptors: 151 for name in module_descriptors:
152 module = copy.copy(module_descriptors[name]) 152 module = copy.copy(module_descriptors[name])
153 # Clear scripts, as they are not used at runtime 153 # Clear scripts, as they are not used at runtime
154 # (only the fact of their presence is important). 154 # (only the fact of their presence is important).
155 if module.get('scripts'): 155 stylesheets = module.get('stylesheets', None)
156 if module.get('scripts') or stylesheets:
156 module['scripts'] = [] 157 module['scripts'] = []
158 # Stylesheets list is not used at runtime.
159 if stylesheets is not None:
160 del module['stylesheets']
157 result.append(module) 161 result.append(module)
158 return json.dumps(result) 162 return json.dumps(result)
159 163
160 def _write_module_css_styles(self, css_names, output): 164 def _write_module_css_styles(self, css_names, output):
161 for css_name in css_names: 165 for css_name in css_names:
162 css_name = path.normpath(css_name).replace('\\', '/') 166 css_name = path.normpath(css_name).replace('\\', '/')
163 output.write('Runtime.cachedResources["%s"] = "' % css_name) 167 output.write('Runtime.cachedResources["%s"] = "' % css_name)
164 css_content = read_file(path.join(self.application_dir, css_name)) + css_source_url(css_name) 168 css_content = read_file(path.join(self.application_dir, css_name)) + css_source_url(css_name)
165 css_content = css_content.replace('\\', '\\\\') 169 css_content = css_content.replace('\\', '\\\\')
166 css_content = css_content.replace('\n', '\\n') 170 css_content = css_content.replace('\n', '\\n')
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 hardlink_or_copy_file(join(self.application_dir, html_name), join(self.o utput_dir, html_name), True) 265 hardlink_or_copy_file(join(self.application_dir, html_name), join(self.o utput_dir, html_name), True)
262 266
263 267
264 def build_application(application_name, loader, application_dir, output_dir, rel ease_mode): 268 def build_application(application_name, loader, application_dir, output_dir, rel ease_mode):
265 descriptors = loader.load_application(application_name + '.json') 269 descriptors = loader.load_application(application_name + '.json')
266 if release_mode: 270 if release_mode:
267 builder = ReleaseBuilder(application_name, descriptors, application_dir, output_dir) 271 builder = ReleaseBuilder(application_name, descriptors, application_dir, output_dir)
268 else: 272 else:
269 builder = DebugBuilder(application_name, descriptors, application_dir, o utput_dir) 273 builder = DebugBuilder(application_name, descriptors, application_dir, o utput_dir)
270 builder.build_app() 274 builder.build_app()
OLDNEW
« 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