Report exceptions from both makes to Exception Analyzer
This commit is contained in:
@@ -104,7 +104,7 @@ public class CompilerOutputParser {
|
|||||||
.put("warning", WARNING)
|
.put("warning", WARNING)
|
||||||
.put("logging", LOGGING)
|
.put("logging", LOGGING)
|
||||||
.put("output", OUTPUT)
|
.put("output", OUTPUT)
|
||||||
.put("exception", ERROR)
|
.put("exception", EXCEPTION)
|
||||||
.put("info", INFO)
|
.put("info", INFO)
|
||||||
.put("messages", INFO) // Root XML element
|
.put("messages", INFO) // Root XML element
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.compiler.runner;
|
||||||
|
|
||||||
|
public class CompilerRunnerConstants {
|
||||||
|
public static final String KOTLIN_COMPILER_NAME = "Kotlin";
|
||||||
|
public static final String INTERNAL_ERROR_PREFIX = "[Internal Error] ";
|
||||||
|
}
|
||||||
@@ -16,20 +16,30 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.plugin.compiler;
|
package org.jetbrains.jet.plugin.compiler;
|
||||||
|
|
||||||
import com.intellij.openapi.compiler.CompilerManager;
|
import com.intellij.openapi.compiler.*;
|
||||||
import com.intellij.openapi.components.ProjectComponent;
|
import com.intellij.openapi.components.ProjectComponent;
|
||||||
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.fileTypes.FileType;
|
import com.intellij.openapi.fileTypes.FileType;
|
||||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||||
|
import com.intellij.openapi.project.Project;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.plugin.JetFileType;
|
import org.jetbrains.jet.plugin.JetFileType;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import static org.jetbrains.jet.compiler.runner.CompilerRunnerConstants.INTERNAL_ERROR_PREFIX;
|
||||||
|
import static org.jetbrains.jet.compiler.runner.CompilerRunnerConstants.KOTLIN_COMPILER_NAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yole
|
* @author yole
|
||||||
*/
|
*/
|
||||||
public class JetCompilerManager implements ProjectComponent {
|
public class JetCompilerManager implements ProjectComponent {
|
||||||
public JetCompilerManager(CompilerManager manager) {
|
private static final Logger LOG = Logger.getInstance(JetCompilerManager.class);
|
||||||
|
|
||||||
|
// Comes from external make
|
||||||
|
private static final String PREFIX_WITH_COMPILER_NAME = KOTLIN_COMPILER_NAME + ": " + INTERNAL_ERROR_PREFIX;
|
||||||
|
|
||||||
|
public JetCompilerManager(Project project, CompilerManager manager) {
|
||||||
manager.addTranslatingCompiler(new JetCompiler(),
|
manager.addTranslatingCompiler(new JetCompiler(),
|
||||||
Collections.<FileType>singleton(JetFileType.INSTANCE),
|
Collections.<FileType>singleton(JetFileType.INSTANCE),
|
||||||
Collections.singleton(StdFileTypes.CLASS));
|
Collections.singleton(StdFileTypes.CLASS));
|
||||||
@@ -37,6 +47,24 @@ public class JetCompilerManager implements ProjectComponent {
|
|||||||
Collections.<FileType>singleton(JetFileType.INSTANCE),
|
Collections.<FileType>singleton(JetFileType.INSTANCE),
|
||||||
Collections.<FileType>singleton(StdFileTypes.JS));
|
Collections.<FileType>singleton(StdFileTypes.JS));
|
||||||
manager.addCompilableFileType(JetFileType.INSTANCE);
|
manager.addCompilableFileType(JetFileType.INSTANCE);
|
||||||
|
|
||||||
|
manager.addCompilationStatusListener(new CompilationStatusListener() {
|
||||||
|
@Override
|
||||||
|
public void compilationFinished(
|
||||||
|
boolean aborted, int errors, int warnings, CompileContext compileContext
|
||||||
|
) {
|
||||||
|
for (CompilerMessage error : compileContext.getMessages(CompilerMessageCategory.ERROR)) {
|
||||||
|
String message = error.getMessage();
|
||||||
|
if (message.startsWith(INTERNAL_ERROR_PREFIX) || message.startsWith(PREFIX_WITH_COMPILER_NAME)) {
|
||||||
|
LOG.error(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fileGenerated(String outputRoot, String relativePath) {
|
||||||
|
}
|
||||||
|
}, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,17 +18,15 @@ package org.jetbrains.jet.plugin.compiler;
|
|||||||
|
|
||||||
import com.intellij.openapi.compiler.CompileContext;
|
import com.intellij.openapi.compiler.CompileContext;
|
||||||
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.cli.common.messages.CompilerMessageLocation;
|
import org.jetbrains.jet.cli.common.messages.CompilerMessageLocation;
|
||||||
import org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity;
|
import org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity;
|
||||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||||
|
import org.jetbrains.jet.compiler.runner.CompilerRunnerConstants;
|
||||||
|
|
||||||
import static com.intellij.openapi.compiler.CompilerMessageCategory.*;
|
import static com.intellij.openapi.compiler.CompilerMessageCategory.*;
|
||||||
|
|
||||||
class MessageCollectorAdapter implements MessageCollector {
|
class MessageCollectorAdapter implements MessageCollector {
|
||||||
private static final Logger LOG = Logger.getInstance(MessageCollectorAdapter.class);
|
|
||||||
|
|
||||||
private final CompileContext compileContext;
|
private final CompileContext compileContext;
|
||||||
|
|
||||||
public MessageCollectorAdapter(CompileContext compileContext) {
|
public MessageCollectorAdapter(CompileContext compileContext) {
|
||||||
@@ -42,10 +40,13 @@ class MessageCollectorAdapter implements MessageCollector {
|
|||||||
@NotNull CompilerMessageLocation location
|
@NotNull CompilerMessageLocation location
|
||||||
) {
|
) {
|
||||||
CompilerMessageCategory category = category(severity);
|
CompilerMessageCategory category = category(severity);
|
||||||
compileContext.addMessage(category, message, "file://" + location.getPath(), location.getLine(), location.getColumn());
|
|
||||||
|
String prefix = "";
|
||||||
if (severity == CompilerMessageSeverity.EXCEPTION) {
|
if (severity == CompilerMessageSeverity.EXCEPTION) {
|
||||||
LOG.error(message);
|
prefix = CompilerRunnerConstants.INTERNAL_ERROR_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileContext.addMessage(category, prefix + message, "file://" + location.getPath(), location.getLine(), location.getColumn());
|
||||||
if (severity == CompilerMessageSeverity.LOGGING) {
|
if (severity == CompilerMessageSeverity.LOGGING) {
|
||||||
compileContext.getProgressIndicator().setText(message);
|
compileContext.getProgressIndicator().setText(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity.ERROR;
|
import static org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity.ERROR;
|
||||||
|
import static org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity.EXCEPTION;
|
||||||
|
|
||||||
public class KotlinBuilder extends ModuleLevelBuilder {
|
public class KotlinBuilder extends ModuleLevelBuilder {
|
||||||
|
|
||||||
private static final String KOTLIN_COMPILER_NAME = "Kotlin";
|
|
||||||
private static final String KOTLIN_BUILDER_NAME = "Kotlin Builder";
|
private static final String KOTLIN_BUILDER_NAME = "Kotlin Builder";
|
||||||
|
|
||||||
protected KotlinBuilder() {
|
protected KotlinBuilder() {
|
||||||
@@ -133,10 +133,14 @@ public class KotlinBuilder extends ModuleLevelBuilder {
|
|||||||
@NotNull String message,
|
@NotNull String message,
|
||||||
@NotNull CompilerMessageLocation location
|
@NotNull CompilerMessageLocation location
|
||||||
) {
|
) {
|
||||||
|
String prefix = "";
|
||||||
|
if (severity == EXCEPTION) {
|
||||||
|
prefix = CompilerRunnerConstants.INTERNAL_ERROR_PREFIX;
|
||||||
|
}
|
||||||
context.processMessage(new CompilerMessage(
|
context.processMessage(new CompilerMessage(
|
||||||
KOTLIN_COMPILER_NAME,
|
CompilerRunnerConstants.KOTLIN_COMPILER_NAME,
|
||||||
kind(severity),
|
kind(severity),
|
||||||
message,
|
prefix + message,
|
||||||
location.getPath(),
|
location.getPath(),
|
||||||
-1, -1, -1,
|
-1, -1, -1,
|
||||||
location.getLine(),
|
location.getLine(),
|
||||||
|
|||||||
Reference in New Issue
Block a user