Skip to content

Commit

Permalink
Fix behavior of print() in module extensions (bazelbuild#15883)
Browse files Browse the repository at this point in the history
Previously, messages printed with `print()` didn't have the usual
`DEBUG:` prefix.

Fixes bazelbuild#14526

Closes bazelbuild#15795.

PiperOrigin-RevId: 459052873
Change-Id: I1b75498d448aaae137dd63ea0a418572097bdac2

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Co-authored-by: Chenchu K <ckolli@google.com>
  • Loading branch information
3 people authored Jul 15, 2022
1 parent 78af34f commit dc65cff
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void setRepositoryRemoteExecutor(RepositoryRemoteExecutor repositoryRemot
this.repositoryRemoteExecutor = repositoryRemoteExecutor;
}

@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
throws SkyFunctionException, InterruptedException {
Expand Down Expand Up @@ -161,6 +162,7 @@ public SkyValue compute(SkyKey skyKey, Environment env)
try (Mutability mu =
Mutability.create("module extension", usagesValue.getExtensionUniqueName())) {
StarlarkThread thread = new StarlarkThread(mu, starlarkSemantics);
thread.setPrintHandler(Event.makeDebugPrintHandler(env.getListener()));
ModuleExtensionContext moduleContext =
createContext(env, usagesValue, starlarkSemantics, extension);
threadContext.storeInThread(thread);
Expand Down

0 comments on commit dc65cff

Please sign in to comment.