sjaymj62
sjaymj62

Reputation: 378

Artifactories integration with Bazel

I am currently trying to build a project with source in a git repository and some dependencies in an artifactory. I need to first download all the sources and binaries from the repo and artifactory to my local workspace.

I could not find any information regarding artifactory integration with bazel. I can see that this feature has been requested https://www.jfrog.com/jira/browse/RTFACT-15428?jql=labels%20%3D%20bazel. Is anyone aware of any build tools that can first download resources and then build them? I need both git and artifactory support.

Upvotes: 2

Views: 6764

Answers (3)

user7610
user7610

Reputation: 28919

Remote build cache

Bazel supports any HTTP 1.1 server with PUT and GET methods as http cache. Simple HTTP Auth is also supported. This means using Artifactory as a remote build cache is straightforward.

  1. Create a new Generic repository in Artifactory.

Now run bazel as

bazel test \
   --remote_http_cache=https://user:password@[...].com:8081/artifactory/bazel/ \
   test //...

See https://docs.bazel.build/versions/master/remote-caching.html for the relevant Bazel doc.

Upvotes: 2

hlopko
hlopko

Reputation: 3268

You can also attempt to write the artifactory rules in Skylark: https://docs.bazel.build/versions/master/skylark/repository_rules.html

Upvotes: 2

Arnaud Jeansen
Arnaud Jeansen

Reputation: 1726

According to the Bazel documentation for Java, you can define external dependencies resolved to Maven with rule maven_jar.

As Artifactory supports Maven, you can set up your dependencies in a Maven repository, and retrieve artifacts from there with your Bazel build script.

On the other side of the build, publication seems to be a work-in-progress and on the roadmap for Bazel builds.

Upvotes: 6

Related Questions