Skip to content

Add support for building with Bazel #3129

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

Closed
edenman opened this issue Aug 13, 2018 · 8 comments
Closed

Add support for building with Bazel #3129

edenman opened this issue Aug 13, 2018 · 8 comments

Comments

@edenman
Copy link

edenman commented Aug 13, 2018

I would like to point my app at a forked version of Dagger, but Dagger builds with Bazel. I tried adding a custom build step to call bazel, but (perhaps obviously) it's not installed:

https://jitpack.io/com/github/edenman/dagger/c5e710b/build.log

@jitpack-io
Copy link
Member

Hi @edenman

Good idea! We should definitely add Bazel support at some point.
Would it be possible to build with custom commands for now?
https://jitpack.io/docs/BUILDING/#custom-commands

To work with JitPack the custom commands would need to:

  1. Download Bazel
  2. Install artifacts and .pom files somewhere in build directory
  3. Install artifacts and .pom files in ~/.m2/repository/...

@edenman
Copy link
Author

edenman commented Aug 20, 2018

I ended up just building and pushing my artifact to a dummy maven repo. Custom commands definitely possible but I'm probably not gonna spend the time to figure it out at this point.

@JohnAZoidberg
Copy link

With bazelisk it's very easy to get bazel. You just need to download a single binary and it downloads and configures bazel by itself.

Together with rules_jvm_external I can build and export to a maven repository.

Example: JohnAZoidberg/j-antplus#8

The only issue I encountered is that fetching the artifact fails because it can't get some dependencies of my project.

@JohnAZoidberg
Copy link

The only issue I encountered is that fetching the artifact fails because it can't get some dependencies of my project.

To clarify: I can fetch my own JAR from jithub but maven wants to fetch my dependencies from jithub too and they aren't.

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Apr 15, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@vorburger
Copy link

FYI I've found this issue and it has inspired me to put something similar together; just in case this is ever useful to others:

This got me to a point where it started building, but then appears to timeout?! It says "Status: Error" but it's not very clear from e.g. https://jitpack.io/com/github/vorburger/enola/jitpack2-bazelisk-e6742e9c7f-1/build.log what happened, but presumably it OOM'd. (Because, in my project, Bazel rebuilds ProtoBuf from sources, which is kind of stupid; this will eventually get improved in Bazel.)

PS: What I have also realized (AFTER 😃) is that without any caching, this is not very "efficient", because Bazel's entire architecture kind of assumes that it can keep state around between builds. (On GitHub Actions once can use https://github.com/bazel-contrib/setup-bazel for this.) @jitpack-io I don't suppose that it's possible to put something into jitpack.yml to cache certain directories between builds? From your documentation is appears that you may already be caching certain Gradle & Maven directories... if it was possible to list other customer directories to cache in jitpack.yml, that would be cool!

@vorburger
Copy link

Bazel rebuilds ProtoBuf from sources, which is kind of stupid; this will eventually get improved in Bazel.

==> protocolbuffers/protobuf#19558

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

No branches or pull requests

4 participants