Skip to content

Commit afb434d

Browse files
fmeumcopybara-github
authored andcommitted
Fix behavior of print() in module extensions
Previously, messages printed with `print()` didn't have the usual `DEBUG:` prefix. Fixes bazelbuild#14526 Closes bazelbuild#15795. PiperOrigin-RevId: 459052873 Change-Id: I1b75498d448aaae137dd63ea0a418572097bdac2
1 parent 798e288 commit afb434d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/java/com/google/devtools/build/lib/bazel/bzlmod/SingleExtensionEvalFunction.java

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void setRepositoryRemoteExecutor(RepositoryRemoteExecutor repositoryRemot
8585
this.repositoryRemoteExecutor = repositoryRemoteExecutor;
8686
}
8787

88+
@Nullable
8889
@Override
8990
public SkyValue compute(SkyKey skyKey, Environment env)
9091
throws SkyFunctionException, InterruptedException {
@@ -165,6 +166,7 @@ public SkyValue compute(SkyKey skyKey, Environment env)
165166
try (Mutability mu =
166167
Mutability.create("module extension", usagesValue.getExtensionUniqueName())) {
167168
StarlarkThread thread = new StarlarkThread(mu, starlarkSemantics);
169+
thread.setPrintHandler(Event.makeDebugPrintHandler(env.getListener()));
168170
ModuleExtensionContext moduleContext =
169171
createContext(env, usagesValue, starlarkSemantics, extension);
170172
threadContext.storeInThread(thread);

0 commit comments

Comments
 (0)