mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fail build if javac return code is 'false'
This commit is contained in:
@@ -30,7 +30,7 @@ import java.util.concurrent.ExecutionException;
|
||||
public class IncProjectBuilder {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.IncProjectBuilder");
|
||||
|
||||
public static final String JPS_SERVER_NAME = "JPS BUILD";
|
||||
public static final String COMPILE_SERVER_NAME = "COMPILE SERVER";
|
||||
private static final String CANCELED_MESSAGE = "The build has been canceled";
|
||||
|
||||
private final ProjectDescriptor myProjectDescriptor;
|
||||
@@ -75,7 +75,7 @@ public class IncProjectBuilder {
|
||||
catch (ProjectBuildException e) {
|
||||
if (e.getCause() instanceof PersistentEnumerator.CorruptedException) {
|
||||
// force rebuild
|
||||
myMessageDispatcher.processMessage(new CompilerMessage(JPS_SERVER_NAME, BuildMessage.Kind.INFO,
|
||||
myMessageDispatcher.processMessage(new CompilerMessage(COMPILE_SERVER_NAME, BuildMessage.Kind.INFO,
|
||||
"Internal caches are corrupted or have outdated format, forcing project rebuild: " +
|
||||
e.getMessage()));
|
||||
flushContext(context);
|
||||
@@ -90,10 +90,11 @@ public class IncProjectBuilder {
|
||||
catch (ProjectBuildException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
if (cause == null) {
|
||||
myMessageDispatcher.processMessage(new ProgressMessage(e.getMessage()));
|
||||
final BuildMessage msg = e.isError()? new CompilerMessage("", BuildMessage.Kind.ERROR, e.getMessage()) : new ProgressMessage(e.getMessage());
|
||||
myMessageDispatcher.processMessage(msg);
|
||||
}
|
||||
else {
|
||||
myMessageDispatcher.processMessage(new CompilerMessage(JPS_SERVER_NAME, cause));
|
||||
myMessageDispatcher.processMessage(new CompilerMessage(COMPILE_SERVER_NAME, cause));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -241,7 +242,7 @@ public class IncProjectBuilder {
|
||||
}
|
||||
}
|
||||
else {
|
||||
context.processMessage(new CompilerMessage(JPS_SERVER_NAME, BuildMessage.Kind.WARNING, "Output path " +
|
||||
context.processMessage(new CompilerMessage(COMPILE_SERVER_NAME, BuildMessage.Kind.WARNING, "Output path " +
|
||||
outputRoot.getPath() +
|
||||
" intersects with a source root. The output cannot be cleaned."));
|
||||
}
|
||||
|
||||
@@ -5,20 +5,33 @@ package org.jetbrains.jps.incremental;
|
||||
* Date: 9/20/11
|
||||
*/
|
||||
public class ProjectBuildException extends Exception{
|
||||
private final boolean myIsError;
|
||||
|
||||
public ProjectBuildException() {
|
||||
myIsError = false;
|
||||
}
|
||||
|
||||
public ProjectBuildException(String message) {
|
||||
this(message, false);
|
||||
}
|
||||
|
||||
public ProjectBuildException(String message, boolean isError) {
|
||||
super(message);
|
||||
myIsError = isError;
|
||||
}
|
||||
|
||||
public ProjectBuildException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
myIsError = true;
|
||||
}
|
||||
|
||||
public ProjectBuildException(Throwable cause) {
|
||||
super(cause);
|
||||
myIsError = true;
|
||||
}
|
||||
|
||||
public boolean isError() {
|
||||
return myIsError;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -282,11 +282,12 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
if (!compiledOk && diagnosticSink.getErrorCount() == 0) {
|
||||
throw new ProjectBuildException("Compilation failed: internal java compiler error");
|
||||
throw new ProjectBuildException("Compilation failed: internal java compiler error", true);
|
||||
}
|
||||
if (diagnosticSink.getErrorCount() > 0) {
|
||||
throw new ProjectBuildException(
|
||||
"Compilation failed: errors: " + diagnosticSink.getErrorCount() + "; warnings: " + diagnosticSink.getWarningCount());
|
||||
"Compilation failed: errors: " + diagnosticSink.getErrorCount() + "; warnings: " + diagnosticSink.getWarningCount()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -719,7 +720,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
public void outputLineAvailable(String line) {
|
||||
if (line != null) {
|
||||
if (!StringUtil.isEmpty(line)) {
|
||||
//System.err.println(line);
|
||||
if (line.startsWith("[") && line.endsWith("]")) {
|
||||
final String message = line.substring(1, line.length() - 1);
|
||||
@@ -735,6 +736,9 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
else if (line.contains("java.lang.OutOfMemoryError")) {
|
||||
myContext.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, "OutOfMemoryError: insufficient memory"));
|
||||
}
|
||||
else {
|
||||
myContext.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.INFO, line));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user