am 16f46fdf: Adjust jdiff to be able to read both Doclava and "regular" Jdiff API xml files.
* commit '16f46fdf56b5a04e19689969aeaffb58efeb5d92':
Adjust jdiff to be able to read both Doclava and "regular" Jdiff API xml files.
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..74b8b60
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.android.internal.BuildUtils
+
+apply plugin: 'java'
+
+sourceSets {
+ main {
+ java.srcDirs = ['src']
+ }
+}
+
+dependencies {
+ compile files(BuildUtils.findToolsJar(project))
+}
diff --git a/build.xml b/build.xml
index 3dd9657..458b40d 100755
--- a/build.xml
+++ b/build.xml
@@ -4,7 +4,6 @@
<description>
Builds Android's jdiff.jar and places it in device/extlibs/jdiff-1.1.0/.
</description>
-
<target name="init" description="Properties used by other targets">
<property name="extlibs.dir" value="${basedir}/../../extlibs/jdiff-1.1.0/" />
@@ -13,9 +12,6 @@
<property name="classes.dir" value="${build.dir}/classes" />
<property name="lib.dir" value="${build.dir}/lib" />
<property name="version" value="1.1.0" />
- <path id="class.path">
- <pathelement location="{basedir}/../../extlibs/xerces.jar" />
- </path>
<property name="debug" value="true" />
<property name="JDIFF_HOME" value="${extlibs.dir}" />
</target>
@@ -39,17 +35,15 @@
destdir="${classes.dir}"
debug="${debug}"
excludes="jdiff/JDiffAntTask.java"
- includeJavaRuntime="yes">
- <classpath>
- <path refid="class.path" />
- </classpath>
-<!--<compilerarg value="-Xlint:unchecked"/> -->
+ fork="true"
+ includeJavaRuntime="false"
+ includeAntRuntime="yes">
</javac>
-</target>
+</target>
<!-- Place the jdiff.jar file in <branch-root>/device/extlibs/jdiff-.1.0/ (under version control) -->
- <target name="jar" depends="compile">
- <jar jarfile="${basedir}/jdiff.jar"
+<target name="jar" depends="compile">
+ <jar jarfile="${basedir}/jdiff.jar"
basedir="${classes.dir}"
includes="*jdiff/*.class"
excludes="*jdiff/JDiffAntTask*.class" />
diff --git a/src/jdiff/Comments.java b/src/jdiff/Comments.java
index 066e4f0..b732596 100755
--- a/src/jdiff/Comments.java
+++ b/src/jdiff/Comments.java
@@ -2,6 +2,7 @@
import java.io.*;
import java.util.*;
+import javax.xml.parsers.ParserConfigurationException;
/* For SAX XML parsing */
import org.xml.sax.Attributes;
@@ -60,18 +61,15 @@
DefaultHandler handler = new CommentsHandler(oldComments_);
XMLReader parser = null;
try {
- String parserName = System.getProperty("org.xml.sax.driver");
- if (parserName == null) {
- parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
- } else {
- // Let the underlying mechanisms try to work out which
- // class to instantiate
- parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
- }
+ parser = javax.xml.parsers.SAXParserFactory.newInstance().newSAXParser().getXMLReader();
} catch (SAXException saxe) {
System.out.println("SAXException: " + saxe);
saxe.printStackTrace();
System.exit(1);
+ } catch (ParserConfigurationException pce) {
+ System.out.println("ParserConfigurationException: " + pce);
+ pce.printStackTrace();
+ System.exit(1);
}
if (XMLToAPI.validateXML) {
diff --git a/src/jdiff/XMLToAPI.java b/src/jdiff/XMLToAPI.java
index c2a3791..a7fe33a 100755
--- a/src/jdiff/XMLToAPI.java
+++ b/src/jdiff/XMLToAPI.java
@@ -2,6 +2,7 @@
import java.io.*;
import java.util.*;
+import javax.xml.parsers.ParserConfigurationException;
/* For SAX parsing in APIHandler */
import org.xml.sax.Attributes;
@@ -47,19 +48,17 @@
XMLReader parser = null;
DefaultHandler handler = new APIHandler(api_, createGlobalComments);
try {
- String parserName = System.getProperty("org.xml.sax.driver");
- if (parserName == null) {
- parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
- } else {
- // Let the underlying mechanisms try to work out which
- // class to instantiate
- parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
- }
+ parser = javax.xml.parsers.SAXParserFactory.newInstance().newSAXParser().getXMLReader();
} catch (SAXException saxe) {
System.out.println("SAXException: " + saxe);
saxe.printStackTrace();
System.exit(1);
+ } catch (ParserConfigurationException pce) {
+ System.out.println("ParserConfigurationException: " + pce);
+ pce.printStackTrace();
+ System.exit(1);
}
+
if (validateXML) {
parser.setFeature("http://xml.org/sax/features/namespaces", true);
parser.setFeature("http://xml.org/sax/features/validation", true);
diff --git a/xerces.jar b/xerces.jar
deleted file mode 100644
index 8f762e1..0000000
--- a/xerces.jar
+++ /dev/null
Binary files differ