Create blank SkSL test files for Ninja's benefit.

GN lists both the .cpp and the .h as generated outputs, so if they don't
exist, Ninja assumes we need to rebuild the tests every time we compile.

Change-Id: I37b8b3d9e7aef1b0cb8d5c70530c2542a6c0087a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317108
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2020-09-15 11:16:10 -04:00 committed by Skia Commit-Bot
parent d911c91d88
commit 886b9d477c
2 changed files with 7 additions and 7 deletions

View File

@ -9,9 +9,9 @@ import os
import subprocess
import sys
def unlinkIfExists(path):
def makeEmptyFile(path):
try:
os.unlink(path)
open(path, 'wb').close()
except OSError:
pass
@ -47,12 +47,12 @@ for input in inputs:
continue
else:
# The header generated an error; this counts as an overall failure for this test.
# Remove the passing CPP output since it's not relevant in a failure case.
unlinkIfExists(target + ".cpp")
# Blank out the passing CPP output since it's not relevant in a failure case.
makeEmptyFile(target + ".cpp")
else:
# The CPP generated an error. We didn't actually generate a header, but there might be
# one from prior runs. Let's remove it for clarity.
unlinkIfExists(target + ".h")
# The CPP generated an error. We didn't actually generate a header at all, but Ninja
# expects an output file to exist or it won't reach steady-state.
makeEmptyFile(target + ".h")
elif ext == ".sksl" or ext == ".vert":
compile(skslc, input, target, ".glsl")
else: