2017-09-11 20:50:14 +00:00
|
|
|
#!/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
|
|
|
|
|
|
|
|
sksllex = sys.argv[1]
|
|
|
|
clangFormat = sys.argv[2]
|
2020-06-11 23:57:22 +00:00
|
|
|
fetchClangFormat = sys.argv[3]
|
|
|
|
src = sys.argv[4]
|
|
|
|
|
|
|
|
exeSuffix = '.exe' if sys.platform.startswith('win') else '';
|
|
|
|
|
2017-09-11 20:50:14 +00:00
|
|
|
try:
|
|
|
|
subprocess.check_output([sksllex, src + "/sksl/lex/sksl.lex", "Lexer",
|
|
|
|
"Token", src + "/sksl/SkSLLexer.h", src +
|
|
|
|
"/sksl/SkSLLexer.cpp"])
|
2020-06-11 23:57:22 +00:00
|
|
|
|
|
|
|
if not os.path.isfile(clangFormat + exeSuffix):
|
|
|
|
subprocess.check_call([sys.executable, fetchClangFormat]);
|
|
|
|
|
2017-09-11 20:50:14 +00:00
|
|
|
subprocess.check_call(clangFormat + " -i \"" + src + "/sksl/SkSLLexer.h\"",
|
|
|
|
shell=True)
|
|
|
|
subprocess.check_call(clangFormat + " -i \"" + src +
|
|
|
|
"/sksl/SkSLLexer.cpp\"", shell=True)
|
|
|
|
except subprocess.CalledProcessError as err:
|
|
|
|
print("### Lexer error:")
|
|
|
|
print(err.output)
|
|
|
|
exit(1)
|