-
Jérémie Boulic authored
Update the modules generation script with the changes below. Fix reformatting of single-line dependency lists: empty dependency lists (e.g. `deps = []`) were rewritten on multiple lines (deps = [\n]) incorrectly. In the `find_dependencies` function, simplify calls to `add_dependency` by the need for redundant `if is_unittest... else...`. "//chrome/test/data/webui:chai_assert" can be imported in non-unittest files, and "//ui/webui/resources/js" can be imported in unittest files. Remove unittest distinction when importing variabble from these locations. Fix function exports: The detection of functions used a variable (the name of the function the export) that was not defined. Fix test function exports: when converting the same unittest multiple times, the "export" keyword was added multiple times in front of each test function to be exported. Facilitate testing by adding a `add_js_file_exports` function that takes `file_lines` as arguments (`convert_js_file` is harder to test directly, taking a file path as argument). Fix edge case where, when the only reported closure error is about extending `EventTarget`, the script doesn't do what's needed to fix it: Run `find_dependencies` whether or not there is any variable to import. Add unittests and presubmit script. Bug: 1133186 Test: ui/file_manager/base/tools/modules_test.py Change-Id: Ia0ed675576d021b3b952215384e7a491ff7f4430 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580970 Commit-Queue: Jeremie Boulic <jboulic@chromium.org> Reviewed-by:
Luciano Pacheco <lucmult@chromium.org> Cr-Commit-Position: refs/heads/master@{#836525}
b70f8c20