Skip to content

Commit

Permalink
[Mono.Android] Add target to build additional API levels
Browse files Browse the repository at this point in the history
Commit e4a75a8 removed some make magic that ensured Mono.Android.dll
would be built multiple times for additional supported API levels.

A couple of MSBuild tasks used to build multiple versions of
Mono.Android.dll have been moved out of the `PackDotNet` target used by
the Windows build and into the Mono.Android build to fix this.
  • Loading branch information
pjcollins committed Dec 9, 2024
1 parent b124132 commit c1d3e8e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
11 changes: 0 additions & 11 deletions build-tools/scripts/DotNet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@
</Target>

<Target Name="PackDotNet">
<!-- Build extra versions of Mono.Android.dll if necessary -->
<MSBuild
Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' != '$(AndroidLatestStableApiLevel)' "
Projects="$(_Root)src\Mono.Android\Mono.Android.csproj"
Properties="TargetFramework=$(DotNetTargetFramework);AndroidApiLevel=$(AndroidDefaultTargetDotnetApiLevel);AndroidPlatformId=$(AndroidDefaultTargetDotnetApiLevel);DisableApiCompatibilityCheck=true"
/>
<MSBuild
Condition=" '$(AndroidLatestUnstableApiLevel)' != '$(AndroidLatestStableApiLevel)' "
Projects="$(_Root)src\Mono.Android\Mono.Android.csproj"
Properties="TargetFramework=$(DotNetTargetFramework);AndroidApiLevel=$(AndroidLatestUnstableApiLevel);AndroidPlatformId=$(AndroidLatestUnstablePlatformId);DisableApiCompatibilityCheck=true"
/>
<MSBuild Projects="$(_Root)build-tools\create-packs\Microsoft.Android.Sdk.proj" Targets="CreateAllPacks" />
<MSBuild Projects="$(_Root)build-tools\create-packs\Microsoft.Android.Sdk.proj" Targets="ExtractWorkloadPacks" />
<!-- Clean up old, previously restored packages -->
Expand Down
1 change: 1 addition & 0 deletions src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@
<PropertyGroup Condition=" '$(AndroidApiLevel)' &gt;= '$(AndroidDefaultTargetDotnetApiLevel)' ">
<BuildDependsOn>
$(BuildDependsOn);
_BuildAdditionalApiLevels;
_ExportMsxDoc;
_CopyToPackDirs;
</BuildDependsOn>
Expand Down
13 changes: 13 additions & 0 deletions src/Mono.Android/Mono.Android.targets
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@
</ItemGroup>
</Target>

<!-- Build Mono.Android.dll for additional API levels if necessary -->
<Target Name="_BuildAdditionalApiLevels">
<MSBuild
Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' != '$(AndroidLatestStableApiLevel)' "
Projects="$(XamarinAndroidSourcePath)src\Mono.Android\Mono.Android.csproj"
Properties="AndroidApiLevel=$(AndroidDefaultTargetDotnetApiLevel);AndroidPlatformId=$(AndroidDefaultTargetDotnetApiLevel)"
/>
<MSBuild
Condition=" '$(AndroidLatestUnstableApiLevel)' != '$(AndroidLatestStableApiLevel)' "
Projects="$(XamarinAndroidSourcePath)src\Mono.Android\Mono.Android.csproj"
Properties="AndroidApiLevel=$(AndroidLatestUnstableApiLevel);AndroidPlatformId=$(AndroidLatestUnstablePlatformId)"
/>
</Target>

<PropertyGroup>
<!-- Override these properties to generate docs against a specific API level -->
Expand Down

0 comments on commit c1d3e8e

Please sign in to comment.