-
Notifications
You must be signed in to change notification settings - Fork 64
Doclet Type detection fix + tests #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
effd0da
Fix doclet type detection
Redth 50d123c
Assign DocletType to be readable
Redth 97031e6
Bytecode Tests - Load resource to temp file helper
Redth 675ed94
Bytecode Tests - added doclet type assertion
Redth 60f154e
Bytecode Tests - fix code formatting on old test
Redth 99b4e87
Bytecode Tests - add doclet type resolution tests
Redth 3538b7a
Revert back to DocletType ?? GetDocletType (..)
Redth fde965e
Change DocletType Assertion, invoke GetDocletType
Redth d2d85a3
Bytecode tests - delete temp file in finally
Redth 8301bf6
Bytecode tests - doc type is implicit
Redth 21e82d3
Bytecode tests - remove unnecssary try/catch
Redth f050780
Move GetDocletType to AndroidDocScraper
Redth fef5efe
Bytecode Tests - remove unnecessary try/catch
Redth b975f8e
Fix formatting { got autoformatted to new line
Redth f1b0ba7
class-parse docsType should be null by default
Redth 937297a
Remove DocletType and auto detect always
Redth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,45 @@ public static void LoadXml (String filename) | |
| Log.Error ("Annotations parser error: " + ex); | ||
| } | ||
| } | ||
|
|
||
| public static JavaDocletType GetDocletType (string path) | ||
| { | ||
| var kind = JavaDocletType.DroidDoc; | ||
| char[] buf = new char[500]; | ||
|
|
||
| string packagesHtml = Path.Combine (path, "packages.html"); | ||
| if (File.Exists (packagesHtml) && File.ReadAllText (packagesHtml).Contains ("<body class=\"gc-documentation develop reference api ")) | ||
| kind = JavaDocletType.DroidDoc2; | ||
|
|
||
| string indexHtml = Path.Combine (path, "index.html"); | ||
| if (File.Exists (indexHtml)) | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have some curious formatting settings applied. You have space That's...unexpectedly bizarre. Please place the |
||
| using (var reader = File.OpenText (indexHtml)) | ||
| reader.ReadBlock (buf, 0, buf.Length); | ||
| string rawHTML = new string (buf); | ||
| if (rawHTML.Contains ("Generated by javadoc (build 1.6")) | ||
| kind = JavaDocletType.Java6; | ||
| else if (rawHTML.Contains ("Generated by javadoc (version 1.7")) | ||
| 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 | ||
| if (File.Exists (path)) | ||
| { | ||
| 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; | ||
| } | ||
| } | ||
|
|
||
| public interface IAndroidDocScraper | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good that we updated
class-parseso that it doesn't always setDocletType, but...do we really want to prefer it?I'm not convinced that we do.