summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatorux <satorux@chromium.org>2015-02-18 02:12:13 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-18 10:12:43 +0000
commita628a42300fb022c51210395e2cf9bdda752ad39 (patch)
treee2933e15269c4c038a228ab7707361a48038c76f
parent4ebf78507beb8fca6ea7a6253dfa031128083ec2 (diff)
downloadchromium_src-a628a42300fb022c51210395e2cf9bdda752ad39.zip
chromium_src-a628a42300fb022c51210395e2cf9bdda752ad39.tar.gz
chromium_src-a628a42300fb022c51210395e2cf9bdda752ad39.tar.bz2
move_source_file.py: Sort sources in build files
In addition to #includes, move_source_file.py should sort sources in build files. This is per suggestion from sdefresne@. Thanks! BUG=456014 TEST=move a C++ file with move_source_file.py and confirm that both GYP and GN files are updated. Review URL: https://codereview.chromium.org/924403003 Cr-Commit-Position: refs/heads/master@{#316795}
-rwxr-xr-xtools/git/move_source_file.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/git/move_source_file.py b/tools/git/move_source_file.py
index 1a25e44..18ef1ce 100755
--- a/tools/git/move_source_file.py
+++ b/tools/git/move_source_file.py
@@ -31,6 +31,7 @@ if __name__ == '__main__':
# classpath.
sys.path.append(os.path.abspath(os.path.join(sys.path[0], '..')))
sort_headers = __import__('sort-headers')
+import sort_sources
HANDLED_EXTENSIONS = ['.cc', '.mm', '.h', '.hh', '.cpp']
@@ -142,11 +143,13 @@ def UpdatePostMove(from_path, to_path):
from_rest = from_path
to_rest = to_path
while True:
- mffr.MultiFileFindReplace(
+ files_with_changed_sources = mffr.MultiFileFindReplace(
r'([\'"])%s([\'"])' % from_rest,
r'\1%s\2' % to_rest,
[os.path.join(visiting_directory, 'BUILD.gn'),
os.path.join(visiting_directory, '*.gyp*')])
+ for changed_file in files_with_changed_sources:
+ sort_sources.ProcessFile(changed_file, should_confirm=False)
from_first, from_rest = SplitByFirstComponent(from_rest)
to_first, to_rest = SplitByFirstComponent(to_rest)
visiting_directory = os.path.join(visiting_directory, from_first)