1#!/usr/bin/env python
2#
3# Copyright 2017 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8import os
9import subprocess
10import sys
11
12skslc = sys.argv[1]
13clangFormat = sys.argv[2]
14processors = sys.argv[3:]
15for p in processors:
16    path, _ = os.path.splitext(p)
17    print("Recompiling " + p + "...")
18    try:
19        subprocess.check_output([skslc, p, path + ".h"])
20        subprocess.check_call(clangFormat + " --sort-includes=false -i \"" +
21                              path + ".h\"", shell=True)
22        subprocess.check_output([skslc, p, path + ".cpp"])
23        subprocess.check_call(clangFormat + " --sort-includes=false -i \"" +
24                              path + ".cpp\"", shell=True)
25    except subprocess.CalledProcessError as err:
26        print("### Error compiling " + p + ":")
27        print(err.output)
28        exit(1)
29