Skip to content

Pass template labels to repository_ctx.template directly - #298

Open
fmeum wants to merge 1 commit into
bazel-contrib:mainfrom
fmeum:oss-fuzz-template-labels
Open

fmeum wants to merge 1 commit into
bazel-contrib:mainfrom
fmeum:oss-fuzz-template-labels

Conversation

@fmeum

@fmeum fmeum commented Oct 19, 2026

Copy link
Copy Markdown
Member

oss_fuzz_repository resolved its two template labels with repository_ctx.path before passing them to repository_ctx.template, which accepts labels directly. Resolving a label to a path makes the repo containing the file available on disk. With Bazel's --experimental_remote_repo_contents_cache, rules_fuzzing is otherwise only kept in memory, so this downloads all of its files whenever @rules_fuzzing_oss_fuzz is fetched. Since that is a local repo, this happens in every build that loads it (bazelbuild/bazel#31005). With bazelbuild/bazel#31493, template(label) only fetches the template itself. In Bazel's own CI with the cache enabled (bazelbuild/bazel#31755), the path call took about 0.5 s per job.

The generated BUILD and instrum.bzl files are identical before and after this change.

repository_ctx.path(label) makes the repo containing the file available
on disk, which isn't needed to read a template. With Bazel's remote repo
contents cache, this downloads every file of rules_fuzzing whenever the
OSS-Fuzz repo is fetched, which happens in every build since it is a
local repo.
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

Successfully merging this pull request may close these issues.

1 participant