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

Unified Diff: chrome/browser/resources/vulcanize_gn.py

Issue 2829933003: WebUI: Swap Uglify with Closure Compiler NodeJS version.
Patch Set: Fix ChromeOS Created 3 years, 8 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 | « chrome/browser/resources/vulcanize.gni ('k') | third_party/node/node_modules.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/vulcanize_gn.py
diff --git a/chrome/browser/resources/vulcanize_gn.py b/chrome/browser/resources/vulcanize_gn.py
index 309ab32be4bb53533003a2116b68bdb96f1cee12..505ebc7531d982f08bec2538aa934512684e5242 100755
--- a/chrome/browser/resources/vulcanize_gn.py
+++ b/chrome/browser/resources/vulcanize_gn.py
@@ -172,9 +172,20 @@ def _vulcanize(in_folder, args):
if not os.path.isfile(js_out_path):
open(js_out_path, 'w').close()
- node.RunNode([node_modules.PathToUglifyJs(), js_out_path,
- '--comments', '"/Copyright|license|LICENSE|\<\/?if/"',
- '--output', js_out_path])
+ # Rewrite licenses such that Closure Compiler will preserve them.
+ import rewrite_licenses
+ with open(js_out_path, 'r') as f:
+ output_data = rewrite_licenses.rewrite(f.read())
+
+ # Open file again with 'w' such that the previous contents are overwritten.
+ with open(js_out_path, 'w') as f:
+ f.write(output_data)
+ f.close()
+
+ output = node.RunNode([node_modules.PathToClosureCompiler(), js_out_path])
+ with open(js_out_path, 'w') as output_file:
+ output_file.write(output)
+
finally:
os.remove(tmp.name)
« no previous file with comments | « chrome/browser/resources/vulcanize.gni ('k') | third_party/node/node_modules.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698