blob: ca34a91d75261d0721fde818ae2320a6d75abc38 [file] [log] [blame]
Ethan Nicholasc18bb512020-07-28 14:46:53 -04001#!/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
8import os
9import subprocess
10import sys
11
12skslc = sys.argv[1]
Brian Osmandd496172020-08-08 08:17:18 -040013targetDir = sys.argv[2]
Brian Osmana5781382020-08-07 21:28:12 +000014includes = sys.argv[3:]
Ethan Nicholasc18bb512020-07-28 14:46:53 -040015
16for inc in includes:
17 print("Recompiling " + inc + "...")
18 try:
19 noExt, _ = os.path.splitext(inc)
20 head, tail = os.path.split(noExt)
Ethan Nicholasc18bb512020-07-28 14:46:53 -040021 if not os.path.isdir(targetDir):
22 os.mkdir(targetDir)
23 target = os.path.join(targetDir, tail)
24 subprocess.check_output([skslc, inc, target + ".dehydrated.sksl"])
Ethan Nicholasc18bb512020-07-28 14:46:53 -040025 except subprocess.CalledProcessError as err:
26 print("### Error compiling " + inc + ":")
27 print(err.output)
28 exit(1)