Format code.

This commit is contained in:
Jisi Liu 2015-10-14 17:37:39 -07:00
parent ee8131a62f
commit 125a91be08

View File

@ -9,10 +9,10 @@ def _gen_dir(ctx):
def CcOuts(srcs):
return [s[:-len(".proto")] + ".pb.h" for s in srcs] + \
[s[:-len(".proto")] + ".pb.cc" for s in srcs]
[s[:-len(".proto")] + ".pb.cc" for s in srcs]
def PyOuts(srcs):
return [s[:-len(".proto")] + "_pb2.py" for s in srcs]
return [s[:-len(".proto")] + "_pb2.py" for s in srcs]
def _proto_srcs_impl(ctx):
"""General implementation for calculating proto srcs"""
@ -33,19 +33,19 @@ def _proto_srcs_impl(ctx):
if args:
ctx.action(
inputs= srcs + deps,
inputs=srcs + deps,
outputs=ctx.outputs.outs,
arguments= args + import_flags + [s.path for s in srcs],
arguments=args + import_flags + [s.path for s in srcs],
executable=ctx.executable.protoc
)
return struct(
proto=struct(
srcs = srcs,
import_flags = import_flags,
deps = deps,
),
)
srcs=srcs,
import_flags=import_flags,
deps=deps,
),
)
_proto_srcs = rule(
attrs = {
@ -66,45 +66,45 @@ _proto_srcs = rule(
)
def cc_proto_library(
name,
srcs=[],
protoc=":protoc",
internal_bootstrap_hack=False,
prefix="",
proto_deps=[],
deps=[],
**kargs):
name,
srcs=[],
protoc=":protoc",
internal_bootstrap_hack=False,
prefix="",
proto_deps=[],
deps=[],
**kargs):
if internal_bootstrap_hack:
# For pre-checked-in generated files, we add the internal_bootstrap_hack
# which will skip the codegen action.
_proto_srcs(
name = name + "_genproto",
srcs = srcs,
deps = [s + "_genproto" for s in proto_deps],
prefix = prefix,
protoc = protoc,
name=name + "_genproto",
srcs=srcs,
deps=[s + "_genproto" for s in proto_deps],
prefix=prefix,
protoc=protoc,
)
# An empty cc_library to make rule dependency consistent.
native.cc_library(
name = name,
name=name,
**kargs)
return
outs = CcOuts(srcs)
_proto_srcs(
name = name + "_genproto",
srcs = srcs,
deps = [s + "_genproto" for s in proto_deps],
prefix = prefix,
protoc = protoc,
gen_cc = 1,
outs = outs,
name=name + "_genproto",
srcs=srcs,
deps=[s + "_genproto" for s in proto_deps],
prefix=prefix,
protoc=protoc,
gen_cc=1,
outs=outs,
)
native.cc_library(
name = name,
srcs = outs,
deps = deps + proto_deps,
includes = [prefix],
name=name,
srcs=outs,
deps=deps + proto_deps,
includes=[prefix],
**kargs)