Skip to content

Commit

Permalink
fix TODO in repository_rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyverald committed Jan 30, 2024
1 parent 707a975 commit eae938e
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public StarlarkCallable repositoryRule(
Object doc, // <String> or Starlark.NONE
StarlarkThread thread)
throws EvalException {
BazelStarlarkContext.checkLoadingOrWorkspacePhase(thread, "repository_rule");
var bzlInitContext = BzlInitThreadContext.fromOrFail(thread, "repository_rule");
// We'll set the name later, pass the empty string for now.
RuleClass.Builder builder = new RuleClass.Builder("", RuleClassType.WORKSPACE, true);

Expand Down Expand Up @@ -107,11 +107,8 @@ public StarlarkCallable repositoryRule(
}
}
builder.setConfiguredTargetFunction(implementation);
// TODO(b/291752414): If we care about the digest of repository rules, we should be using the
// transitive bzl digest of the module of the outermost stack frame, not the innermost.
BazelModuleContext moduleContext = BazelModuleContext.ofInnermostBzlOrThrow(thread);
builder.setRuleDefinitionEnvironmentLabelAndDigest(
moduleContext.label(), moduleContext.bzlTransitiveDigest());
bzlInitContext.getBzlFile(), bzlInitContext.getTransitiveDigest());
Label.RepoMappingRecorder repoMappingRecorder = thread.getThreadLocal(Label.RepoMappingRecorder.class);
if (repoMappingRecorder != null) {
builder.setRuleDefinitionEnvironmentRepoMappingEntries(repoMappingRecorder.recordedEntries());
Expand Down

0 comments on commit eae938e

Please sign in to comment.