Home | History | Annotate | Download | only in gn
      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 
      8 import os
      9 import subprocess
     10 import sys
     11 
     12 skslc = sys.argv[1]
     13 clangFormat = sys.argv[2]
     14 processors = sys.argv[3:]
     15 for 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