am 70fc6e9: Make sure that any exception during the final packaging prop
Merge commit '70fc6e96af1213c192160a16803feb220e10c561' * commit '70fc6e96af1213c192160a16803feb220e10c561': Make sure that any exception during the final packaging properly put an error marker on the project (since build failed.
This commit is contained in:
committed by
The Android Open Source Project
commit
bef7556739
@@ -204,11 +204,15 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
// get a project object
|
// get a project object
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
|
|
||||||
|
// list of referenced projects.
|
||||||
|
IProject[] referencedProjects = null;
|
||||||
|
|
||||||
|
try {
|
||||||
// Top level check to make sure the build can move forward.
|
// Top level check to make sure the build can move forward.
|
||||||
abortOnBadSetup(project);
|
abortOnBadSetup(project);
|
||||||
|
|
||||||
// get the list of referenced projects.
|
// get the list of referenced projects.
|
||||||
IProject[] referencedProjects = ProjectHelper.getReferencedProjects(project);
|
referencedProjects = ProjectHelper.getReferencedProjects(project);
|
||||||
IJavaProject[] referencedJavaProjects = getJavaProjects(referencedProjects);
|
IJavaProject[] referencedJavaProjects = getJavaProjects(referencedProjects);
|
||||||
|
|
||||||
// get the output folder, this method returns the path with a trailing
|
// get the output folder, this method returns the path with a trailing
|
||||||
@@ -558,9 +562,31 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, getProject(),
|
AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, getProject(),
|
||||||
"Build Success!");
|
"Build Success!");
|
||||||
}
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
// try to catch other exception to actually display an error. This will be useful
|
||||||
|
// if we get an NPE or something so that we can at least notify the user that something
|
||||||
|
// went wrong.
|
||||||
|
|
||||||
|
// first check if this is a CoreException we threw to cancel the build.
|
||||||
|
if (exception instanceof CoreException) {
|
||||||
|
if (((CoreException)exception).getStatus().getCode() == IStatus.CANCEL) {
|
||||||
|
// Project is already marked with an error. Nothing to do
|
||||||
return referencedProjects;
|
return referencedProjects;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = exception.getMessage();
|
||||||
|
if (msg == null) {
|
||||||
|
msg = exception.getClass().getCanonicalName();
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = String.format("Unknown error: %1$s", msg);
|
||||||
|
AdtPlugin.printErrorToConsole(project, msg);
|
||||||
|
markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return referencedProjects;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startupOnInitialize() {
|
protected void startupOnInitialize() {
|
||||||
@@ -921,7 +947,6 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
AdtPlugin.printErrorToConsole(javaProject.getProject(), msg);
|
AdtPlugin.printErrorToConsole(javaProject.getProject(), msg);
|
||||||
markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
|
markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (fos != null) {
|
if (fos != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user