diff options
Diffstat (limited to 'src/proto')
-rwxr-xr-x | src/proto/gen_build_yaml.py | 33 | ||||
-rw-r--r-- | src/proto/grpc/health/v1alpha/health.proto | 4 | ||||
-rw-r--r-- | src/proto/grpc/testing/duplicate/echo_duplicate.proto | 4 | ||||
-rw-r--r-- | src/proto/grpc/testing/echo.proto | 4 |
4 files changed, 30 insertions, 15 deletions
diff --git a/src/proto/gen_build_yaml.py b/src/proto/gen_build_yaml.py index 4e959830ea..e243d0defc 100755 --- a/src/proto/gen_build_yaml.py +++ b/src/proto/gen_build_yaml.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2.7 -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -36,21 +36,36 @@ import os import re import sys +def update_deps(key, proto_filename, deps, is_trans, visited): + if not proto_filename in visited: + visited.append(proto_filename) + with open(proto_filename) as inp: + for line in inp: + imp = re.search(r'import "([^"]*)"', line) + if not imp: continue + imp_proto = imp.group(1) + if key not in deps: deps[key] = [] + deps[key].append(imp_proto[:-6]) + if is_trans: + update_deps(key, imp_proto, deps, is_trans, visited) + def main(): + proto_dir = os.path.abspath(os.path.dirname(sys.argv[0])) + os.chdir(os.path.join(proto_dir, '../..')) + deps = {} - for root, dirs, files in os.walk(os.path.dirname(sys.argv[0])): + deps_trans = {} + for root, dirs, files in os.walk('src/proto'): for f in files: if f[-6:] != '.proto': continue look_at = os.path.join(root, f) - with open(look_at) as inp: - for line in inp: - imp = re.search(r'import "([^"]*)"', line) - if not imp: continue - if look_at[:-6] not in deps: deps[look_at[:-6]] = [] - deps[look_at[:-6]].append(imp.group(1)[:-6]) + deps_for = look_at[:-6] + update_deps(deps_for, look_at, deps, False, []) # First level deps + update_deps(deps_for, look_at, deps_trans, True, []) # Transitive deps json = { - 'proto_deps': deps + 'proto_deps': deps, + 'proto_transitive_deps': deps_trans } print yaml.dump(json) diff --git a/src/proto/grpc/health/v1alpha/health.proto b/src/proto/grpc/health/v1alpha/health.proto index 28786c4427..05f837dd99 100644 --- a/src/proto/grpc/health/v1alpha/health.proto +++ b/src/proto/grpc/health/v1alpha/health.proto @@ -1,4 +1,4 @@ -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ message HealthCheckResponse { service Health { rpc Check(HealthCheckRequest) returns (HealthCheckResponse); -}
\ No newline at end of file +} diff --git a/src/proto/grpc/testing/duplicate/echo_duplicate.proto b/src/proto/grpc/testing/duplicate/echo_duplicate.proto index d5891db4ce..9d84de108e 100644 --- a/src/proto/grpc/testing/duplicate/echo_duplicate.proto +++ b/src/proto/grpc/testing/duplicate/echo_duplicate.proto @@ -1,5 +1,5 @@ -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -36,6 +36,6 @@ import "src/proto/grpc/testing/echo_messages.proto"; package grpc.testing.duplicate; -service TestService { +service EchoTestService { rpc Echo(grpc.testing.EchoRequest) returns (grpc.testing.EchoResponse); } diff --git a/src/proto/grpc/testing/echo.proto b/src/proto/grpc/testing/echo.proto index 0896f50a99..06c3bafbad 100644 --- a/src/proto/grpc/testing/echo.proto +++ b/src/proto/grpc/testing/echo.proto @@ -1,5 +1,5 @@ -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -34,7 +34,7 @@ import "src/proto/grpc/testing/echo_messages.proto"; package grpc.testing; -service TestService { +service EchoTestService { rpc Echo(EchoRequest) returns (EchoResponse); rpc RequestStream(stream EchoRequest) returns (EchoResponse); rpc ResponseStream(EchoRequest) returns (stream EchoResponse); |