aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-02-24 10:26:29 -0800
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-02-24 10:26:29 -0800
commitd3a7b609179644138ca1f68457f92cbd73bdeb53 (patch)
tree0312e7ba0b6f346d602223b27373b64b0f7dc75b /templates
parent91edc13bf8a83dd024f9ce4e0ad2246202545a38 (diff)
parent4ea4599a50abb9188927846dc9f5449dbf5e8537 (diff)
Merge pull request #5365 from ctiller/naming-crisis
Add a sanity test to ensure that name aliasing rules are obeyed
Diffstat (limited to 'templates')
-rw-r--r--templates/tools/run_tests/sources_and_headers.json.template39
1 files changed, 23 insertions, 16 deletions
diff --git a/templates/tools/run_tests/sources_and_headers.json.template b/templates/tools/run_tests/sources_and_headers.json.template
index 78363ff1fa..18b9bc2654 100644
--- a/templates/tools/run_tests/sources_and_headers.json.template
+++ b/templates/tools/run_tests/sources_and_headers.json.template
@@ -3,21 +3,27 @@
<%!
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
-
+ 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:
@@ -26,18 +32,19 @@
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.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', []) +
+ tgt.get('public_headers', []) +
+ tgt.get('headers', []) +
proto_headers(tgt.src)),
"deps": sorted(tgt.get('deps', []))}
- for tgt in (targets + libs)
- if not tgt.boringssl and not tgt.zlib],
+ for typ, tgt in all_targets(targets, libs)],
sort_keys=True, indent=2)}