skia2/gn/compile_processors.py
John Stiles 21bbfc6c2d Revert "Fetch clang-format automatically when compiling .fp files."
This reverts commit a25422faa4.

Reason for revert: breaks Windows build

Original change's description:
> Fetch clang-format automatically when compiling .fp files.
> 
> On a freshly fetched repo, setting `skia_compile_processors = true` will
> fail to compile because clang-format is missing from the bin directory.
> This CL automatically runs fetch-clang-format for you when clang-format
> is absent.
> 
> Change-Id: Ieeb359176072e92ca235316c820310333732f608
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=mtklein@google.com,johnstiles@google.com

Change-Id: If6412e74a16aa515c223d5d4f326780c8a69766f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295832
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-11 20:36:05 +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)