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("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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