You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2015/04/27 00:25:44 UTC

[1/2] mesos git commit: Updated documentation for ClangFormat.

Repository: mesos
Updated Branches:
  refs/heads/master d3dfbd9bc -> 0f10d04e0


Updated documentation for ClangFormat.

Review: https://reviews.apache.org/r/33527


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

Branch: refs/heads/master
Commit: fdc890b3624c096704b56c23615f646f3961ff2d
Parents: d3dfbd9
Author: Michael Park <mc...@gmail.com>
Authored: Mon Apr 27 00:14:41 2015 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Apr 27 00:14:42 2015 +0200

----------------------------------------------------------------------
 docs/clang-format.md | 56 +++++++++++++++++++----------------------------
 1 file changed, 23 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fdc890b3/docs/clang-format.md
----------------------------------------------------------------------
diff --git a/docs/clang-format.md b/docs/clang-format.md
index d118dd0..909a253 100644
--- a/docs/clang-format.md
+++ b/docs/clang-format.md
@@ -4,17 +4,13 @@ layout: documentation
 
 # ClangFormat
 
-[ClangFormat](http://llvm.org/releases/3.5.0/tools/clang/docs/ClangFormat.html) is an automatic source code formatting tool which help us focus on the code rather than the formatting.
+[ClangFormat](http://llvm.org/releases/3.5.1/tools/clang/docs/ClangFormat.html) is an automatic source code formatting tool which helps us focus on the code rather than the formatting.
 
-> The provided configurations try to honor the [Mesos C++ Style Guide](http://mesos.apache.org/documentation/latest/mesos-c++-style-guide/) as much as possible, but there are some limitations. Even with these limitations however, ClangFormat will likely be extremely useful for your workflow!
-
-## Quick Start
-
-If you already have an installation of `clang-format` version >= 3.5, follow your editor's [integration instructions](#integrate-with-your-editor) then start formatting!
+> The provided configurations try to honor the [Mesos C++ Style Guide](http://mesos.apache.org/documentation/latest/mesos-c++-style-guide/) as much as possible, but there are some limitations which require manual attention. Even with these limitations however, ClangFormat will be extremely useful for your workflow!
 
 ## Setup
 
-### Install clang 3.5
+### Install `clang-format-3.5`
 
 #### Ubuntu 14.04
 
@@ -29,32 +25,26 @@ sudo apt-get install clang-format-3.5
 #### OS X Yosemite
 
 ```bash
-# Download and extract the clang-3.5 source.
-$ wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz
-$ tar -xzf cfe-3.5.0.src.tar.xz
-
-# Download and extract the clang-3.5 pre-built binaries.
-$ wget http://llvm.org/releases/3.5.0/clang+llvm-3.5.0-macosx-apple-darwin.tar.xz
-$ tar -xzf clang+llvm-3.5.0-macosx-apple-darwin.tar.xz
+# Install clang-3.5. The binaries are suffixed with '-3.5', e.g. 'clang++-3.5'.
+$ brew install llvm35 --with-clang
 
-# Create a directory for clang.
-$ mkdir `brew --cellar`/clang
-
-# Install the pre-built binaries.
-$ mv clang+llvm-3.5.0-macosx-apple-darwin `brew --cellar`/clang/3.5
+# Download and install the clang-format scripts.
+$ wget http://llvm.org/releases/3.5.1/cfe-3.5.1.src.tar.xz
+$ tar -xzf cfe-3.5.1.src.tar.xz
+$ cp cfe-3.5.1.src/tools/clang-format/clang-format* `brew --cellar`/llvm35/3.5.1/share/clang-3.5
+```
 
-# Install the clang-format tools.
-$ mkdir `brew --cellar`/clang/3.5/share/clang
-$ cp cfe-3.5.0.src/tools/clang-format/clang-format* `brew --cellar`/clang/3.5/share/clang
+### Formatting Configuration
 
-# Link!
-$ brew link clang
-Linking /usr/local/Cellar/clang/3.5... 491 symlinks created
+By default, ClangFormat uses the configuration defined in a `.clang-format` or
+`_clang-format` file located in the nearest parent directory of the input file.
+The `bootstrap` script creates a `.clang-format` symlink at the top-level
+directory which points to `support/clang-format` for ClangFormat to find.
 
-# You can delete cleanly by running `brew uninstall clang`
-```
+> NOTE: If you're using `clang-format-3.6`, you'll need to add a new option
+`BinPackArguments: false` to the `.clang-format` file!
 
-### Integrate with your editor
+### Editor Integration
 
 #### Vim
 
@@ -70,8 +60,8 @@ imap <C-K> <c-o>:pyf /usr/share/vim/addons/syntax/clang-format-3.5.py<cr>
 OS X:
 
 ```
-map <C-K> :pyf /usr/local/share/clang/clang-format.py<cr>
-imap <C-K> <c-o>:pyf /usr/local/share/clang/clang-format.py<cr>
+map <C-K> :pyf /usr/local/share/clang-3.5/clang-format.py<cr>
+imap <C-K> <c-o>:pyf /usr/local/share/clang-3.5/clang-format.py<cr>
 ```
 
 The first line enables clang-format for `NORMAL` and `VISUAL` mode, the second line adds support for `INSERT` mode. Change `C-K` to another binding if you need clang-format on a different key (`C-K` stands for `Ctrl+k`).
@@ -80,7 +70,7 @@ With this integration you can press the bound key and clang-format will format t
 
 It operates on the current, potentially unsaved buffer and does not create or save any files. To revert a formatting, just undo.
 
-> Source: http://llvm.org/releases/3.5.0/tools/clang/docs/ClangFormat.html
+> Source: http://llvm.org/releases/3.5.1/tools/clang/docs/ClangFormat.html
 
 #### Emacs
 
@@ -96,13 +86,13 @@ Ubuntu:
 OS X:
 
 ```
-(load "/usr/local/share/clang/clang-format.el")
+(load "/usr/local/share/clang-3.5/clang-format.el")
 (global-set-key [C-M-tab] 'clang-format-region)
 ```
 
 This binds the function `clang-format-region` to `C-M-tab`, which then formats the current line or selected region.
 
-> Source: http://llvm.org/releases/3.5.0/tools/clang/docs/ClangFormat.html
+> Source: http://llvm.org/releases/3.5.1/tools/clang/docs/ClangFormat.html
 
 ## Known Limitations
 


[2/2] mesos git commit: Create '.clang-format' from 'bootstrap' script instead.

Posted by ti...@apache.org.
Create '.clang-format' from 'bootstrap' script instead.

Review: https://reviews.apache.org/r/33528


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

Branch: refs/heads/master
Commit: 0f10d04e004d146831020715e5be4ac3840ee97f
Parents: fdc890b
Author: Michael Park <mc...@gmail.com>
Authored: Mon Apr 27 00:18:21 2015 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Apr 27 00:18:21 2015 +0200

----------------------------------------------------------------------
 .clang-format       | 1 -
 .gitignore-template | 1 +
 bootstrap           | 4 ++++
 3 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0f10d04e/.clang-format
----------------------------------------------------------------------
diff --git a/.clang-format b/.clang-format
deleted file mode 120000
index e7aa084..0000000
--- a/.clang-format
+++ /dev/null
@@ -1 +0,0 @@
-support/clang-format
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/0f10d04e/.gitignore-template
----------------------------------------------------------------------
diff --git a/.gitignore-template b/.gitignore-template
index 1a8e2a8..934cad7 100644
--- a/.gitignore-template
+++ b/.gitignore-template
@@ -2,6 +2,7 @@
 .gitignore
 
 # Files created by ./bootstrap.
+.clang-format
 .reviewboardrc
 Makefile.in
 aclocal.m4

http://git-wip-us.apache.org/repos/asf/mesos/blob/0f10d04e/bootstrap
----------------------------------------------------------------------
diff --git a/bootstrap b/bootstrap
index 658db1a..779b33c 100755
--- a/bootstrap
+++ b/bootstrap
@@ -23,6 +23,10 @@ if test ! -e .reviewboardrc; then
   ln -s support/reviewboardrc .reviewboardrc
 fi
 
+if test ! -e .clang-format; then
+  ln -s support/clang-format .clang-format
+fi
+
 if [ -n "$AUTOMAKE" ] || [ -n "$ACLOCAL" ] ; then
     if [ -z "$ACLOCAL" ] || [ -z "$AUTOMAKE" ] ; then
         _present="AUTOMAKE"