skia2/gn/compile_processors.py
Ethan Nicholas 21a9b56fc2 moved files generated from .fp files into generated/ directories
Bug: skia:
Change-Id: I8605cdfcc0b1c56c23a6075c7fe188ab7384681c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207221
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-10 18:02:02 +00:00

34 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
skslc = sys.argv[1]
clangFormat = sys.argv[2]
processors = sys.argv[3:]
for p in processors:
print("Recompiling " + p + "...")
try:
noExt, _ = os.path.splitext(p)
head, tail = os.path.split(noExt)
targetDir = os.path.join(head, "generated")
if not os.path.exists(targetDir):
os.mkdir(targetDir)
target = os.path.join(targetDir, tail)
subprocess.check_output([skslc, p, target + ".h"])
subprocess.check_call(clangFormat + " --sort-includes=false -i \"" +
target + ".h\"", shell=True)
subprocess.check_output([skslc, p, target + ".cpp"])
subprocess.check_call(clangFormat + " --sort-includes=false -i \"" +
target + ".cpp\"", shell=True)
except subprocess.CalledProcessError as err:
print("### Error compiling " + p + ":")
print(err.output)
exit(1)