blob: e4dccd06ecdc48aead4d6ccdd0880c8d37ca5bab [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:
Ethan Nicholasc18bb512020-07-28 14:46:53 -040017 try:
18 noExt, _ = os.path.splitext(inc)
19 head, tail = os.path.split(noExt)
Ethan Nicholasc18bb512020-07-28 14:46:53 -040020 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 Nicholasc18bb512020-07-28 14:46:53 -040024 except subprocess.CalledProcessError as err:
25 print("### Error compiling " + inc + ":")
26 print(err.output)
27 exit(1)