Example #1
0
 def run(self, env):
     return Builder.Script([
         Builder.InstallPackages(['clang-tidy']),
         Builder.DownloadDependencies(),
         Builder.CMakeBuild(env.project),
         run_clang_tidy,
     ])
Example #2
0
    def run(self, env):
        sh = env.shell
        clang_tidy = env.find_llvm_tool('clang-tidy')[0]
        if not clang_tidy:
            print("No clang-tidy executable could be found, installing...")
            sh.exec("sudo", "apt", "install", "-y", "clang-tidy-9")
            clang_tidy = env.find_llvm_tool('clang-tidy')[0]
            if not clang_tidy:
                print("No clang-tidy executable could be found")
                sys.exit(1)

        source_dir = sh.cwd()
        build_dir = os.path.join(source_dir, 'build')
        sources = [
            os.path.join(source_dir, file)
            for file in glob.glob('source/**/*.c') if not 'windows' in file
        ]

        return [
            Builder.DownloadDependencies(),
            Builder.CMakeBuild(),
            Builder.Script([[clang_tidy, '-p', build_dir] + sources])
        ]