Merge change 627 into donut
* changes: Fix a bunch of issues related to packaging the content of libs (NPE with files with no extension, not ignoring ignorable folders). Also fixed an issue when parsing Manifest with <uses-sdk />
This commit is contained in:
@@ -907,6 +907,21 @@ 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;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 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 (otherwise the build appears to succeed but the zip archive is not closed
|
||||||
|
// and therefore invalid.
|
||||||
|
String msg = e.getMessage();
|
||||||
|
if (msg == null) {
|
||||||
|
msg = e.getClass().getCanonicalName();
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = String.format("Unknown error: %1$s", msg);
|
||||||
|
AdtPlugin.printErrorToConsole(javaProject.getProject(), msg);
|
||||||
|
markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
|
||||||
|
return false;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (fos != null) {
|
if (fos != null) {
|
||||||
try {
|
try {
|
||||||
@@ -943,7 +958,8 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
IPath path = resource.getFullPath();
|
IPath path = resource.getFullPath();
|
||||||
|
|
||||||
// check the extension.
|
// check the extension.
|
||||||
if (path.getFileExtension().equalsIgnoreCase(AndroidConstants.EXT_NATIVE_LIB)) {
|
String ext = path.getFileExtension();
|
||||||
|
if (ext != null && ext.equalsIgnoreCase(AndroidConstants.EXT_NATIVE_LIB)) {
|
||||||
// remove the first segment to build the path inside the archive.
|
// remove the first segment to build the path inside the archive.
|
||||||
path = path.removeFirstSegments(rootSegmentCount);
|
path = path.removeFirstSegments(rootSegmentCount);
|
||||||
|
|
||||||
@@ -954,7 +970,8 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
// writes the file in the apk.
|
// writes the file in the apk.
|
||||||
jarBuilder.writeFile(resource.getLocation().toFile(), apkPath.toString());
|
jarBuilder.writeFile(resource.getLocation().toFile(), apkPath.toString());
|
||||||
}
|
}
|
||||||
} else if (resource.getType() == IResource.FOLDER) {
|
} else if (resource.getType() == IResource.FOLDER &&
|
||||||
|
checkFolderForPackaging((IFolder)resource)) {
|
||||||
IResource[] members = ((IFolder)resource).members();
|
IResource[] members = ((IFolder)resource).members();
|
||||||
for (IResource member : members) {
|
for (IResource member : members) {
|
||||||
writeNativeLibraries(rootSegmentCount, jarBuilder, member);
|
writeNativeLibraries(rootSegmentCount, jarBuilder, member);
|
||||||
|
|||||||
@@ -271,8 +271,7 @@ public class PreCompilerBuilder extends BaseBuilder {
|
|||||||
// if there was some XML errors, we just return w/o doing
|
// if there was some XML errors, we just return w/o doing
|
||||||
// anything since we've put some markers in the files anyway.
|
// anything since we've put some markers in the files anyway.
|
||||||
if (dv != null && dv.mXmlError) {
|
if (dv != null && dv.mXmlError) {
|
||||||
AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project,
|
AdtPlugin.printErrorToConsole(project, Messages.Xml_Error);
|
||||||
Messages.Xml_Error);
|
|
||||||
|
|
||||||
// This interrupts the build. The next builders will not run.
|
// This interrupts the build. The next builders will not run.
|
||||||
stopBuild(Messages.Xml_Error);
|
stopBuild(Messages.Xml_Error);
|
||||||
|
|||||||
@@ -334,10 +334,12 @@ public class AndroidManifestParser {
|
|||||||
value = getAttributeValue(attributes, ATTRIBUTE_MIN_SDK_VERSION,
|
value = getAttributeValue(attributes, ATTRIBUTE_MIN_SDK_VERSION,
|
||||||
true /* hasNamespace */);
|
true /* hasNamespace */);
|
||||||
|
|
||||||
try {
|
if (value != null) {
|
||||||
mApiLevelRequirement = Integer.parseInt(value);
|
try {
|
||||||
} catch (NumberFormatException e) {
|
mApiLevelRequirement = Integer.parseInt(value);
|
||||||
handleError(e, -1 /* lineNumber */);
|
} catch (NumberFormatException e) {
|
||||||
|
handleError(e, -1 /* lineNumber */);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (NODE_INSTRUMENTATION.equals(localName)) {
|
} else if (NODE_INSTRUMENTATION.equals(localName)) {
|
||||||
processInstrumentationNode(attributes);
|
processInstrumentationNode(attributes);
|
||||||
|
|||||||
@@ -109,17 +109,22 @@ public class XmlErrorHandler extends DefaultHandler {
|
|||||||
mErrorListener.errorFound();
|
mErrorListener.errorFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String message = exception.getMessage();
|
||||||
|
if (message == null) {
|
||||||
|
message = "Unknown error " + exception.getClass().getCanonicalName();
|
||||||
|
}
|
||||||
|
|
||||||
if (mFile != null) {
|
if (mFile != null) {
|
||||||
if (lineNumber != -1) {
|
if (lineNumber != -1) {
|
||||||
BaseProjectHelper.addMarker(mFile,
|
BaseProjectHelper.addMarker(mFile,
|
||||||
AndroidConstants.MARKER_XML,
|
AndroidConstants.MARKER_XML,
|
||||||
exception.getMessage(),
|
message,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
IMarker.SEVERITY_ERROR);
|
IMarker.SEVERITY_ERROR);
|
||||||
} else {
|
} else {
|
||||||
BaseProjectHelper.addMarker(mFile,
|
BaseProjectHelper.addMarker(mFile,
|
||||||
AndroidConstants.MARKER_XML,
|
AndroidConstants.MARKER_XML,
|
||||||
exception.getMessage(),
|
message,
|
||||||
IMarker.SEVERITY_ERROR);
|
IMarker.SEVERITY_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user