|
|
|
%YAML 1.2
|
|
|
|
--- |
|
|
|
|
<%!
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
|
|
|
|
def proto_headers(src):
|
|
|
|
out = []
|
|
|
|
for f in src:
|
|
|
|
name, ext = os.path.splitext(f)
|
|
|
|
if ext == '.proto':
|
|
|
|
out.extend(fmt % name for fmt in ['%s.grpc.pb.h', '%s.pb.h'])
|
|
|
|
return out
|
|
|
|
|
|
|
|
def all_targets(targets, libs):
|
|
|
|
for tgt in targets:
|
|
|
|
yield ('target', tgt)
|
|
|
|
for tgt in libs:
|
|
|
|
yield ('lib', tgt)
|
|
|
|
|
|
|
|
def no_protos_filter(src):
|
|
|
|
return os.path.splitext(src)[1] != '.proto'
|
|
|
|
|
|
|
|
def no_third_party_filter(src):
|
|
|
|
return not src.startswith('third_party/')
|
|
|
|
|
|
|
|
def filter_srcs(srcs, filters):
|
|
|
|
out = []
|
|
|
|
for s in srcs:
|
|
|
|
filter_passes = (f(s) for f in filters)
|
|
|
|
if all(filter_passes):
|
|
|
|
out.append(s)
|
|
|
|
return out
|
|
|
|
%>
|
|
|
|
|
|
|
|
${json.dumps([{"name": tgt.name,
|
|
|
|
"type": typ,
|
|
|
|
"language": tgt.language,
|
|
|
|
"third_party": tgt.boringssl or tgt.zlib,
|
|
|
|
"src": sorted(
|
|
|
|
filter_srcs(tgt.src, (no_protos_filter, no_third_party_filter)) +
|
|
|
|
filter_srcs(tgt.get('public_headers', []), (no_protos_filter, no_third_party_filter)) +
|
|
|
|
filter_srcs(tgt.get('headers', []), (no_third_party_filter,))),
|
|
|
|
"headers": sorted(
|
|
|
|
tgt.get('public_headers', []) +
|
|
|
|
tgt.get('headers', []) +
|
|
|
|
proto_headers(tgt.src)),
|
|
|
|
"deps": sorted(tgt.get('deps', []))}
|
|
|
|
for typ, tgt in all_targets(targets, libs)],
|
|
|
|
sort_keys=True, indent=2)}
|