diff options
| author | Vitaly Buka <vitalybuka@google.com> | 2019-06-27 19:55:21 +0000 |
|---|---|---|
| committer | Vitaly Buka <vitalybuka@google.com> | 2019-06-27 19:55:21 +0000 |
| commit | f7a19f684bdd5f644cdaeda2ba70fbc71d05802c (patch) | |
| tree | 1e1134431be4fe171c6de80eb4ac90cdb7d63b68 /llvm/utils | |
| parent | c627aa2fa9c93df18acd8cec7cb92b73fea5e2fe (diff) | |
| download | bcm5719-llvm-f7a19f684bdd5f644cdaeda2ba70fbc71d05802c.tar.gz bcm5719-llvm-f7a19f684bdd5f644cdaeda2ba70fbc71d05802c.zip | |
[GN] Set exit code to 1 if changes are needed
llvm-svn: 364582
Diffstat (limited to 'llvm/utils')
| -rwxr-xr-x | llvm/utils/gn/build/sync_source_lists_from_cmake.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py b/llvm/utils/gn/build/sync_source_lists_from_cmake.py index 3fb155cb79d..76dc5ded3f6 100755 --- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py +++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py @@ -15,6 +15,7 @@ from __future__ import print_function import os import re import subprocess +import sys def sync_source_lists(): @@ -28,6 +29,7 @@ def sync_source_lists(): cmake_cpp_re = re.compile(r'^\s*([A-Za-z_0-9./-]+\.(?:cpp|c|h|S))$', re.MULTILINE) + changed = False for gn_file in gn_files: # The CMakeLists.txt for llvm/utils/gn/secondary/foo/BUILD.gn is # directly at foo/CMakeLists.txt. @@ -47,6 +49,7 @@ def sync_source_lists(): if gn_cpp == cmake_cpp: continue + changed = True print(gn_file) add = cmake_cpp - gn_cpp if add: @@ -55,6 +58,7 @@ def sync_source_lists(): if remove: print('remove:\n' + '\n'.join(remove)) print() + return changed def sync_unittests(): @@ -62,6 +66,7 @@ def sync_unittests(): unittest_re = re.compile(r'^add_\S+_unittest', re.MULTILINE) checked = [ 'clang', 'clang-tools-extra', 'lld', 'llvm' ] + changed = False for c in checked: for root, _, _ in os.walk(os.path.join(c, 'unittests')): cmake_file = os.path.join(root, 'CMakeLists.txt') @@ -71,13 +76,18 @@ def sync_unittests(): continue # Skip CMake files that just add subdirectories. gn_file = os.path.join('llvm/utils/gn/secondary', root, 'BUILD.gn') if not os.path.exists(gn_file): + changed = True print('missing GN file %s for unittest CMake file %s' % (gn_file, cmake_file)) + return changed def main(): - sync_source_lists() - sync_unittests() + src = sync_source_lists() + tests = sync_unittests() + if src or tests: + sys.exit(1) + if __name__ == '__main__': |

