Skip to content
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

[Mono.Android] Add UpdateExternalDocumentation target #5485

Merged
merged 4 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<PropertyGroup>
<IncludeAndroidJavadoc Condition=" '$(IncludeAndroidJavadoc)' == '' And '$(CONVERT_JAVADOC_TO_XMLDOC)' == 'true' And '$(AndroidFrameworkVersion)' == '$(AndroidLatestStableFrameworkVersion)'">True</IncludeAndroidJavadoc>
<AndroidJavadocVerbosity Condition=" '$(AndroidJavadocVerbosity)' == '' ">intellisense</AndroidJavadocVerbosity>
<AndroidJavadocVerbosity Condition=" '$(AndroidJavadocVerbosity)' == '' ">intellisense+extraremarks</AndroidJavadocVerbosity>
</PropertyGroup>

<PropertyGroup Condition=" '$(IncludeAndroidJavadoc)' == 'True' ">
Expand Down
43 changes: 42 additions & 1 deletion src/Mono.Android/Mono.Android.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
<ItemGroup>
<Compile Include="$(IntermediateOutputPath)AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="mdoc"
PackageVersion="5.8.0"
GeneratePathProperty="True"
ReferenceOutputAssembly="False"
SkipGetTargetFrameworkProperties="True"
/>
</ItemGroup>
<Target Name="_BuildJavaInterop"
BeforeTargets="BeforeResolveReferences"
Condition=" '$(TargetFramework)' == 'monoandroid10' "
Expand Down Expand Up @@ -157,7 +165,7 @@
<_TypeMap>--type-map-report=$(IntermediateOutputPath)mcw\type-mapping.txt</_TypeMap>
<_Api>$(IntermediateOutputPath)mcw\api.xml</_Api>
<_Dirs>--enumdir=$(IntermediateOutputPath)mcw</_Dirs>
<_WithJavadocXml Condition=" '$(IncludeAndroidJavadoc)' == 'True' ">--doc-comment-verbosity=$(AndroidJavadocVerbosity) "--with-javadoc-xml=$(_AndroidJavadocXml)"</_WithJavadocXml>
<_WithJavadocXml Condition=" '$(IncludeAndroidJavadoc)' == 'True' ">"--doc-comment-verbosity=$(AndroidJavadocVerbosity)" "--with-javadoc-xml=$(_AndroidJavadocXml)"</_WithJavadocXml>
<_FullIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)'))</_FullIntermediateOutputPath>
<_LangFeatures>--lang-features=nullable-reference-types</_LangFeatures>
<_LangFeatures Condition="$(AndroidApiLevel) &gt;= 30">$(_LangFeatures),default-interface-methods,nested-interface-types,interface-constants</_LangFeatures>
Expand Down Expand Up @@ -260,4 +268,37 @@
<FileWrites Include="$(IntermediateOutputPath)CheckApiCompatibility.stamp" />
</ItemGroup>
</Target>

<Target Name="UpdateExternalDocumentation">
<MSBuild Projects="$(MSBuildThisFileDirectory)Mono.Android.csproj"
Properties="TargetFramework=monoandroid10"
Targets="_UpdateExternalDocumentation"
/>
</Target>
<Target Name="_UpdateExternalDocumentation">
<Exec
Command="git clean -xdf obj"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
pjcollins marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<_Binlog>UpdateExternalDocumentation-$([System.DateTime]::Now.ToString ("yyyyMMddTHHmmss")).binlog</_Binlog>
</PropertyGroup>
<Exec
Copy link
Member Author

Choose a reason for hiding this comment

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

@pjcollins: any reason to treat macOS & Windows differently here? Why not use <MSBuild/> for both?

Copy link
Member

Choose a reason for hiding this comment

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

I mentioned this briefly in the comment above -- using Exec over MSBuild allows us to automatically capture a binlog for each Mono.Android build, I can move it to use MSBuild for both if we want though

Command="msbuild /restore /p:IncludeAndroidJavadoc=True /bl:$(_Binlog)"
IgnoreStandardErrorWarningFormat="True"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
Copy link
Member

Choose a reason for hiding this comment

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

Could this use <MSBuild/>? or does it actually need to run in a new process?

Copy link
Member

@pjcollins pjcollins May 12, 2021

Choose a reason for hiding this comment

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

I think the intent here was to make sure we always capture a unique binlog from the output. I've kept this for non windows platforms, but updated this target to use <MSBuild/> on Windows so that it can be run there if desired.

<PropertyGroup>
<_Mdoc Condition=" '$(Pkgmdoc)' != '' ">"$(Pkgmdoc)/tools/mdoc.exe"</_Mdoc>
jonpryor marked this conversation as resolved.
Show resolved Hide resolved
<_Libdir>-L "$(OutputPath)../v1.0"</_Libdir>
<_AssemblyBasename>$(OutputPath)Mono.Android</_AssemblyBasename>
<_ImportXml>-i "$(_AssemblyBasename).xml"</_ImportXml>
<_Assembly>"$(_AssemblyBasename).dll"</_Assembly>
<_Output>-o "$(MSBuildThisFileDirectory)../../external/android-api-docs/docs/Mono.Android/en"</_Output>
</PropertyGroup>
<Exec
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) $(_Mdoc) --debug update --use-docid --delete $(_Libdir) $(_ImportXml) $(_Output) $(_Assembly)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
</Target>
</Project>