Skip to content

Commit

Permalink
[Xamarin.Android.Tools.Bytecode] Detect api.xml format doc files (#188)
Browse files Browse the repository at this point in the history
Originally when `JavaDocletType._ApiXml` was added, I forgot to put
some logic in the method which determines what kind of doclet type to
use from the file path itself, which this addresses.
  • Loading branch information
Redth authored and jonpryor committed Oct 4, 2017
1 parent 79a8e1e commit 4d6c5a9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Xamarin.Android.Tools.Bytecode/ClassPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,16 @@ JavaDocletType GetDocletType (string path)
kind = JavaDocletType.Java7;
else if (rawHTML.Contains ("Generated by javadoc (1.8"))
kind = JavaDocletType.Java8;

// Check to see if it's an api.xml formatted doc
string rawXML = null;
using (var reader = File.OpenText (path)) {
int len = reader.ReadBlock (buf, 0, buf.Length);
rawXML = new string (buf, 0, len);
}
if (rawXML.Contains ("<api>") && rawXML.Contains ("<package"))
kind = JavaDocletType._ApiXml;

return kind;
}

Expand Down

0 comments on commit 4d6c5a9

Please sign in to comment.