https://github.com/google/protobuf/pull/1278

On Mon, Feb 22, 2016 at 5:07 PM, Rohit Saboo <[email protected]> wrote:

> Hi bazel-discuss and protobuf,
>
> I am bringing in protobuf as an external bazel repository:
>
> git_repository(
>     name = "protobuf_repo",
>     commit = "32daf513ced8d51e8de6cc8d800cfc972c4df5d6",
>     init_submodules = True,
>     remote = "https://github.com/google/protobuf.git";,
> )
>
> and using the protobuf_java target as a dependency in my bazel java
> libraries. This fails generating the following message:
>
> ...
> >>>>> # @protobuf_repo//:gen_well_known_protos_java [action 'Executing
> genrule @protobuf_repo//:gen_well_known_protos_java']
>
> (cd /private/var/tmp/_bazel_rohit/a10731376421707628e091029859af4a/beam &&
> \
>
>   exec env - \
>
>     PATH='<snip>' \
>
>     TMPDIR=/var/folders/p2/yz_3gtqd4z9d15l2ptzcjbsm0000gn/T/ \
>
>   /bin/bash -c 'source
> external/bazel_tools/tools/genrule/genrule-setup.sh;
> bazel-out/host/bin/external/protobuf_repo/protoc
> --java_out=bazel-out/local_darwin-fastbuild/genfiles/external/protobuf_repo/wellknown.jar
> -Isrc external/protobuf_repo/src/google/protobuf/any.proto
> external/protobuf_repo/src/google/protobuf/api.proto
> external/protobuf_repo/src/google/protobuf/compiler/plugin.proto
> external/protobuf_repo/src/google/protobuf/descriptor.proto
> external/protobuf_repo/src/google/protobuf/duration.proto
> external/protobuf_repo/src/google/protobuf/empty.proto
> external/protobuf_repo/src/google/protobuf/field_mask.proto
> external/protobuf_repo/src/google/protobuf/source_context.proto
> external/protobuf_repo/src/google/protobuf/struct.proto
> external/protobuf_repo/src/google/protobuf/timestamp.proto
> external/protobuf_repo/src/google/protobuf/type.proto
> external/protobuf_repo/src/google/protobuf/wrappers.proto  && mv
> bazel-out/local_darwin-fastbuild/genfiles/external/protobuf_repo/wellknown.jar
> bazel-out/local_darwin-fastbuild/genfiles/external/protobuf_repo/wellknown.srcjar')
>
> ERROR: 
> /private/var/tmp/_bazel_rohit/a10731376421707628e091029859af4a/external/protobuf_repo/BUILD:461:1:
> Couldn't build file external/protobuf_repo/wellknown.srcjar: Executing
> genrule @protobuf_repo//:gen_well_known_protos_java failed: bash failed:
> error executing command /bin/bash -c ... (remaining 1 argument(s) skipped):
> com.google.devtools.build.lib.shell.BadExitStatusException: Process exited
> with status 1.
>
> src: warning: directory does not exist.
>
> external/protobuf_repo/src/google/protobuf/any.proto: File does not reside
> within any path specified using --proto_path (or -I).  You must specify a
> --proto_path which encompasses this file.  Note that the proto_path must be
> an exact prefix of the .proto file names -- protoc is too dumb to figure
> out when two paths (e.g. absolute and relative) are equivalent (it's harder
> than you think).
>
> The warning has the clue, and if I were to replace the import path (-Isrc)
> with -Iexternal/protobuf_repo/src. Is there an equivalent of bazel
> workspace_root that can be used for the cmd in this genrule in
> protobuf/BUILD?
> genrule(
>     name = "gen_well_known_protos_java",
>     srcs = WELL_KNOWN_PROTOS,
>     outs = [
>         "wellknown.srcjar",
>     ],
>     cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" +
>           " -Isrc $(SRCS) " +
>           " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar",
>     tools = [":protoc"],
> )
>
> Thanks,
> Rohit Saboo
>
> --
> You received this message because you are subscribed to the Google Groups
> "bazel-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bazel-discuss/CAM01fBrV2W%2BSoTjaLkkU014LRcQzdTBMO_%2Be3xhm39x7dvEGaw%40mail.gmail.com
> <https://groups.google.com/d/msgid/bazel-discuss/CAM01fBrV2W%2BSoTjaLkkU014LRcQzdTBMO_%2Be3xhm39x7dvEGaw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to