blob: a04b9e652526d8b6b117155cc38219f30f25fb11 [file] [log] [blame]
Tim van der Lippe790b9292019-09-19 15:14:16 +00001#!/usr/bin/env python
2# -*- coding: UTF-8 -*-
3#
4# Copyright 2019 The Chromium Authors. All rights reserved.
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7"""
8Copies the modules into the resources folder
9"""
10
11from os.path import join, relpath
12import shutil
13import sys
14
Tim van der Lippebc38bd62019-10-03 18:36:31 +000015import rjsmin
16
17from modular_build import read_file, write_file
18
Tim van der Lippe790b9292019-09-19 15:14:16 +000019
20def main(argv):
21 try:
22 input_path_flag_index = argv.index('--input_path')
23 input_path = argv[input_path_flag_index + 1]
24 output_path_flag_index = argv.index('--output_path')
25 output_path = argv[output_path_flag_index + 1]
26 devtools_modules = argv[1:input_path_flag_index]
27 except:
Tim van der Lippebc38bd62019-10-03 18:36:31 +000028 print('Usage: %s module_1 module_2 ... module_N --input_path <input_path> --output_path <output_path>' % argv[0])
Tim van der Lippe790b9292019-09-19 15:14:16 +000029 raise
30
31 for file_name in devtools_modules:
Tim van der Lippebc38bd62019-10-03 18:36:31 +000032 file_content = read_file(join(input_path, file_name))
33 minified = rjsmin.jsmin(file_content)
34 write_file(join(output_path, relpath(file_name, 'front_end')), minified)
Tim van der Lippe790b9292019-09-19 15:14:16 +000035
36
37if __name__ == '__main__':
38 sys.exit(main(sys.argv))