-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tasks] Support %(JavaSourceJar.DocRootUrl) #6662
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
Conversation
77a7524 to
f0a12f7
Compare
) Context: dotnet/android#6662 The [`@(JavaSourceJar)`][0] Build action supports the following item metadata: <JavaSourceJar Include="javasourcejartest-sources.jar" > <CopyrightFile>$(MSBuildThisFileDirectory)javadoc-copyright.xml</CopyrightFile> <UrlPrefix>https://developer.android.com/reference</UrlPrefix> <UrlStyle>developer.android.com/reference@2020-Nov</UrlStyle> <DocRootUrl>https://developer.android.com</DocRootUrl> </JavaSourceJar> `@(JavaSourceJar)` is used by the Xamarin.Android `<JavaSourceUtils/>` task, which uses all of the item metadata as various option values to `java-source-utils.jar --output-javadoc` (7574f16), resulting in "Javadoc XML", which is subsequently provided to the `<ClassParse/>` MSBuild task, which passes the "Javadoc XML" as a `class-parse --docspath=PATH` option value. `class-parse.exe --docspath=PATH` (eventually) uses `JavaMethodParameterNameProvider.GetDocletType()` to determine the file format of `PATH`, and `GetDocletType()` reads the first 500 bytes of the file to determine if `PATH` is `JavaDocletType._ApiXml` (`<api/>` XML, as produced by `class-parse.exe` & others) or `JavaDocletType.JavaApiParameterNamesXml` (which *isn't* xml, and is produced by `java-source-utils.jar --output-params`). If a `%(JavaSourceJar.CopyrightFile)` file is "large" (> 500 bytes), then `GetDocletType()` won't detect the "Javadoc XML" file as `JavaDocletType._ApiXml`, but instead as `JavaDocletType.DroidDoc` (the default!), which results in (bizarre!) build errors: Task "ClassParse" Task Parameter:ToolPath=C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.pr.gh6662.38\tools Task Parameter:OutputFile=obj\Debug\api.xml.class-parse Task Parameter:SourceJars=javasourcejartest.jar Task Parameter: DocumentationPaths= obj\Debug\javadoc-javasourcejartest-sources-C93909CC4CF9CB39.xml CopyrightFile=…\TestRelease\01-25_05.25.10\temp\JavaSourceJar\javadoc-copyright.xml DocRootUrl=https://developer.android.com Hash=C93909CC4CF9CB39 OriginalItemSpec=javasourcejartest-sources.jar UrlPrefix=https://developer.android.com/reference UrlStyle=developer.android.com/reference@2020-Nov Using: dotnet C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.pr.gh6662.38\tools\class-parse.dll [class-parse] response file: obj\Debug\class-parse.rsp --o="obj\Debug\api.xml.class-parse" --docspath="obj\Debug\javadoc-javasourcejartest-sources-C93909CC4CF9CB39.xml" "javasourcejartest.jar" dotnet C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-ci.pr.gh6662.38\tools\class-parse.dll @obj\Debug\class-parse.rsp Unhandled exception. System.Exception: Directory 'obj\Debug\javadoc-javasourcejartest-sources-C93909CC4CF9CB39.xml' does not exist at Xamarin.Android.Tools.Bytecode.AndroidDocScraper..ctor(String dir, String patternHead, String resetPatternHead, String parameterPairSplitter, Boolean continuousParamLines, String openMethod, String paramSep, String closeMethod, String postCloseMethodParens) at Xamarin.Android.Tools.Bytecode.AndroidDocScraper..ctor(String dir, String patternHead, String resetPatternHead, String parameterPairSplitter, Boolean continuousParamLines) at Xamarin.Android.Tools.Bytecode.DroidDocScraper..ctor(String dir) at Xamarin.Android.Tools.Bytecode.ClassPath.CreateDocScraper(String src) at Xamarin.Android.Tools.Bytecode.ClassPath.FixupParametersFromDocs(XElement api, String path) at Xamarin.Android.Tools.Bytecode.ClassPath.FixupParametersFromDocs(XElement api) at Xamarin.Android.Tools.Bytecode.ClassPath.ToXElement() at Xamarin.Android.Tools.Bytecode.ClassPath.SaveXmlDescription(TextWriter textWriter) at Xamarin.Android.Tools.App.Main(String[] args) Fix the `JavaDocletType._ApiXml` doc type detection in such cases by also checking for the `<javadoc-metadata>` element that is created by `java-source-utils.jar --output-javadoc`. [0]: https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-items#javasourcejar
26168cf to
645d4dc
Compare
jonathanpeppers
left a comment
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.
LGTM
8b9dcbc to
6ca8d73
Compare
6ca8d73 to
c015975
Compare
|
Why does this add These are built and included by: https://github.com/xamarin/xamarin-android/blob/main/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Directory.Build.targets |
I ran the |
|
I don't understand why the Additionally, |
|
The It's doubly concerning that I don't see anything mentioning "Interpreter" in the Artifacts > Test Results - APKs .NET - macOS section. |
My mistake; I thought these
|
|
I'm going to try to address some of the test failure reporting limitations mentioned here with #6681. I think this should be good to go otherwise. |
Context: dotnet/java-interop@13def0e
Bump to dotnet/java-interop@32635fd
Changes: dotnet/java-interop@d3f0c5c...32635fd
Adds
%(DocRootUrl)to the set of metadata that is supported by@(JavaSourceJar)items. Fixes processing of%(JavadocUrlPrefix)and%(JavadocUrlStyle)metadata values.The
<_BuildAndroidJavadocXml/>target has also been updated to use thenew
--doc-root-urlparameter supported byjava-source-utils.jar.