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

Unified Diff: Source/devtools/scripts/concatenate_module_descriptors.py

Issue 459833002: Revert of Revert of DevTools: Introduce module initializers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « Source/devtools/scripts/compile_frontend.py ('k') | Source/devtools/scripts/inline_js_imports.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/scripts/concatenate_module_descriptors.py
diff --git a/Source/devtools/scripts/concatenate_module_descriptors.py b/Source/devtools/scripts/concatenate_module_descriptors.py
index b53ad3565a0a5e584be45e8c0f12b310edd60c42..2745dbda322b2c692b114749f1f529b50979e697 100755
--- a/Source/devtools/scripts/concatenate_module_descriptors.py
+++ b/Source/devtools/scripts/concatenate_module_descriptors.py
@@ -10,6 +10,10 @@
import errno
import shutil
import sys
+try:
+ import simplejson as json
+except ImportError:
+ import json
def read_file(filename):
@@ -23,9 +27,17 @@
if not path.exists(json_filename):
continue
module_name = path.basename(path.dirname(json_filename))
- json = read_file(json_filename).replace('{', '{"name":"%s",' % module_name, 1)
- result.append(json)
- return ','.join(result)
+
+ # pylint: disable=E1103
+ module_json = json.loads(read_file(json_filename))
+ module_json['name'] = module_name
+
+ # Clear scripts, as they are not used at runtime
+ # (only the fact of their presence is important).
+ if module_json.get('scripts'):
+ module_json['scripts'] = []
+ result.append(module_json)
+ return json.dumps(result)
def main(argv):
@@ -34,7 +46,7 @@
module_jsons = argv[3:]
with open(output_filename, 'w') as output_file:
- output_file.write('var allDescriptors=[%s];' % build_modules(module_jsons))
+ output_file.write('var allDescriptors=%s;' % build_modules(module_jsons))
if __name__ == '__main__':
« no previous file with comments | « Source/devtools/scripts/compile_frontend.py ('k') | Source/devtools/scripts/inline_js_imports.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698