Bug 1429015 - Add clang-format-diff to the clang-tidy build generated by toolchains. r=sylvestre
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 09 Jan 2018 13:27:39 +0200
changeset 452645 0e8f44c99aa652be77516ba3a6a3c4eafddcb985
parent 452644 b047f4782ae2050665e5d958202a0f42d070fbbb
child 452646 5323dfb26361028737850236fd7fc7c73200a383
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssylvestre
bugs1429015
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1429015 - Add clang-format-diff to the clang-tidy build generated by toolchains. r=sylvestre MozReview-Commit-ID: FjJqef78wa3
build/build-clang/build-clang.py
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -247,34 +247,37 @@ def get_tool(config, key):
     # Assume that we have the name of some program that should be on PATH.
     try:
         return which.which(f) if f else which.which(key)
     except which.WhichError:
         raise ValueError("%s not found on PATH" % f)
 
 
 # This function is intended to be called on the final build directory when
-# building clang-tidy.  Its job is to remove all of the files which won't
-# be used for clang-tidy to reduce the download size.  Currently when this
-# function finishes its job, it will leave final_dir with a layout like this:
+# building clang-tidy. Also clang-format binaries are included that can be used
+# in conjunction with clang-tidy.
+# Its job is to remove all of the files which won't be used for clang-tidy or
+# clang-format to reduce the download size.  Currently when this function
+# finishes its job, it will leave final_dir with a layout like this:
 #
 # clang/
 #   bin/
 #     clang-apply-replacements
 #     clang-format
 #     clang-tidy
 #   include/
 #     * (nothing will be deleted here)
 #   lib/
 #     clang/
 #       4.0.0/
 #         include/
 #           * (nothing will be deleted here)
 #   share/
 #     clang/
+#       clang-format-diff.py
 #       clang-tidy-diff.py
 #       run-clang-tidy.py
 def prune_final_dir_for_clang_tidy(final_dir):
     # Make sure we only have what we expect.
     dirs = ("bin", "include", "lib", "libexec", "msbuild-bin", "share", "tools")
     for f in glob.glob("%s/*" % final_dir):
         if os.path.basename(f) not in dirs:
             raise Exception("Found unknown file %s in the final directory" % f)
@@ -306,17 +309,17 @@ def prune_final_dir_for_clang_tidy(final
     # Completely remove libexec/, msbuilld-bin and tools, if it exists.
     shutil.rmtree(os.path.join(final_dir, "libexec"))
     for d in ("msbuild-bin", "tools"):
         d = os.path.join(final_dir, d)
         if os.path.exists(d):
             shutil.rmtree(d)
 
     # In share/, only keep share/clang/*tidy*
-    re_clang_tidy = re.compile(r"tidy", re.I)
+    re_clang_tidy = re.compile(r"format|tidy", re.I)
     for f in glob.glob("%s/share/*" % final_dir):
         if os.path.basename(f) != "clang":
             delete(f)
     for f in glob.glob("%s/share/clang/*" % final_dir):
         if re_clang_tidy.search(os.path.basename(f)) is None:
             delete(f)