mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add some groovyc logging and trim its output (IDEA-94812)
This commit is contained in:
+5
-1
@@ -156,10 +156,14 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
|
||||
private GroovycOSProcessHandler runGroovyc(final CompileContext context, ModuleChunk chunk, File tempFile) throws IOException {
|
||||
//todo xmx
|
||||
ArrayList<String> classpath = new ArrayList<String>(generateClasspath(context, chunk));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Groovyc classpath: " + classpath);
|
||||
}
|
||||
final List<String> cmd = ExternalProcessUtil.buildJavaCommandLine(
|
||||
getJavaExecutable(chunk),
|
||||
"org.jetbrains.groovy.compiler.rt.GroovycRunner",
|
||||
Collections.<String>emptyList(), new ArrayList<String>(generateClasspath(context, chunk)),
|
||||
Collections.<String>emptyList(), classpath,
|
||||
Arrays.asList("-Xmx384m",
|
||||
"-Dfile.encoding=" + System.getProperty("file.encoding")/*,
|
||||
"-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239"*/),
|
||||
|
||||
+19
-7
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.groovy.compiler.rt.GroovyCompilerMessageCategories;
|
||||
@@ -102,11 +103,15 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
|
||||
}
|
||||
|
||||
final String compiled = handleOutputBuffer(GroovyRtConstants.COMPILED_START, GroovyRtConstants.COMPILED_END);
|
||||
final List<String> list = StringUtil.split(compiled, GroovyRtConstants.SEPARATOR);
|
||||
final List<String> list = splitAndTrim(compiled);
|
||||
String outputPath = list.get(0);
|
||||
String sourceFile = list.get(1);
|
||||
|
||||
ContainerUtil.addIfNotNull(getOutputItem(outputPath, sourceFile), myCompiledItems);
|
||||
OutputItem item = new OutputItem(outputPath, sourceFile);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Output: " + item);
|
||||
}
|
||||
myCompiledItems.add(item);
|
||||
|
||||
}
|
||||
else if (outputBuffer.indexOf(GroovyRtConstants.TO_RECOMPILE_START) != -1) {
|
||||
@@ -122,7 +127,7 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
|
||||
|
||||
text = handleOutputBuffer(GroovyRtConstants.MESSAGES_START, GroovyRtConstants.MESSAGES_END);
|
||||
|
||||
List<String> tokens = StringUtil.split(text, GroovyRtConstants.SEPARATOR);
|
||||
List<String> tokens = splitAndTrim(text);
|
||||
LOG.assertTrue(tokens.size() > 4, "Wrong number of output params");
|
||||
|
||||
String category = tokens.get(0);
|
||||
@@ -150,7 +155,11 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
|
||||
? BuildMessage.Kind.WARNING
|
||||
: BuildMessage.Kind.INFO;
|
||||
|
||||
compilerMessages.add(new CompilerMessage("Groovyc", kind, message, url, -1, -1, -1, lineInt, columnInt));
|
||||
CompilerMessage compilerMessage = new CompilerMessage("Groovyc", kind, message, url, -1, -1, -1, lineInt, columnInt);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Message: " + compilerMessage);
|
||||
}
|
||||
compilerMessages.add(compilerMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,9 +178,12 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
|
||||
return text.trim();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static OutputItem getOutputItem(final String outputPath, final String sourceFile) {
|
||||
return new OutputItem(outputPath, sourceFile);
|
||||
private static List<String> splitAndTrim(String compiled) {
|
||||
return ContainerUtil.map(StringUtil.split(compiled, GroovyRtConstants.SEPARATOR), new Function<String, String>() {
|
||||
public String fun(String s) {
|
||||
return s.trim();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<OutputItem> getSuccessfullyCompiled() {
|
||||
|
||||
Reference in New Issue
Block a user