diff options
author | Jisi Liu <liujisi@google.com> | 2016-02-25 13:02:55 -0800 |
---|---|---|
committer | Jisi Liu <liujisi@google.com> | 2016-02-25 13:02:55 -0800 |
commit | 60a0d41a2988a40cf3a94a4cb602f5f1c94135e9 (patch) | |
tree | 5e10472534937e070a19be7ab2b5cd94ed976b46 /protobuf.bzl | |
parent | fb714b3606bd663b823f6960a73d052f97283b74 (diff) | |
parent | 985c968443e5124327fb600a91856192df4476ac (diff) | |
download | protobuf-60a0d41a2988a40cf3a94a4cb602f5f1c94135e9.tar.gz protobuf-60a0d41a2988a40cf3a94a4cb602f5f1c94135e9.tar.bz2 protobuf-60a0d41a2988a40cf3a94a4cb602f5f1c94135e9.zip |
Merge pull request #1233 from davidzchen/python-path
Remove hack for building Python support with Bazel.
Diffstat (limited to 'protobuf.bzl')
-rw-r--r-- | protobuf.bzl | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/protobuf.bzl b/protobuf.bzl index e5af3339..71eaba22 100644 --- a/protobuf.bzl +++ b/protobuf.bzl @@ -117,10 +117,10 @@ def cc_proto_library( deps=[], cc_libs=[], include=None, - protoc="//google/protobuf:protoc", + protoc="//:protoc", internal_bootstrap_hack=False, use_grpc_plugin=False, - default_runtime="//google/protobuf:protobuf", + default_runtime="//:protobuf", **kargs): """Bazel rule to create a C++ protobuf library from proto source files @@ -199,35 +199,6 @@ def cc_proto_library( includes=includes, **kargs) -def internal_copied_filegroup( - name, - srcs, - include, - **kargs): - """Bazel rule to fix sources file to workaround with python path issues. - - Args: - name: the name of the internal_copied_filegroup rule, which will be the - name of the generated filegroup. - srcs: the source files to be copied. - include: the expected import root of the source. - **kargs: extra arguments that will be passed into the filegroup. - """ - outs = [_RelativeOutputPath(s, include) for s in srcs] - - native.genrule( - name=name+"_genrule", - srcs=srcs, - outs=outs, - cmd=" && ".join(["cp $(location %s) $(location %s)" % - (s, _RelativeOutputPath(s, include)) - for s in srcs])) - - native.filegroup( - name=name, - srcs=outs, - **kargs) - def py_proto_library( name, srcs=[], @@ -235,8 +206,8 @@ def py_proto_library( py_libs=[], py_extra_srcs=[], include=None, - default_runtime="//google/protobuf:protobuf_python", - protoc="//google/protobuf:protoc", + default_runtime="//:protobuf_python", + protoc="//:protoc", **kargs): """Bazel rule to create a Python protobuf library from proto source files @@ -276,15 +247,6 @@ def py_proto_library( visibility=["//visibility:public"], ) - if include != None: - # Copy the output files to the desired location to make the import work. - internal_copied_filegroup_name=name + "_internal_copied_filegroup" - internal_copied_filegroup( - name=internal_copied_filegroup_name, - srcs=outs, - include=include) - outs=[internal_copied_filegroup_name] - if default_runtime and not default_runtime in py_libs + deps: py_libs += [default_runtime] @@ -292,6 +254,7 @@ def py_proto_library( name=name, srcs=outs+py_extra_srcs, deps=py_libs+deps, + imports=includes, **kargs) def internal_protobuf_py_tests( @@ -308,8 +271,7 @@ def internal_protobuf_py_tests( """ for m in modules: - s = _RelativeOutputPath( - "python/google/protobuf/internal/%s.py" % m, "python") + s = "python/google/protobuf/internal/%s.py" % m native.py_test( name="py_%s" % m, srcs=[s], |