blob: 20b8d7d5bcced89c0de84b2c3d83ec397658401b [file] [log] [blame]
Ethan Nicholas762466e2017-06-29 10:03:38 -04001#!/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]
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -040013clangFormat = sys.argv[2]
14processors = sys.argv[3:]
Ethan Nicholas762466e2017-06-29 10:03:38 -040015for p in processors:
16 path, _ = os.path.splitext(p)
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040017 print("Recompiling " + p + "...")
18 try:
19 subprocess.check_output([skslc, p, path + ".h"])
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -040020 subprocess.check_call(clangFormat + " --sort-includes=false -i \"" +
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040021 path + ".h\"", shell=True)
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040022 subprocess.check_output([skslc, p, path + ".cpp"])
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -040023 subprocess.check_call(clangFormat + " --sort-includes=false -i \"" +
Ethan Nicholasb7e8c3b2017-07-19 13:54:20 -040024 path + ".cpp\"", shell=True)
Ethan Nicholas9fb036f2017-07-05 16:19:09 -040025 except subprocess.CalledProcessError as err:
26 print("### Error compiling " + p + ":")
27 print(err.output)
28 exit(1)