kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject kudu git commit: iwyu: add proper dependency on thrift generated code, check for iwyu errors
Date Tue, 24 Apr 2018 20:02:39 GMT
Repository: kudu
Updated Branches:
  refs/heads/master c4b8804ac -> 72847ab56


iwyu: add proper dependency on thrift generated code, check for iwyu errors

IWYU was giving incorrect results on the HMS modules when running on
Jenkins. This was due to the 'iwyu' CMake target not depending on the
thrift code generation. IWYU was continuing to run despite having
'missing include' errors.

This patch adds the appropriate CMake dependency and also makes our
IWYU wrapper check for such errors in the IWYU output.

I also changed the IWYU wrapper to explicitly build the IWYU
dependencies before running so that even if a user invokes it directly,
they won't hit this issue.

Change-Id: Ie44f25ebc160c587eb11b4b4730095ee1e6c4fde
Reviewed-on: http://gerrit.cloudera.org:8080/10161
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/72847ab5
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/72847ab5
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/72847ab5

Branch: refs/heads/master
Commit: 72847ab5607b64d64bbe43edd942889e4e9f9fbf
Parents: c4b8804
Author: Todd Lipcon <todd@apache.org>
Authored: Fri Apr 20 17:05:52 2018 -0700
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Tue Apr 24 19:59:42 2018 +0000

----------------------------------------------------------------------
 CMakeLists.txt        | 10 ++++++----
 build-support/iwyu.py | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/72847ab5/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93b1a61..508aab9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1279,10 +1279,12 @@ endif (UNIX)
 # "make iwyu" and "make iwyu-fix" target
 ############################################################
 if (UNIX)
-  add_custom_target(iwyu ${BUILD_SUPPORT_DIR}/iwyu.py --from-git)
-  add_custom_target(iwyu-fix ${BUILD_SUPPORT_DIR}/iwyu.py --fix --from-git)
-  add_dependencies(iwyu pb-gen krpc-gen)
-  add_dependencies(iwyu-fix pb-gen krpc-gen)
+  add_custom_target(iwyu-generated-headers
+    DEPENDS pb-gen krpc-gen hms_thrift)
+  add_custom_target(iwyu ${BUILD_SUPPORT_DIR}/iwyu.py --from-git
+    DEPENDS iwyu-generated-headers)
+  add_custom_target(iwyu-fix ${BUILD_SUPPORT_DIR}/iwyu.py --fix --from-git
+    DEPENDS iwyu-generated-headers)
 endif (UNIX)
 
 ############################################################

http://git-wip-us.apache.org/repos/asf/kudu/blob/72847ab5/build-support/iwyu.py
----------------------------------------------------------------------
diff --git a/build-support/iwyu.py b/build-support/iwyu.py
index 8af3135..f267d0c 100755
--- a/build-support/iwyu.py
+++ b/build-support/iwyu.py
@@ -49,7 +49,8 @@ _IWYU_TOOL = os.path.join(ROOT, "build-support/iwyu/iwyu_tool.py")
 _RE_SOURCE_FILE = re.compile(r'\.(c|cc|h)$')
 
 # Matches compilation errors in the output of IWYU
-_RE_CLANG_ERROR = re.compile(r'^.+?:\d+:\d+: error:', re.MULTILINE)
+_RE_CLANG_ERROR = re.compile(r'^.+?:\d+:\d+:\s*'
+                             r'(fatal )?error:', re.MULTILINE)
 
 # Files that we don't want to ever run IWYU on, because they aren't clean yet.
 _MUTED_FILES = set([
@@ -272,6 +273,17 @@ def main(argv):
   paths = _relativize_paths(paths)
   os.chdir(_BUILD_DIR)
 
+  # For correct results, IWYU depends on the generated header files.
+  logging.info("Ensuring IWYU dependencies are built...")
+  if os.path.exists('Makefile'):
+    subprocess.check_call(['make', 'iwyu-generated-headers'])
+  elif os.path.exists('build.ninja'):
+    subprocess.check_call(['ninja', 'iwyu-generated-headers'])
+  else:
+    logging.error('No Makefile or build.ninja found in build directory %s',
+                  _BUILD_DIR)
+    sys.exit(1)
+
   logging.info("Checking %d file(s)...", len(paths))
   if flags.sort_only:
     return _do_sort_only(flags, paths)


Mime
View raw message