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

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

Issue 2980933002: DO NOT SUBMIT, Uglify print preview resources, WIP.
Patch Set: Created 3 years, 5 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/print_preview/BUILD.gn ('k') | chrome/browser/resources/vulcanize.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/uglify_gn.py
diff --git a/chrome/browser/resources/uglify_gn.py b/chrome/browser/resources/uglify_gn.py
new file mode 100755
index 0000000000000000000000000000000000000000..92636de658760196505e9e6c4beebc2e0de46cf8
--- /dev/null
+++ b/chrome/browser/resources/uglify_gn.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import os
+import sys
+
+_HERE_PATH = os.path.dirname(__file__)
+_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..'))
+_CWD = os.getcwd()
+
+sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'node'))
+import node
+import node_modules
+
+def _uglify(base_folder, out_folder, input_files, output_file):
+ out_path = os.path.join(_CWD, out_folder)
+ in_file_paths = map(lambda f: os.path.join(base_folder, f), input_files)
+ out_file_path = os.path.join(out_path, output_file)
+
+ args = in_file_paths + [
+ '--comments', '"/Copyright|license|LICENSE|\<\/?if/"',
+ '--output', out_file_path]
+ node.RunNode([node_modules.PathToUglify()] + args)
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--base_folder', required=True)
+ parser.add_argument('--out_folder', required=True)
+ parser.add_argument('--input_files', nargs='+')
+ parser.add_argument('--output_file', required=True)
+ args = parser.parse_args()
+
+ _uglify(
+ args.base_folder,
+ args.out_folder,
+ input_files=args.input_files,
+ output_file=args.output_file)
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « chrome/browser/resources/print_preview/BUILD.gn ('k') | chrome/browser/resources/vulcanize.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698