Replace skslc worklist files with -- delimited command lines.
Command lines with delimiters are a simpler approach; they don't require
a scratch file to be created and parsed. (I didn't consider this
approach until after implementing worklists.)
This also fixes a minor issue with result codes when processing multiple
files at once; in particular, unit tests can ignore compile errors, but
regular fragment processor compilation should treat compile errors as
fatal and stop the build.
Change-Id: I3f153e7670d757c6b021bf60a260a2cd3f2090aa
Bug: skia:10919
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334428
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/gn/compile_processors.py b/gn/compile_processors.py
index 3e6cd45..a8b1c4c 100755
--- a/gn/compile_processors.py
+++ b/gn/compile_processors.py
@@ -8,7 +8,6 @@
import os
import subprocess
import sys
-import tempfile
skslc = sys.argv[1]
clangFormat = sys.argv[2]
@@ -16,14 +15,14 @@
processors = sys.argv[4:]
exeSuffix = '.exe' if sys.platform.startswith('win') else '';
-targets = []
-worklist = tempfile.NamedTemporaryFile(suffix='.worklist')
+skslcArgs = [skslc]
+clangFormatArgs = [clangFormat, "--sort-includes=false", "-i"]
# Fetch clang-format if it's not present already.
if not os.path.isfile(clangFormat + exeSuffix):
subprocess.check_call([sys.executable, fetchClangFormat]);
-# Build a worklist of all the fragment processors that we want to compile.
+# Build argument lists for all the fragment processors that we want to compile.
for p in processors:
noExt, _ = os.path.splitext(p)
head, tail = os.path.split(noExt)
@@ -31,26 +30,27 @@
if not os.path.isdir(targetDir):
os.mkdir(targetDir)
target = os.path.join(targetDir, tail)
- targets.append(target + ".h")
- targets.append(target + ".cpp")
+ clangFormatArgs.append(target + ".h")
+ clangFormatArgs.append(target + ".cpp")
+ skslcArgs.append("--");
+ skslcArgs.append(p);
+ skslcArgs.append(target + ".h");
+ skslcArgs.append("--");
+ skslcArgs.append(p);
+ skslcArgs.append(target + ".cpp");
- worklist.write(p + "\n")
- worklist.write(target + ".h\n\n")
- worklist.write(p + "\n")
- worklist.write(target + ".cpp\n\n")
-
-# Invoke skslc, passing in the worklist.
-worklist.close()
+# Invoke skslc on every target that needs to be compiled.
try:
- output = subprocess.check_output([skslc, worklist.name], stderr=subprocess.STDOUT)
+ output = subprocess.check_output(skslcArgs, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
print("### skslc error:\n")
print("\n".join(err.output.splitlines()))
+ sys.exit(err.returncode)
# Invoke clang-format on every generated target.
try:
- output = subprocess.check_output([clangFormat, "--sort-includes=false", "-i"] + targets,
- stderr=subprocess.STDOUT)
+ output = subprocess.check_output(clangFormatArgs, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
print("### clang-format error:\n")
print("\n".join(err.output.splitlines()))
+ sys.exit(err.returncode)