| Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 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] | 
| Ethan Nicholas | b9f6afb | 2017-07-27 16:02:37 -0400 | [diff] [blame] | 13 | clangFormat = sys.argv[2] | 
 | 14 | processors = sys.argv[3:] | 
| Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 15 | for p in processors: | 
 | 16 |     path, _ = os.path.splitext(p) | 
| Ethan Nicholas | 9fb036f | 2017-07-05 16:19:09 -0400 | [diff] [blame] | 17 |     print("Recompiling " + p + "...") | 
 | 18 |     try: | 
 | 19 |         subprocess.check_output([skslc, p, path + ".h"]) | 
| Ethan Nicholas | b9f6afb | 2017-07-27 16:02:37 -0400 | [diff] [blame] | 20 |         subprocess.check_call(clangFormat + " --sort-includes=false -i \"" + | 
| Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 21 |                               path + ".h\"", shell=True) | 
| Ethan Nicholas | 9fb036f | 2017-07-05 16:19:09 -0400 | [diff] [blame] | 22 |         subprocess.check_output([skslc, p, path + ".cpp"]) | 
| Ethan Nicholas | b9f6afb | 2017-07-27 16:02:37 -0400 | [diff] [blame] | 23 |         subprocess.check_call(clangFormat + " --sort-includes=false -i \"" + | 
| Ethan Nicholas | b7e8c3b | 2017-07-19 13:54:20 -0400 | [diff] [blame] | 24 |                               path + ".cpp\"", shell=True) | 
| Ethan Nicholas | 9fb036f | 2017-07-05 16:19:09 -0400 | [diff] [blame] | 25 |     except subprocess.CalledProcessError as err: | 
 | 26 |         print("### Error compiling " + p + ":") | 
 | 27 |         print(err.output) | 
 | 28 |         exit(1) |