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

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

Issue 653133002: DevTools: Fix non-clean debug_devtools build after r183664 (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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 os.mkdir(dest_dir) 58 os.mkdir(dest_dir)
59 for name in files: 59 for name in files:
60 src_name = join(src_dir, name) 60 src_name = join(src_dir, name)
61 dest_name = join(dest_dir, name) 61 dest_name = join(dest_dir, name)
62 if hasattr(os, 'link'): 62 if hasattr(os, 'link'):
63 os.link(src_name, dest_name) 63 os.link(src_name, dest_name)
64 else: 64 else:
65 shutil.copy(src_name, dest_name) 65 shutil.copy(src_name, dest_name)
66 66
67 67
68 def safe_copy(src, dest):
69 if path.exists(dest):
70 os.remove(dest)
71 shutil.copy(src, dest)
72
73
68 class AppBuilder: 74 class AppBuilder:
69 def __init__(self, application_name, descriptors, application_dir, output_di r): 75 def __init__(self, application_name, descriptors, application_dir, output_di r):
70 self.application_name = application_name 76 self.application_name = application_name
71 self.descriptors = descriptors 77 self.descriptors = descriptors
72 self.application_dir = application_dir 78 self.application_dir = application_dir
73 self.output_dir = output_dir 79 self.output_dir = output_dir
74 80
75 def app_file(self, extension): 81 def app_file(self, extension):
76 return self.application_name + '.' + extension 82 return self.application_name + '.' + extension
77 83
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 # Outputs: 208 # Outputs:
203 # <app_name>.html as-is 209 # <app_name>.html as-is
204 # <app_name>.js as-is 210 # <app_name>.js as-is
205 # <module_name>/<all_files> 211 # <module_name>/<all_files>
206 class DebugBuilder(AppBuilder): 212 class DebugBuilder(AppBuilder):
207 def __init__(self, application_name, descriptors, application_dir, output_di r): 213 def __init__(self, application_name, descriptors, application_dir, output_di r):
208 AppBuilder.__init__(self, application_name, descriptors, application_dir , output_dir) 214 AppBuilder.__init__(self, application_name, descriptors, application_dir , output_dir)
209 215
210 def build_app(self): 216 def build_app(self):
211 self._build_html() 217 self._build_html()
212 shutil.copy(join(self.application_dir, self.app_file('js')), self.output _dir) 218 js_name = self.app_file('js')
219 safe_copy(join(self.application_dir, js_name), join(self.output_dir, js_ name))
213 for module_name in self.descriptors.modules: 220 for module_name in self.descriptors.modules:
214 module = self.descriptors.modules[module_name] 221 module = self.descriptors.modules[module_name]
215 input_module_dir = join(self.application_dir, module_name) 222 input_module_dir = join(self.application_dir, module_name)
216 output_module_dir = join(self.output_dir, module_name) 223 output_module_dir = join(self.output_dir, module_name)
217 hardlink_or_copy_dir(input_module_dir, output_module_dir) 224 hardlink_or_copy_dir(input_module_dir, output_module_dir)
218 225
219 def _build_html(self): 226 def _build_html(self):
220 html_name = self.app_file('html') 227 html_name = self.app_file('html')
221 shutil.copy(join(self.application_dir, html_name), join(self.output_dir, html_name)) 228 safe_copy(join(self.application_dir, html_name), join(self.output_dir, h tml_name))
222 229
223 230
224 def build_application(application_name, loader, application_dir, output_dir, rel ease_mode): 231 def build_application(application_name, loader, application_dir, output_dir, rel ease_mode):
225 descriptors = loader.load_application(application_name + '.json') 232 descriptors = loader.load_application(application_name + '.json')
226 if release_mode: 233 if release_mode:
227 builder = ReleaseBuilder(application_name, descriptors, application_dir, output_dir) 234 builder = ReleaseBuilder(application_name, descriptors, application_dir, output_dir)
228 else: 235 else:
229 builder = DebugBuilder(application_name, descriptors, application_dir, o utput_dir) 236 builder = DebugBuilder(application_name, descriptors, application_dir, o utput_dir)
230 builder.build_app() 237 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