Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading copybara into another bazel WORKSPACE #73

Closed
menny opened this issue Oct 12, 2018 · 2 comments
Closed

Loading copybara into another bazel WORKSPACE #73

menny opened this issue Oct 12, 2018 · 2 comments

Comments

@menny
Copy link

menny commented Oct 12, 2018

I'm trying to load Copybara into my internal Bazel WORKSPACE.
I added a http_archive statement to my WORKSPACE file:

http_archive(
    name = "copybara",
    url = "https://github.com/google/copybara/archive/4f8904964283a405beb9612eb30a5ef693d3f4f3.zip",
    type = "zip",
    sha256 = "b5f321ebc4932ed9b5673b80ea88fcccfad93dce68c76c81ce306c1ebf2b6b34",
    strip_prefix = "copybara-4f8904964283a405beb9612eb30a5ef693d3f4f3"
)

and then trying to build copybara: bazel build @copybara//java/com/google/copybara:copybara. At which point I get an error:

ERROR: Analysis of target ‘@copybara//java/com/google/copybara:copybara’ failed; build aborted: no such package ‘@flogger//jar’: The repository could not be resolved
INFO: Elapsed time: 0.194s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

I know this is not the main use-case of Copybara, but by having copybara part of my repo (as in, defined and pinned in my WORKSPACE file), I will be able to more easily create run targets that use Copybara.

@mikelalcon
Copy link
Collaborator

This is a known issue of Bazel, that it cannot make these transitive dependencies work. Your only workaround is to define those dependencies in your project.

@rohansingh
Copy link

I think, ideally, Copybara would define a deps.bzl that other projects could depend on. This seems to be standard practice in the Bazel world.

For now, you can copy the WORKSPACE into a copybara_deps.bzl in your local repository. You'll have to wrap it in a Skylark function, and then load and call that function in your own project's WORKSPACE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants