Bug 1495641 - Make clang-tidy toolchains use a clang-tidy/ directory instead of clang/. r=ted
☠☠ backed out by ae4e4c068139 ☠ ☠
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 02 Oct 2018 13:54:04 +0900
changeset 495471 3ff4a396300c717fe8d0e0288dee8cade03479d9
parent 495470 edc506b37439bc118431d10e22159ffcf3c95ff1
child 495472 ae4e4c068139d9f2ff7881e9e9ccb2eee2200417
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1495641
milestone64.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 1495641 - Make clang-tidy toolchains use a clang-tidy/ directory instead of clang/. r=ted Differential Revision: https://phabricator.services.mozilla.com/D7582
build/build-clang/build-clang.py
python/mozbuild/mozbuild/mach_commands.py
taskcluster/ci/static-analysis-autotest/kind.yml
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -178,25 +178,25 @@ def is_linux():
     return platform.system() == "Linux"
 
 
 def is_windows():
     return platform.system() == "Windows"
 
 
 def build_one_stage(cc, cxx, asm, ld, ar, ranlib, libtool,
-                    src_dir, stage_dir, build_libcxx,
+                    src_dir, stage_dir, package_name, build_libcxx,
                     osx_cross_compile, build_type, assertions,
                     python_path, gcc_dir, libcxx_include_dir,
                     is_final_stage=False):
     if not os.path.exists(stage_dir):
         os.mkdir(stage_dir)
 
     build_dir = stage_dir + "/build"
-    inst_dir = stage_dir + "/clang"
+    inst_dir = stage_dir + "/" + package_name
 
     # cmake doesn't deal well with backslashes in paths.
     def slashify_path(path):
         return path.replace('\\', '/')
 
     def cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir):
         cmake_args = [
             "-GNinja",
@@ -583,27 +583,29 @@ if __name__ == "__main__":
     for l in symlinks:
         # On Windows, we have to re-copy the whole directory every time.
         if not is_windows() and os.path.islink(l[1]):
             continue
         delete(l[1])
         if os.path.exists(l[0]):
             symlink(l[0], l[1])
 
+    package_name = "clang"
     if build_clang_tidy:
+        package_name = "clang-tidy"
         import_clang_tidy(llvm_source_dir)
 
     if not os.path.exists(build_dir):
         os.makedirs(build_dir)
 
     libcxx_include_dir = os.path.join(llvm_source_dir, "projects",
                                       "libcxx", "include")
 
     stage1_dir = build_dir + '/stage1'
-    stage1_inst_dir = stage1_dir + '/clang'
+    stage1_inst_dir = stage1_dir + '/' + package_name
 
     final_stage_dir = stage1_dir
 
     if is_darwin():
         extra_cflags = []
         extra_cxxflags = ["-stdlib=libc++"]
         extra_cflags2 = []
         extra_cxxflags2 = ["-stdlib=libc++"]
@@ -658,52 +660,51 @@ if __name__ == "__main__":
                          "-Wl,-dead_strip"]
 
     build_one_stage(
         [cc] + extra_cflags,
         [cxx] + extra_cxxflags,
         [asm] + extra_asmflags,
         [ld] + extra_ldflags,
         ar, ranlib, libtool,
-        llvm_source_dir, stage1_dir, build_libcxx, osx_cross_compile,
+        llvm_source_dir, stage1_dir, package_name, build_libcxx, osx_cross_compile,
         build_type, assertions, python_path, gcc_dir, libcxx_include_dir)
 
     if stages > 1:
         stage2_dir = build_dir + '/stage2'
