16sksl_minify = sys.argv[1]
17shared_module = sys.argv[2]
18public_module = sys.argv[3]
19rt_shader_module = sys.argv[4]
20input_root_dir = sys.argv[5]
21output_root_dir = sys.argv[6]
23input_file = sys.argv[7]
24with open(input_file,
'r')
as reader:
25 all_inputs = shlex.split(reader.read())
28for file
in all_inputs:
29 if (file.endswith(
".rts")
or file.endswith(
".privrts")
or file.endswith(
".rtcf")
or
30 file.endswith(
".rtb")
or file.endswith(
".mfrag")
or file.endswith(
".mvert")):
37 output = subprocess.check_output([
38 sksl_minify, worklist.name], stderr=subprocess.STDOUT).
decode(
'utf-8', errors=
'ignore')
39 except subprocess.CalledProcessError
as err:
40 if err.returncode != 1:
41 print(
"### " + input +
" sksl-minify error:\n")
42 print(
"\n".
join(err.output.decode(
'utf-8', errors=
'ignore').splitlines()))
43 sys.exit(err.returncode)
47 os.remove(worklist.name)
49worklist = tempfile.NamedTemporaryFile(suffix=
'.worklist', delete=
False, mode=
'w')
55 target = input.replace(input_root_dir, output_root_dir)
56 target = os.path.splitext(target)[0]
57 target_dir = os.path.dirname(target)
58 if not os.path.isdir(target_dir):
61 noExt, ext = os.path.splitext(input)
62 head, tail = os.path.split(noExt)
65 worklist.write(
"--shader\n")
66 elif ext ==
'.privrts':
67 worklist.write(
"--privshader\n")
69 worklist.write(
"--colorfilter\n")
71 worklist.write(
"--blender\n")
73 worklist.write(
"--meshfrag\n")
75 worklist.write(
"--meshvert\n")
77 worklist.write(target +
".minified.sksl\n")
78 worklist.write(input +
"\n")
80 worklist.write(rt_shader_module +
"\n")
81 worklist.write(public_module +
"\n")
82 worklist.write(shared_module +
"\n\n")
87 worklist = tempfile.NamedTemporaryFile(suffix=
'.worklist', delete=
False, mode=
'w')
94 os.remove(worklist.name)
def executeWorklist(input, worklist)
def print(*args, **kwargs)
static DecodeResult decode(std::string path)
static SkString join(const CommandLineFlags::StringArray &)