nnrales
nnrales

Reputation: 1519

Update a single external repo in Bazel

I want to update a single external dependency before I do bazel build. Is there a way to do this?

bazel sync refreshes all the external dependencies, I am looking for something to just refresh a single external dependency.

bazel fetch does not seem to work for me, at least when I tried fetching a remote git repo.

Upvotes: 2

Views: 3691

Answers (1)

Cloud
Cloud

Reputation: 1411

TL,DR

  1. delete repo root or marker file in $(bazel info output_base)/external
  2. bazel shutdown
  3. bazel build //target/related/with/the:repo

For later coming, this requirement generally happens when external repo is not properly configured or you are the one that is configuring it and it is broken for now.

E.g. for cuda in tensorflow, a custom repository_rule is defined for bazel to collect cuda headers installed on the system and form a local external repository @local_config_cuda, however, if you updated part of the library, say, upgrade cudnn from 7.3.1 to 7.6.5 , the repository_rule will not simply, automatically, intelligently re-execute for you. In this case, there is no way for you to use checksum or specify a list of file (before you collect that list for file) as input for the repository_rule.

Simply put, there is no way for bazel to force re-execute a single repository_rule at the moment. See Working with External Dependencies - Layout.

To rebuild the local external repository, see Design Document: Invalidation of remote repositories for how to invalid the local repo.

Upvotes: 4

Related Questions