Files
react-native-devtools-frontend/scripts/build/copy_devtools_modules.py
T
Rob Paveza 41120592d3 Refactor of the 'copy_all_modules' build step
I've sporadically seen the same CreateProcess failure in ninja recently
that we'd been seeing for the GRD script [1]. This failure is related to
the copy_devtools_modules script.

As part of this change I've also corrected some linting errors that I
had made with the previous fix.

[1] The previous fix can be found at
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1992319

Change-Id: Ic9a66160acddfc929fdd43f20572435ceff3724c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1997723
Commit-Queue: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-01-13 19:07:47 +00:00

45 lines
1.3 KiB
Python

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2019 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.
"""
Copies the modules into the resources folder
"""
from os.path import join, relpath
import shlex
import shutil
import sys
import rjsmin
from modular_build import read_file, write_file
def main(argv):
try:
file_list_arg_index = argv.index('--file_list')
file_list_filename = argv[file_list_arg_index + 1]
input_path_flag_index = argv.index('--input_path')
input_path = argv[input_path_flag_index + 1]
output_path_flag_index = argv.index('--output_path')
output_path = argv[output_path_flag_index + 1]
file_list_file = open(file_list_filename, 'r')
file_list_contents = file_list_file.read()
devtools_modules = shlex.split(file_list_contents)
except:
print('Usage: %s --file_list <response_file_path> --input_path <input_path> --output_path <output_path>' % argv[0])
raise
for file_name in devtools_modules:
file_content = read_file(join(input_path, file_name))
minified = rjsmin.jsmin(file_content)
write_file(join(output_path, relpath(file_name, 'front_end')), minified)
if __name__ == '__main__':
sys.exit(main(sys.argv))