}
public void run() throws GradleScriptException {
ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
listener.beforeScript(script);
GradleScriptException failure = null;
Thread.currentThread().setContextClassLoader(script.getContextClassloader());
script.getStandardOutputCapture().start();
try {
script.run();
} catch (Throwable e) {
failure = new GradleScriptException(String.format("A problem occurred evaluating %s.", script), e);
}
script.getStandardOutputCapture().stop();
Thread.currentThread().setContextClassLoader(originalLoader);
listener.afterScript(script, failure);
if (failure != null) {