Skip to content

[Mono.Android] Replicate automated docs build #8498

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 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<ELFSharpVersion>2.13.1</ELFSharpVersion>
<HumanizerVersion>2.14.1</HumanizerVersion>
<MdocPackageVersion Condition=" '$(MdocPackageVersion)' == '' ">5.8.9.2</MdocPackageVersion>
<MdocPackageVersion Condition=" '$(MdocPackageVersion)' == '' ">5.9.2.4</MdocPackageVersion>
</PropertyGroup>

</Project>
43 changes: 23 additions & 20 deletions src/Mono.Android/Mono.Android.targets
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@
<DocsFxMoniker Condition=" '$(DocsFxMoniker)' == '' ">net-android-$(DocsApiLevel).0</DocsFxMoniker>
<DocsExportOutput Condition=" '$(DocsExportOutput)' == '' ">$(_MonoAndroidNETDefaultOutDir)Mono.Android.xml</DocsExportOutput>
<_LogPrefix>$(MSBuildThisFileDirectory)../../bin/Build$(Configuration)/UpdateApiDocs-$([System.DateTime]::Now.ToString ("yyyyMMddTHHmmss"))</_LogPrefix>
<_Mdoc Condition=" '$(Pkgmdoc)' != '' ">"$(Pkgmdoc)/tools/mdoc.exe"</_Mdoc>
<_Mdoc Condition=" '$(Pkgmdoc)' == '' ">"$(XAPackagesDir)/mdoc/$(MdocPackageVersion)/tools/mdoc.exe"</_Mdoc>
<_Mdoc Condition=" '$(Pkgmdoc)' != '' ">"$(Pkgmdoc)/tools/net471/mdoc.exe"</_Mdoc>
<_Mdoc Condition=" '$(Pkgmdoc)' == '' ">"$(XAPackagesDir)/mdoc/$(MdocPackageVersion)/tools/net471/mdoc.exe"</_Mdoc>
Comment on lines +246 to +247
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tool runs on both Windows & Mac? Will we still require Mono to be installed on Mac?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we'll still have a dependency on mono for this, I was going to look at moving to a .NET version of mdoc once we deprecate the Xamarin.Android API docs.

</PropertyGroup>

<!-- Generate documentation using MDoc -->
Expand Down Expand Up @@ -277,40 +277,43 @@
<Target Name="_RunMdoc">
<PropertyGroup>
<_Libdir>-L "$(DotNetPreviewPath)packs/Microsoft.NETCore.App.Ref"</_Libdir>
<_AssemblyBasename>$(_MonoAndroidNETDefaultOutDir)Mono.Android</_AssemblyBasename>
<_ImportXml>-i "$(_AssemblyBasename).xml"</_ImportXml>
<_Assembly>$(_AssemblyBasename).dll</_Assembly>
<_JIAssembly>$(_MonoAndroidNETDefaultOutDir)Java.Interop.dll</_JIAssembly>
<_Output>-o "$(MSBuildThisFileDirectory)../../external/android-api-docs/docs/Mono.Android/en"</_Output>
<_DocTypeArgs Condition=" '$(DocTypeName)' != '' ">--type=$(DocTypeName)</_DocTypeArgs>
<_RootFxDir>$(BaseIntermediateOutputPath)docs-gen-temp/</_RootFxDir>
<_FxConfig>-fx "$(_RootFxDir)"</_FxConfig>
<_Lang>--lang fsharp</_Lang>
<!-- $(FrameworksXmlContent) describes the docs versions found at android-api-docs/tree/master/docs/Mono.Android/en/FrameworksIndex/
and https://learn.microsoft.com/en-us/dotnet/api/android?view=xamarin-android-sdk-13 -->
<FrameworksXmlContent>
<![CDATA[
<Frameworks>
<Framework Name="$(DocsFxMoniker)" Source="$(DocsFxMoniker)" />
</Frameworks>
]]>
</FrameworksXmlContent>
<_ExtraMdocArgs>-lang docid -lang fsharp --debug --delete</_ExtraMdocArgs>
</PropertyGroup>
<!-- Create a temporary directory which contains frameworks.xml and our framework assembly.
Copy Mono.Android.dll and Java.Interop.dll to the %(Source) path described in frameworks.xml (e.g. net-android-34.0) -->
<ItemGroup>
<_FxAssembly Include="$(_MonoAndroidNETDefaultOutDir)*.dll" />
<_FxAssemblyXml Include="@(_FxAssembly->'%(RelativeDir)%(Filename).xml')" Condition=" Exists('%(RelativeDir)%(Filename).xml') " />
</ItemGroup>
<!-- Create a docs framework directory which contains:
src/Mono.Android/obj/docs-gen-temp
├── frameworks.xml
└── net-android-34.0
├── Java.Interop.dll
├── Java.Interop.xml
├── Mono.Android.Runtime.dll
├── Mono.Android.dll
└── Mono.Android.xml
-->
<RemoveDir Directories="$(_RootFxDir)" />
<MakeDir Directories="$(_RootFxDir)" />
<MakeDir Directories="$(_RootFxDir)$(DocsFxMoniker)" />
<Copy
SourceFiles="$(_Assembly);$(_JIAssembly)"
SourceFiles="@(_FxAssembly);@(_FxAssemblyXml)"
DestinationFolder="$(_RootFxDir)$(DocsFxMoniker)"
/>
<WriteLinesToFile
File="$(_RootFxDir)frameworks.xml"
Lines="$(FrameworksXmlContent)"
/>
<Exec
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) $(_Mdoc) --debug update --use-docid --delete $(_Libdir) $(_ImportXml) $(_Output) $(_DocTypeArgs) $(_FxConfig) $(_Lang)"
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) $(_Mdoc) fx-bootstrap -fx $(_RootFxDir) -importContent true"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
<Exec
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) $(_Mdoc) update $(_Libdir) $(_Output) $(_DocTypeArgs) $(_FxConfig) $(_ExtraMdocArgs)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
</Target>
Expand Down