Skip to content

Return repo_metadata from repository_rules#367

Open
keith wants to merge 1 commit into
bazelbuild:masterfrom
keith:ks/return-repo_metadata-from-repository_rules
Open

Return repo_metadata from repository_rules#367
keith wants to merge 1 commit into
bazelbuild:masterfrom
keith:ks/return-repo_metadata-from-repository_rules

Conversation

@keith

@keith keith commented Jul 9, 2026

Copy link
Copy Markdown
Member

This is used by bazel to determine that these rules are remotely
cacheable with the remote repo contents cache.

@keith keith requested review from a team and hvadehra as code owners July 9, 2026 16:48
This is used by bazel to determine that these rules are remotely
cacheable with the remote repo contents cache.
@keith keith force-pushed the ks/return-repo_metadata-from-repository_rules branch from c32fb78 to f9d9c79 Compare July 9, 2026 16:55
@hvadehra

Copy link
Copy Markdown
Member

#365 was opened first but this one seems more complete.

So I'd appreciate it if you and @dzbarsky can decide on which to proceed with.


repository_metadata = None
if hasattr(repository_ctx, "repo_metadata"):
repository_metadata = repository_ctx.repo_metadata(reproducible = True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a local java repository necessarily reproducible?

We detect the java_home from environment variables if not explicitly set. Even with an explicit java_home, what if it points to a symlink (that can change under us)?

Does it even make sense to cache a local repo like this remotely?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a repo that has a symlink to a absolute on-host location will get cached in the local repo contents cache but not the remote one (but @fmeum can confirm!)

I do think it would be safer/more obviously correct not to cache this one, but I'd also hope that it's completely lazy and that we don't force/autoregister the autodetecting toolchain for this language the way rules_cc and others do, though I haven't verified :/

@dzbarsky

Copy link
Copy Markdown

#365 was opened first but this one seems more complete.

So I'd appreciate it if you and @dzbarsky can decide on which to proceed with.

I don't mind closing mine if we get this one in quickly, if we think discussion of which repos to cache might drag on, then it might make sense to take the obviously correct ones upfront

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.

3 participants