Skip to content

Repository gets polluted with _virtual_imports #843

@ignasl

Description

@ignasl

I have encountered an interesting issue that reproduces in Bazel 0.27.0 and later versions when dependency tree is a bit more complex.

Consider such set-up:

  • There are two repositories: repo_one and repo_two -- links point to actual repositories where this issue reproduces.
  • two:proto in repo_two depends on one:proto in repo_one
  • one:proto in repo_one depends on three:proto in repo_two
  • Apparently, it is important that one:proto must be at certain level within repo_two. In this test it is under module/submodule/one/src/main/proto/

In repo_two when running bazel build --sandbox_debug //... two problems occur:

  1. //three/_virtual_imports/proto/three.proto gets copied (all Bazel versions after and including 0.27.0) -- repository gets polluted.
  2. Build fails because several copies of three.proto gets passed to the protoc at the same time. Reproduced mostly on 0.28.1, but it seems to be not 100% consistent. Last arguments for protoc look like this:
bazel-out/darwin-fastbuild/bin/three/_virtual_imports/proto/_virtual_imports/proto/_virtual_imports/proto/three.proto
bazel-out/darwin-fastbuild/bin/three/_virtual_imports/proto/_virtual_imports/proto/three.proto
bazel-out/darwin-fastbuild/bin/three/_virtual_imports/proto/three.proto

I suspect that ScalaPBGenerator.setupIncludedProto is not completely correct way to go. Why is it necessary to copy proto files someplace?.. It seems like the working directory has changed in 0.27.0, which caused the copies to go into the working copy of the repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions