Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # Copyright 2020 Google LLC |
| 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] |
Brian Osman | dd49617 | 2020-08-08 08:17:18 -0400 | [diff] [blame] | 13 | targetDir = sys.argv[2] |
Brian Osman | a578138 | 2020-08-07 21:28:12 +0000 | [diff] [blame] | 14 | includes = sys.argv[3:] |
Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 15 | |
| 16 | for inc in includes: |
Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 17 | try: |
| 18 | noExt, _ = os.path.splitext(inc) |
| 19 | head, tail = os.path.split(noExt) |
Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 20 | if not os.path.isdir(targetDir): |
| 21 | os.mkdir(targetDir) |
| 22 | target = os.path.join(targetDir, tail) |
| 23 | subprocess.check_output([skslc, inc, target + ".dehydrated.sksl"]) |
Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 24 | except subprocess.CalledProcessError as err: |
| 25 | print("### Error compiling " + inc + ":") |
| 26 | print(err.output) |
| 27 | exit(1) |