mirror of https://github.com/grpc/grpc.git
The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)
https://grpc.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.6 KiB
73 lines
2.6 KiB
9 years ago
|
%YAML 1.2
|
||
|
--- |
|
||
|
<%!
|
||
|
import json
|
||
|
import os
|
||
9 years ago
|
|
||
9 years ago
|
def proto_headers(src):
|
||
9 years ago
|
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
|
||
|
|
||
9 years ago
|
def all_targets(targets, libs, filegroups):
|
||
9 years ago
|
for tgt in targets:
|
||
|
yield ('target', tgt)
|
||
|
for tgt in libs:
|
||
|
yield ('lib', tgt)
|
||
9 years ago
|
for tgt in filegroups:
|
||
|
yield ('filegroup', tgt)
|
||
9 years ago
|
|
||
9 years ago
|
def no_protos_filter(src):
|
||
|
return os.path.splitext(src)[1] != '.proto'
|
||
|
|
||
|
def no_third_party_filter(src):
|
||
|
return not src.startswith('third_party/')
|
||
9 years ago
|
|
||
9 years ago
|
def filter_srcs(srcs, filters):
|
||
9 years ago
|
out = []
|
||
9 years ago
|
for s in srcs:
|
||
|
filter_passes = (f(s) for f in filters)
|
||
|
if all(filter_passes):
|
||
|
out.append(s)
|
||
9 years ago
|
return out
|
||
|
%>
|
||
9 years ago
|
|
||
9 years ago
|
${json.dumps([{"name": tgt.name,
|
||
9 years ago
|
"type": typ,
|
||
8 years ago
|
"is_filegroup": False,
|
||
9 years ago
|
"language": tgt.language,
|
||
9 years ago
|
"third_party": tgt.boringssl or tgt.zlib,
|
||
9 years ago
|
"src": sorted(
|
||
9 years ago
|
filter_srcs(tgt.own_src, (no_protos_filter, no_third_party_filter)) +
|
||
|
filter_srcs(tgt.own_public_headers, (no_protos_filter, no_third_party_filter)) +
|
||
|
filter_srcs(tgt.own_headers, (no_third_party_filter,))),
|
||
9 years ago
|
"headers": sorted(
|
||
9 years ago
|
tgt.own_public_headers +
|
||
|
tgt.own_headers +
|
||
|
proto_headers(tgt.own_src)),
|
||
|
"deps": sorted(tgt.get('deps', []) +
|
||
|
tgt.get('uses', []) +
|
||
|
tgt.get('filegroups', []))}
|
||
8 years ago
|
for typ, tgt in all_targets(targets, libs, [])] +
|
||
|
[{"name": tgt.name,
|
||
|
"type": typ,
|
||
|
"is_filegroup": True,
|
||
|
"language": tgt.language,
|
||
|
"third_party": tgt.boringssl or tgt.zlib,
|
||
|
"src": sorted(
|
||
|
filter_srcs(tgt.own_src, (no_protos_filter, no_third_party_filter)) +
|
||
|
filter_srcs(tgt.own_public_headers, (no_protos_filter, no_third_party_filter)) +
|
||
|
filter_srcs(tgt.own_headers, (no_third_party_filter,))),
|
||
|
"headers": sorted(
|
||
|
tgt.own_public_headers +
|
||
|
tgt.own_headers +
|
||
|
proto_headers(tgt.own_src)),
|
||
|
"deps": sorted(tgt.get('deps', []) +
|
||
|
tgt.get('uses', []) +
|
||
|
tgt.get('filegroups', []))}
|
||
|
for typ, tgt in all_targets([], [], filegroups)],
|
||
9 years ago
|
sort_keys=True, indent=2)}
|