-        stage2_inst_dir = stage2_dir + '/clang'
+        stage2_inst_dir = stage2_dir + '/' + package_name
         final_stage_dir = stage2_dir
         build_one_stage(
             [stage1_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_cflags2,
             [stage1_inst_dir + "/bin/%s%s" %
                 (cxx_name, exe_ext)] + extra_cxxflags2,
             [stage1_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_asmflags,
             [ld] + extra_ldflags,
             ar, ranlib, libtool,
-            llvm_source_dir, stage2_dir, build_libcxx, osx_cross_compile,
+            llvm_source_dir, stage2_dir, package_name, build_libcxx, osx_cross_compile,
             build_type, assertions, python_path, gcc_dir, libcxx_include_dir,
             stages == 2)
 
     if stages > 2:
         stage3_dir = build_dir + '/stage3'
         final_stage_dir = stage3_dir
         build_one_stage(
             [stage2_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_cflags2,
             [stage2_inst_dir + "/bin/%s%s" %
                 (cxx_name, exe_ext)] + extra_cxxflags2,
             [stage2_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_asmflags,
             [ld] + extra_ldflags,
             ar, ranlib, libtool,
-            llvm_source_dir, stage3_dir, build_libcxx, osx_cross_compile,
+            llvm_source_dir, stage3_dir, package_name, build_libcxx, osx_cross_compile,
             build_type, assertions, python_path, gcc_dir, libcxx_include_dir,
             stages == 3)
 
-    package_name = "clang"
     if build_clang_tidy:
-        prune_final_dir_for_clang_tidy(os.path.join(final_stage_dir, "clang"), osx_cross_compile)
-        package_name = "clang-tidy"
+        prune_final_dir_for_clang_tidy(os.path.join(final_stage_dir, package_name),
+                                       osx_cross_compile)
 
     if not args.skip_tar:
         ext = "bz2" if is_darwin() or is_windows() else "xz"
-        build_tar_package("tar", "%s.tar.%s" % (package_name, ext), final_stage_dir, "clang")
+        build_tar_package("tar", "%s.tar.%s" % (package_name, ext), final_stage_dir, package_name)
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1933,27 +1933,27 @@ class StaticAnalysis(MachCommandBase):
         self.TOOLS_CHECKER_FAILED_FILE = 8
         self.TOOLS_CHECKER_LIST_EMPTY = 9
 
         # Configure the tree or download clang-tidy package, depending on the option that we choose
         if intree_tool:
             _, config, _ = self._get_config_environment()
             clang_tools_path = self.topsrcdir
             self._clang_tidy_path = mozpath.join(
-                clang_tools_path, "clang", "bin",
+                clang_tools_path, "clang-tidy", "bin",
                 "clang-tidy" + config.substs.get('BIN_SUFFIX', ''))
             self._clang_format_path = mozpath.join(
-                clang_tools_path, "clang", "bin",
+                clang_tools_path, "clang-tidy", "bin",
                 "clang-format" + config.substs.get('BIN_SUFFIX', ''))
             self._clang_apply_replacements = mozpath.join(
-                clang_tools_path, "clang", "bin",
+                clang_tools_path, "clang-tidy", "bin",
                 "clang-apply-replacements" + config.substs.get('BIN_SUFFIX', ''))
-            self._run_clang_tidy_path = mozpath.join(clang_tools_path, "clang", "share",
+            self._run_clang_tidy_path = mozpath.join(clang_tools_path, "clang-tidy", "share",
                                                      "clang", "run-clang-tidy.py")
-            self._clang_format_diff = mozpath.join(clang_tools_path, "clang", "share",
+            self._clang_format_diff = mozpath.join(clang_tools_path, "clang-tidy", "share",
                                                    "clang", "clang-format-diff.py")
 
             # Ensure that clang-tidy is present
             rc = not os.path.exists(self._clang_tidy_path)
         else:
             rc = self._get_clang_tools(force=force_download, verbose=verbose)
 
         if rc != 0:
@@ -2356,27 +2356,27 @@ class StaticAnalysis(MachCommandBase):
                          source=None, download_if_needed=True,
                          verbose=False):
         rc, config, _ = self._get_config_environment()
 
         if rc != 0:
             return rc
 
         clang_tools_path = mozpath.join(self._mach_context.state_dir, "clang-tools")
-        self._clang_tidy_path = mozpath.join(clang_tools_path, "clang", "bin",
+        self._clang_tidy_path = mozpath.join(clang_tools_path, "clang-tidy", "bin",
                                              "clang-tidy" + config.substs.get('BIN_SUFFIX', ''))
         self._clang_format_path = mozpath.join(
-            clang_tools_path, "clang", "bin",
+            clang_tools_path, "clang-tidy", "bin",
             "clang-format" + config.substs.get('BIN_SUFFIX', ''))
         self._clang_apply_replacements = mozpath.join(
-            clang_tools_path, "clang", "bin",
+            clang_tools_path, "clang-tidy", "bin",
             "clang-apply-replacements" + config.substs.get('BIN_SUFFIX', ''))
-        self._run_clang_tidy_path = mozpath.join(clang_tools_path, "clang", "share", "clang",
+        self._run_clang_tidy_path = mozpath.join(clang_tools_path, "clang-tidy", "share", "clang",
                                                  "run-clang-tidy.py")
-        self._clang_format_diff = mozpath.join(clang_tools_path, "clang", "share", "clang",
+        self._clang_format_diff = mozpath.join(clang_tools_path, "clang-tidy", "share", "clang",
                                                "clang-format-diff.py")
 
         if os.path.exists(self._clang_tidy_path) and \
            os.path.exists(self._clang_format_path) and \
            os.path.exists(self._clang_apply_replacements) and \
            os.path.exists(self._run_clang_tidy_path) and \
            not force:
             return 0
--- a/taskcluster/ci/static-analysis-autotest/kind.yml
+++ b/taskcluster/ci/static-analysis-autotest/kind.yml
@@ -34,16 +34,21 @@ job-defaults:
 jobs:
     linux64-st-autotest/debug:
         description: "Linux64 Debug Static Analysis Autotest"
         index:
             job-name: linux64-st-autotest-debug
         treeherder:
             platform: linux64/debug
         worker-type: aws-provisioner-v1/gecko-t-linux-large
+        worker:
+            env:
+                # clang-tidy needs a recent libstdc++, which can be found in the clang
+                # toolchain.
+                LD_LIBRARY_PATH: /builds/worker/workspace/build/src/clang/lib
         run:
             config:
                 - builds/releng_base_firefox.py
                 - builds/releng_sub_linux_configs/64_stat_and_debug.py
             tooltool-downloads: public
             keep-artifacts: false
         toolchains:
             - linux64-clang