You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/11/02 17:57:41 UTC

[geode-native] branch develop updated: GEODE-5847: Ignore formatting non-C++ source files.

This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 15f9273  GEODE-5847: Ignore formatting non-C++ source files.
15f9273 is described below

commit 15f9273cdf56f664f8bda574e776851bc0b5982f
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Fri Nov 2 10:56:42 2018 -0700

    GEODE-5847: Ignore formatting non-C++ source files.
---
 cmake/ClangFormat.cmake | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cmake/ClangFormat.cmake b/cmake/ClangFormat.cmake
index fb93b79..b5c6f23 100644
--- a/cmake/ClangFormat.cmake
+++ b/cmake/ClangFormat.cmake
@@ -32,13 +32,14 @@ function(add_clangformat _target)
     set(_clangformat_SOURCES "")
     foreach (_source ${_target_SOURCES})
       if (NOT TARGET ${_source})
-        get_source_file_property(_source_LOCATION "${_source}" LOCATION)
         get_source_file_property(_source_GENERATED "${_source}" GENERATED)
-
-        if(_source_GENERATED)
+        string(REGEX MATCH "\\.(h(pp|xx)?|c(pp|xx)?)(\\..*)?$" _source_extension_match ${_source})
+        if(_source_GENERATED
+            OR _source_extension_match STREQUAL "")
           break()
         endif()
 
+        get_source_file_property(_source_LOCATION "${_source}" LOCATION)
         file(RELATIVE_PATH _source_RELATIVE_PATH ${_target_SOURCE_DIR} ${_source_LOCATION})
         string(REPLACE ".." "__" _format_file "${_target_BINARY_DIR}/CMakeFiles/${_clangformat}.dir/${_source_RELATIVE_PATH}.format")
         get_filename_component(_format_DIRECTORY ${_format_file} DIRECTORY)