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

Unified Diff: third_party/WebKit/Source/devtools/scripts/build/build_release_applications.py

Issue 2608043002: DevTools: extract modules (with extensions) (Closed)
Patch Set: fix externs (PerfUI) Created 3 years, 11 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
Index: third_party/WebKit/Source/devtools/scripts/build/build_release_applications.py
diff --git a/third_party/WebKit/Source/devtools/scripts/build/build_release_applications.py b/third_party/WebKit/Source/devtools/scripts/build/build_release_applications.py
index e095c3853400c8239369bca53fe860e165eb46f6..a60bdd5a6aa6a62f8db1b1481cfb40e50d93966a 100755
--- a/third_party/WebKit/Source/devtools/scripts/build/build_release_applications.py
+++ b/third_party/WebKit/Source/devtools/scripts/build/build_release_applications.py
@@ -30,6 +30,8 @@ try:
except ImportError:
import json
+special_case_namespaces_path = path.join(path.dirname(path.dirname(path.abspath(__file__))), 'special_case_namespaces.json')
+
def main(argv):
try:
@@ -93,6 +95,8 @@ class ReleaseBuilder(object):
self.descriptors = descriptors
self.application_dir = application_dir
self.output_dir = output_dir
+ with open(special_case_namespaces_path) as json_file:
+ self._special_case_namespaces = json.load(json_file)
def app_file(self, extension):
return self.application_name + '.' + extension
@@ -189,17 +193,17 @@ class ReleaseBuilder(object):
non_autostart_deps = deps & non_autostart
if len(non_autostart_deps):
bail_error('Non-autostart dependencies specified for the autostarted module "%s": %s' % (name, non_autostart_deps))
-
- namespace = name.replace('_lazy', '')
- if namespace == 'sdk' or namespace == 'ui':
- namespace = namespace.upper();
- namespace = "".join(map(lambda x: x[0].upper() + x[1:], namespace.split('_')))
+ namespace = self._map_module_to_namespace(name)
output.write('\n/* Module %s */\n' % name)
output.write('\nself[\'%s\'] = self[\'%s\'] || {};\n' % (namespace, namespace))
modular_build.concatenate_scripts(desc.get('scripts'), join(self.application_dir, name), self.output_dir, output)
else:
non_autostart.add(name)
+ def _map_module_to_namespace(self, module):
+ camel_case_namespace = "".join(map(lambda x: x[0].upper() + x[1:], module.split('_')))
+ return self._special_case_namespaces.get(module, camel_case_namespace)
+
def _concatenate_application_script(self, output):
runtime_contents = read_file(join(self.application_dir, 'Runtime.js'))
runtime_contents = re.sub('var allDescriptors = \[\];', 'var allDescriptors = %s;' % self._release_module_descriptors().replace('\\', '\\\\'), runtime_contents, 1)

Powered by Google App Engine
This is Rietveld 408576698