Repository: trafficserver
Updated Branches:
  refs/heads/master 33caa113a -> c2fef0214


TS-3891 Split clang-format target into sub-trees


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

Branch: refs/heads/master
Commit: c2fef0214bf982cbdad9bdbe607ac647c76db85f
Parents: 33caa11
Author: Leif Hedstrom <[email protected]>
Authored: Thu Sep 3 14:48:25 2015 -0600
Committer: Leif Hedstrom <[email protected]>
Committed: Thu Sep 3 14:48:25 2015 -0600

----------------------------------------------------------------------
 Makefile.am           | 42 +++++++++++++++++++++++++++++++++++++++---
 tools/clang-format.sh | 26 ++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c2fef021/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 35ba197..96359e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,9 +99,45 @@ install-data-hook:
 rat:
        java -jar $(top_srcdir)/ci/apache-rat-0.11-SNAPSHOT.jar -E 
$(top_srcdir)/ci/rat-regex.txt  -d $(top_srcdir)
 
-clang-format:
-       for f in `find $(top_srcdir) -iname \*.[ch] -o -iname \*.cc | fgrep -v 
-e lib/luajit -e lib/tsconfig`; do \
-         echo $$f; clang-format -i $$f; done
+#
+# These are rules to make clang-format easy and fast to run. Run it with e.g.
+#    make -j clang-format
+#
+# If you make changes to directory structures, you must update this as well.
+#
+.PHONY:        clang-format-cmd clang-format-example clang-format-iocore 
clang-format-lib clang-format-mgmt \
+       clang-format-plugins clang-format-proxy clang-format-tools
+
+clang-format:  clang-format-cmd clang-format-example clang-format-iocore 
clang-format-lib clang-format-mgmt \
+               clang-format-plugins clang-format-proxy clang-format-tools
+
+clang-format-cmd:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/cmd
+
+clang-format-example:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/example
+
+clang-format-iocore:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/iocore
+
+clang-format-lib:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/lib/atscppapi
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/lib/raft
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/lib/records
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/lib/ts
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/lib/wccp
+
+clang-format-mgmt:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/mgmt
+
+clang-format-plugins:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/plugins
+
+clang-format-proxy:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/proxy
+
+clang-format-tools:
+       @$(top_srcdir)/tools/clang-format.sh $(top_srcdir)/tools
 
 help:
        @echo 'all             default target for building the package' && \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c2fef021/tools/clang-format.sh
----------------------------------------------------------------------
diff --git a/tools/clang-format.sh b/tools/clang-format.sh
new file mode 100755
index 0000000..7f6478d
--- /dev/null
+++ b/tools/clang-format.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+#  Simple wrapper to run clang-format on a bunch of files
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+DIR=${1:-.}
+
+for file in $(find $DIR -iname \*.[ch] -o -iname \*.cc); do
+    echo $file
+    clang-format -i $file
+done

Reply via email to