Fix worklist files with skslc.

Previously, the worklists were being deleted as soon as they were
closed; by the time skslc executed, they were already gone.

Change-Id: I0d0be87525093a3ff37421cbff553fa481c8e1f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335864
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2020-11-18 13:58:19 -05:00 committed by Skia Commit-Bot
parent f42994335f
commit 57adba0959
2 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,7 @@ processors = sys.argv[4:]
exeSuffix = '.exe' if sys.platform.startswith('win') else '';
targets = []
worklist = tempfile.NamedTemporaryFile(suffix='.worklist')
worklist = tempfile.NamedTemporaryFile(suffix='.worklist', delete=False)
# Fetch clang-format if it's not present already.
if not os.path.isfile(clangFormat + exeSuffix):
@ -47,6 +47,8 @@ except subprocess.CalledProcessError as err:
print("### skslc error:\n")
print("\n".join(err.output.splitlines()))
os.remove(worklist.name)
# Invoke clang-format on every generated target.
try:
output = subprocess.check_output([clangFormat, "--sort-includes=false", "-i"] + targets,

View File

@ -25,7 +25,7 @@ if settings != "--settings" and settings != "--nosettings":
sys.exit("### Expected --settings or --nosettings, got " + settings)
targets = []
worklist = tempfile.NamedTemporaryFile(suffix='.worklist')
worklist = tempfile.NamedTemporaryFile(suffix='.worklist', delete=False)
# Convert the list of command-line inputs into a worklist file sfor skslc.
for input in inputs:
@ -68,6 +68,8 @@ except subprocess.CalledProcessError as err:
print("### skslc error:\n")
print("\n".join(err.output.splitlines()))
os.remove(worklist.name)
# A special case cleanup pass, just for CPP and H files: if either one of these files starts with
# `### Compilation failed`, its sibling should be replaced by an empty file. This improves clarity
# during code review; a failure on either file means that success on the sibling is irrelevant.