Fix a double issue regarding interrupted builds due to pre-existing errors.
First, the ApkBuilder didn't cancel its run if the project had markers from JDT. Second, the try/catch on ApkBuilder#build didn't properly test the CoreException status severity (used getCode instead of getSeverity), so it did not detect cancels being thrown by #abortOnBadSetup and displayed the error in the console instead.
This commit is contained in:
@@ -570,7 +570,7 @@ public class ApkBuilder extends BaseBuilder {
|
||||
|
||||
// first check if this is a CoreException we threw to cancel the build.
|
||||
if (exception instanceof CoreException) {
|
||||
if (((CoreException)exception).getStatus().getCode() == IStatus.CANCEL) {
|
||||
if (((CoreException)exception).getStatus().getSeverity() == IStatus.CANCEL) {
|
||||
// Project is already marked with an error. Nothing to do
|
||||
return referencedProjects;
|
||||
}
|
||||
@@ -1198,4 +1198,17 @@ public class ApkBuilder extends BaseBuilder {
|
||||
String name = folder.getName();
|
||||
return JavaResourceFilter.checkFolderForPackaging(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void abortOnBadSetup(IProject project) throws CoreException {
|
||||
super.abortOnBadSetup(project);
|
||||
|
||||
// for this version, we stop on any marker (ie also markers coming from JDT)
|
||||
IMarker[] markers = project.findMarkers(null /*type*/, false /*includeSubtypes*/,
|
||||
IResource.DEPTH_ZERO);
|
||||
|
||||
if (markers.length > 0) {
|
||||
stopBuild("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,9 +350,9 @@ abstract class BaseBuilder extends IncrementalProjectBuilder {
|
||||
protected final int grabProcessOutput(final Process process,
|
||||
final ArrayList<String> results)
|
||||
throws InterruptedException {
|
||||
// Due to the limited buffer size on windows for the standard io (stderr, stdout), we
|
||||
// *need* to read both stdout and stderr all the time. If we don't and a process output
|
||||
// a large amount, this could deadlock the process.
|
||||
// Due to the limited buffer size on windows for the standard io (stderr, stdout), we
|
||||
// *need* to read both stdout and stderr all the time. If we don't and a process output
|
||||
// a large amount, this could deadlock the process.
|
||||
|
||||
// read the lines as they come. if null is returned, it's
|
||||
// because the process finished
|
||||
@@ -886,7 +886,7 @@ abstract class BaseBuilder extends IncrementalProjectBuilder {
|
||||
* @param project The {@link IJavaProject} being compiled.
|
||||
* @throws CoreException
|
||||
*/
|
||||
protected final void abortOnBadSetup(IProject project) throws CoreException {
|
||||
protected void abortOnBadSetup(IProject project) throws CoreException {
|
||||
// check if we have finished loading the SDK.
|
||||
if (AdtPlugin.getDefault().getSdkLoadStatus() != LoadStatus.LOADED) {
|
||||
// we exit silently
|
||||
|
||||
Reference in New Issue
Block a user