Commit 00b060c1 authored by peter's avatar peter
Browse files

[^maxmedvedev] trim groovyc's output (IDEA-94812)

parent b9f00362
Showing with 11 additions and 2 deletions
+11 -2
......@@ -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.GroovycRunner;
......@@ -101,7 +102,7 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
}
final String compiled = handleOutputBuffer(GroovycRunner.COMPILED_START, GroovycRunner.COMPILED_END);
final List<String> list = StringUtil.split(compiled, GroovycRunner.SEPARATOR);
final List<String> list = splitAndTrim(compiled);
String outputPath = list.get(0);
String sourceFile = list.get(1);
......@@ -121,7 +122,7 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
text = handleOutputBuffer(GroovycRunner.MESSAGES_START, GroovycRunner.MESSAGES_END);
List<String> tokens = StringUtil.split(text, GroovycRunner.SEPARATOR);
List<String> tokens = splitAndTrim(text);
LOG.assertTrue(tokens.size() > 4, "Wrong number of output params");
String category = tokens.get(0);
......@@ -154,6 +155,14 @@ public class GroovycOSProcessHandler extends BaseOSProcessHandler {
}
}
private static List<String> splitAndTrim(String compiled) {
return ContainerUtil.map(StringUtil.split(compiled, GroovycRunner.SEPARATOR), new Function<String, String>() {
public String fun(String s) {
return s.trim();
}
});
}
private String handleOutputBuffer(String startMarker, String endMarker) {
final int start = outputBuffer.indexOf(startMarker);
final int end = outputBuffer.indexOf(endMarker);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment