Skip to content

Commit

Permalink
[One .NET] add "preview" packs for API 32 (#6491)
Browse files Browse the repository at this point in the history
Fixes: #6176
Fixes: #6501

After some discussion with Daniel Plaisted, we think the best approach
for setting up API 31 packs is to have multiple packs:

* `Microsoft.Android.31.Ref`
* `Microsoft.Android.31.Runtime.[RID]`
* `Microsoft.Android.32.Ref`
* `Microsoft.Android.32.Runtime.[RID]`

We can check `$(TargetPlatformVersion)` to decide which pack to
list in `@(KnownFrameworkReference)` during builds.

These will all be versioned to match all other Android workload packs.
We'll continue to use `**FromWorkload**` to define their versions in
MSBuild.

I created a `android-32` workload, that installs additional API 32
packs. However, this workload doesn't necessarily need to exist as
targeting and runtime packs can also be resolved from NuGet.org. It is
nice to install `android-32` -- from then on builds will work offline.

One problem I hit was the need for `AndroidApiInfo.xml` for all
supported API levels. I moved these files to the
`Microsoft.Android.Sdk.[Platform]` packs, so I could include both 31
and 32 `AndroidApiInfo.xml` files.

All these changes I tried to do in a way where they are based on the
following new properties in `Configuration.props`:

    <AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">32</AndroidLatestUnstableApiLevel>
    <AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">Sv2</AndroidLatestUnstablePlatformId>
    <AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v12.0.99</AndroidLatestUnstableFrameworkVersion>
    <BuildDotNetPreviewApiLevel Condition=" '$(BuildDotNetPreviewApiLevel)' == '' And '$(AndroidLatestStableApiLevel)' != '$(AndroidLatestUnstableApiLevel)' ">true</BuildDotNetPreviewApiLevel>

Going forward, we should be able to just update these numbers. The
only decision we'll need to make is what to do about packs.

In the future, if API 32 is "stable" but is not the default:

1. We don't have to keep building & shipping API 31. We can hardcode
   the version for stable `Microsoft.Android.31.Ref/Runtime` packages
   on NuGet.org.

2. Users will have to opt into `net6.0-android32`.

In the future, if API 32 is "stable" and we can just make it default:

2. We get rid of `Microsoft.Android.31.Ref/Runtime` packages
   completely, and `net6.0-android` is `net6.0-android32` by default.
  • Loading branch information
jonathanpeppers committed Nov 30, 2021
1 parent 94e21c7 commit daa5254
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 70 deletions.
6 changes: 5 additions & 1 deletion Configuration.props
Expand Up @@ -33,6 +33,10 @@
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">31</AndroidLatestStableApiLevel>
<AndroidLatestStablePlatformId Condition="'$(AndroidLatestStablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestStablePlatformId>
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v12.0</AndroidLatestStableFrameworkVersion>
<!-- *Latest* *unstable* API level binding that we support; this can be the same as *stable* -->
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">32</AndroidLatestUnstableApiLevel>
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">Sv2</AndroidLatestUnstablePlatformId>
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v12.0.99</AndroidLatestUnstableFrameworkVersion>
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidApiLevel>
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>
Expand All @@ -52,7 +56,7 @@
<AutoProvisionUsesSudo Condition=" '$(AutoProvisionUsesSudo)' == '' ">False</AutoProvisionUsesSudo>
<_XABinRelativeInstallPrefix>lib\xamarin.android</_XABinRelativeInstallPrefix>
<XAInstallPrefix Condition=" '$(XAInstallPrefix)' == '' ">$(MSBuildThisFileDirectory)bin\$(Configuration)\$(_XABinRelativeInstallPrefix)\</XAInstallPrefix>
<_MonoAndroidNETOutputDir>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0\</_MonoAndroidNETOutputDir>
<_MonoAndroidNETOutputDir>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidApiLevel)\</_MonoAndroidNETOutputDir>
<MingwDependenciesRootDirectory Condition=" '$(MingwDependenciesRootDirectory)' == '' ">$(MSBuildThisFileDirectory)\bin\Build$(Configuration)\mingw-deps</MingwDependenciesRootDirectory>
<HostCc Condition=" '$(HostCc)' == '' ">$(HostCc64)</HostCc>
<HostCxx Condition=" '$(HostCxx)' == '' ">$(HostCxx64)</HostCxx>
Expand Down
Expand Up @@ -14,10 +14,10 @@ namespace Xamarin.Android.Tools.BootstrapTasks
public class GenerateSupportedPlatforms : Task
{
/// <summary>
/// A list of AndroidApiInfo.xml files produced by Mono.Android.targets
/// @(AndroidApiInfo) from .\bin\Build$(Configuration)\Mono.Android.Apis.projitems
/// </summary>
[Required]
public string [] AndroidApiInfo { get; set; }
public ITaskItem [] AndroidApiInfo { get; set; }

/// <summary>
/// The output file to generate
Expand All @@ -33,13 +33,7 @@ public class GenerateSupportedPlatforms : Task

public override bool Execute ()
{
if (AndroidApiInfo.Length == 0) {
Log.LogError ("This task requires at least one AndroidApiInfo.xml file!");
return false;
}

var versions = new AndroidVersions (
AndroidApiInfo.Select (d => Path.GetDirectoryName (d)));
var versions = new AndroidVersions (AndroidApiInfo.Select (ToVersion));
var settings = new XmlWriterSettings {
OmitXmlDeclaration = true,
Indent = true,
Expand Down Expand Up @@ -71,11 +65,13 @@ public override bool Execute ()
writer.WriteEndElement (); // </PropertyGroup>

writer.WriteStartElement ("ItemGroup");
foreach (AndroidVersion version in versions.InstalledBindingVersions
foreach (int apiLevel in versions.InstalledBindingVersions
.Where (v => v.ApiLevel >= MinimumApiLevel)
.OrderBy (v => v.ApiLevel)) {
.Select (v => v.ApiLevel)
.Distinct ()
.OrderBy (v => v)) {
writer.WriteStartElement ("AndroidSdkSupportedTargetPlatformVersion");
writer.WriteAttributeString ("Include", version.ApiLevel.ToString ("0.0", CultureInfo.InvariantCulture));
writer.WriteAttributeString ("Include", apiLevel.ToString ("0.0", CultureInfo.InvariantCulture));
writer.WriteEndElement (); // </AndroidSdkSupportedTargetPlatformVersion>
}
writer.WriteStartElement ("SdkSupportedTargetPlatformVersion");
Expand All @@ -86,5 +82,22 @@ public override bool Execute ()

return !Log.HasLoggedErrors;
}

static AndroidVersion ToVersion (ITaskItem item)
{
/*
<AndroidApiInfo Include="v12.0.99">
<Name>Sv2</Name>
<Level>32</Level>
<Id>Sv2</Id>
<Stable>False</Stable>
</AndroidApiInfo>
*/

int.TryParse (item.GetMetadata ("Level"), out int apiLevel);
bool.TryParse (item.GetMetadata ("Stable"), out bool stable);

return new AndroidVersion (apiLevel, item.ItemSpec.TrimStart ('v'), item.GetMetadata ("Name"), item.GetMetadata ("Id"), stable);
}
}
}
21 changes: 18 additions & 3 deletions build-tools/create-packs/Directory.Build.targets
Expand Up @@ -52,9 +52,21 @@
</ItemGroup>
</Target>

<Target Name="CreateAllPacks"
DependsOnTargets="DeleteExtractedWorkloadPacks;_SetGlobalProperties;GetXAVersionInfo">
<Target Name="_CleanNuGetDirectory">
<RemoveDir Directories="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned" />
</Target>

<Target Name="_CreatePreviewPacks"
Condition=" '$(AndroidLatestStableApiLevel)' != '$(AndroidLatestUnstableApiLevel)' and Exists('$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidLatestUnstableApiLevel)\Mono.Android.dll') ">
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidApiLevel=$(AndroidLatestUnstableApiLevel) -p:AndroidRID=android-arm -p:AndroidABI=armeabi-v7a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidApiLevel=$(AndroidLatestUnstableApiLevel) -p:AndroidRID=android-arm64 -p:AndroidABI=arm64-v8a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidApiLevel=$(AndroidLatestUnstableApiLevel) -p:AndroidRID=android-x86 -p:AndroidABI=x86-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidApiLevel=$(AndroidLatestUnstableApiLevel) -p:AndroidRID=android-x64 -p:AndroidABI=x86_64-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidApiLevel=$(AndroidLatestUnstableApiLevel) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
</Target>

<Target Name="CreateAllPacks"
DependsOnTargets="DeleteExtractedWorkloadPacks;_SetGlobalProperties;GetXAVersionInfo;_CleanNuGetDirectory;_CreatePreviewPacks">
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm -p:AndroidABI=armeabi-v7a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidRID=android-arm64 -p:AndroidABI=arm64-v8a-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack @(_GlobalProperties, ' ') -p:AndroidRID=android-x86 -p:AndroidABI=x86-net6 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
Expand Down Expand Up @@ -107,13 +119,16 @@
</PropertyGroup>
<ItemGroup>
<_NuGetSources Include="$(OutputPath.TrimEnd('\'))" />
<_PreviewPacks Condition=" '$(AndroidLatestStableApiLevel)' != '$(AndroidLatestUnstableApiLevel)' " Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\*$(AndroidLatestUnstableApiLevel)*.nupkg" />
<_InstallArguments Include="android-aot" />
<_InstallArguments Include="android-$(AndroidLatestUnstableApiLevel)" Condition=" '@(_PreviewPacks->Count())' != '0' " />
<_InstallArguments Include="--skip-manifest-update" />
<_InstallArguments Include="--verbosity diag" />
<_InstallArguments Include="--source &quot;%(_NuGetSources.Identity)&quot;" />
<_InstallArguments Include="--temp-dir &quot;$(_TempDirectory)&quot;" />
</ItemGroup>
<MakeDir Directories="$(_TempDirectory)" />
<Exec Command="&quot;$(DotNetPreviewTool)&quot; workload install android-aot @(_InstallArguments, ' ')" WorkingDirectory="$(_TempDirectory)" />
<Exec Command="&quot;$(DotNetPreviewTool)&quot; workload install @(_InstallArguments, ' ')" WorkingDirectory="$(_TempDirectory)" />
<RemoveDir Directories="$(_TempDirectory)" />
</Target>

Expand Down
10 changes: 5 additions & 5 deletions build-tools/create-packs/Microsoft.Android.Ref.proj
Expand Up @@ -2,16 +2,16 @@
***********************************************************************************************
Microsoft.Android.Ref.proj
This project file is used to create the Microsoft.Android.Ref NuGet, which is the
This project file is used to create the Microsoft.Android.[API].Ref NuGet, which is the
targeting pack containing reference assemblies and other compile time assets required
by projects that use the Microsoft.Android framework in .NET 5.
***********************************************************************************************
-->
<Project Sdk="Microsoft.Build.NoTargets">

<PropertyGroup>
<PackageId>Microsoft.Android.Ref</PackageId>
<Description>Microsoft.Android reference assemblies. Please do not reference directly.</Description>
<PackageId>Microsoft.Android.$(AndroidApiLevel).Ref</PackageId>
<Description>Microsoft.Android reference assemblies for API $(AndroidApiLevel). Please do not reference directly.</Description>
<_AndroidRefPackAssemblyPath>ref\net6.0</_AndroidRefPackAssemblyPath>
</PropertyGroup>

Expand All @@ -33,7 +33,8 @@ by projects that use the Microsoft.Android framework in .NET 5.
<ItemGroup>
<_AndroidRefPackAssemblies Include="$(JavaInteropSourceDirectory)\bin\$(Configuration)-net6.0\ref\Java.Interop.dll" />
<_AndroidRefPackAssemblies Include="$(_MonoAndroidNETOutputDir)ref\Mono.Android.dll" />
<_AndroidRefPackAssemblies Include="$(_MonoAndroidNETOutputDir)ref\Mono.Android.Export.dll" />
<!-- Always include stable Mono.Android.Export.dll -->
<_AndroidRefPackAssemblies Include="$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidLatestStableApiLevel)\ref\Mono.Android.Export.dll" />
<FrameworkListFileClass Include="@(_AndroidRefPackAssemblies->'%(Filename)%(Extension)')" Profile="Android" />
</ItemGroup>

Expand All @@ -43,7 +44,6 @@ by projects that use the Microsoft.Android framework in .NET 5.
<_PackageFiles Include="$(_MonoAndroidNETOutputDir)Mono.Android.xml" PackagePath="$(_AndroidRefPackAssemblyPath)" />
<_PackageFiles Include="$(_MonoAndroidNETOutputDir)mono.android.jar" PackagePath="$(_AndroidRefPackAssemblyPath)" />
<_PackageFiles Include="$(_MonoAndroidNETOutputDir)mono.android.dex" PackagePath="$(_AndroidRefPackAssemblyPath)" />
<_PackageFiles Include="$(_MonoAndroidNETOutputDir)AndroidApiInfo.xml" PackagePath="$(_AndroidRefPackAssemblyPath)" />
</ItemGroup>
</Target>

Expand Down
11 changes: 6 additions & 5 deletions build-tools/create-packs/Microsoft.Android.Runtime.proj
Expand Up @@ -2,7 +2,7 @@
***********************************************************************************************
Microsoft.Android.Runtime.proj
This project file is used to create Microsoft.Android.Runtime NuGets, which are
This project file is used to create Microsoft.Android.[API].Runtime NuGets, which are
runtime packs that contain the assets required for a self-contained publish of
projects that use the Microsoft.Android framework in .NET 5.
***********************************************************************************************
Expand All @@ -12,8 +12,8 @@ projects that use the Microsoft.Android framework in .NET 5.
<PropertyGroup>
<AndroidRID Condition=" '$(AndroidRID)' == '' ">android-arm64</AndroidRID>
<AndroidABI Condition=" '$(AndroidABI)' == '' ">arm64-v8a-net6</AndroidABI>
<PackageId>Microsoft.Android.Runtime.$(AndroidRID)</PackageId>
<Description>Microsoft.Android runtime components. Please do not reference directly.</Description>
<PackageId>Microsoft.Android.$(AndroidApiLevel).Runtime.$(AndroidRID)</PackageId>
<Description>Microsoft.Android runtime components for API $(AndroidApiLevel). Please do not reference directly.</Description>
<_AndroidRuntimePackAssemblyPath>runtimes\$(AndroidRID)\lib\net6.0</_AndroidRuntimePackAssemblyPath>
<_AndroidRuntimePackNativePath>runtimes\$(AndroidRID)\native</_AndroidRuntimePackNativePath>
</PropertyGroup>
Expand All @@ -34,9 +34,10 @@ projects that use the Microsoft.Android framework in .NET 5.
</PropertyGroup>

<ItemGroup>
<_AndroidRuntimePackAssemblies Include="$(_MonoAndroidNETOutputDir)Java.Interop.dll" />
<_AndroidRuntimePackAssemblies Include="$(JavaInteropSourceDirectory)\bin\$(Configuration)-net6.0\Java.Interop.dll" />
<_AndroidRuntimePackAssemblies Include="$(_MonoAndroidNETOutputDir)Mono.Android.dll" />
<_AndroidRuntimePackAssemblies Include="$(_MonoAndroidNETOutputDir)Mono.Android.Export.dll" />
<!-- Always include stable Mono.Android.Export.dll -->
<_AndroidRuntimePackAssemblies Include="$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidLatestStableApiLevel)\Mono.Android.Export.dll" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libmono-android.debug.so" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libmono-android.release.so" />
<_AndroidRuntimePackAssets Include="$(XAInstallPrefix)xbuild\Xamarin\Android\lib\$(AndroidABI)\libxamarin-debug-app-helper.so" />
Expand Down
9 changes: 7 additions & 2 deletions build-tools/create-packs/Microsoft.Android.Sdk.proj
Expand Up @@ -62,6 +62,8 @@ core workload SDK packs imported by WorkloadManifest.targets.
/>

<ItemGroup>
<_AndroidApiInfo Include="$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidLatestStableApiLevel)\AndroidApiInfo.xml" />
<_AndroidApiInfo Include="$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidLatestUnstableApiLevel)\AndroidApiInfo.xml" Condition="Exists('$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\net6.0-android$(AndroidLatestUnstableApiLevel)\AndroidApiInfo.xml')" />
<!-- Microsoft.Android.Sdk.ILLink output -->
<_PackageFiles Include="$(XAInstallPrefix)xbuild\Xamarin\Android\Microsoft.Android.Sdk.ILLink.dll" PackagePath="tools" />
<_PackageFiles Include="$(XAInstallPrefix)xbuild\Xamarin\Android\Microsoft.Android.Sdk.ILLink.pdb" PackagePath="tools" />
Expand All @@ -78,6 +80,7 @@ core workload SDK packs imported by WorkloadManifest.targets.
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Microsoft.Android.Sdk.ILLink\PreserveLists\**" PackagePath="PreserveLists" />
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\targets\**" PackagePath="targets" />
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\dotnet.aotprofile" PackagePath="targets" />
<_PackageFiles Include="@(_AndroidApiInfo)" DirectoryName="$([System.IO.Path]::GetDirectoryName ('%(Identity)'))" PackagePath="data\$([System.IO.Path]::GetFileName ('%(_PackageFiles.DirectoryName)'))" />
<_PackageFiles Include="$(IntermediateOutputPath)UnixFilePermissions.xml" PackagePath="data" Condition=" '$(HostOS)' != 'Windows' " />
<None Include="$(MSBuildThisFileDirectory)SignList.xml" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
Expand Down Expand Up @@ -112,6 +115,8 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<PropertyGroup>
<AndroidNETSdkVersion>$(AndroidPackVersionLong)</AndroidNETSdkVersion>
<XamarinAndroidVersion>$(AndroidPackVersionLong)</XamarinAndroidVersion>
<_AndroidRuntimePackId Condition=" '%24(TargetPlatformVersion)' != '$(AndroidLatestUnstableApiLevel).0' ">$(AndroidLatestStableApiLevel)</_AndroidRuntimePackId>
<_AndroidRuntimePackId Condition=" '%24(TargetPlatformVersion)' == '$(AndroidLatestUnstableApiLevel).0' ">$(AndroidLatestUnstableApiLevel)</_AndroidRuntimePackId>
</PropertyGroup>
<ItemGroup>
<KnownFrameworkReference
Expand All @@ -120,9 +125,9 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
RuntimeFrameworkName="Microsoft.Android"
DefaultRuntimeFrameworkVersion="**FromWorkload**"
LatestRuntimeFrameworkVersion="**FromWorkload**"
TargetingPackName="Microsoft.Android.Ref"
TargetingPackName="Microsoft.Android.%24(_AndroidRuntimePackId).Ref"
TargetingPackVersion="**FromWorkload**"
RuntimePackNamePatterns="Microsoft.Android.Runtime.**RID**"
RuntimePackNamePatterns="Microsoft.Android.%24(_AndroidRuntimePackId).Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@(_AndroidNETAppRuntimePackRids, '%3B')"
Profile="Android"
/>
Expand Down
13 changes: 13 additions & 0 deletions build-tools/scripts/DotNet.targets
Expand Up @@ -61,4 +61,17 @@
<Exec Command="&quot;$(DotNetPreviewTool)&quot; workload install maui-android @(_InstallArguments, ' ')" WorkingDirectory="$(_TempDirectory)" />
<RemoveDir Directories="$(_TempDirectory)" />
</Target>
<Target Name="BuildDotNetPreviewApiLevel">
<ItemGroup>
<_DotNetPreviewProperties Include="TargetFramework=net6.0" />
<_DotNetPreviewProperties Include="AndroidApiLevel=$(AndroidLatestUnstableApiLevel)" />
<_DotNetPreviewProperties Include="AndroidPlatformId=$(AndroidLatestUnstablePlatformId)" />
<_DotNetPreviewProperties Include="AndroidFrameworkVersion=$(AndroidLatestUnstableFrameworkVersion)" />
<_DotNetPreviewProperties Include="AndroidPreviousFrameworkVersion=$(AndroidLatestStableFrameworkVersion)" />
</ItemGroup>
<MSBuild
Projects="$(XamarinAndroidSourcePath)src\Mono.Android\Mono.Android.csproj"
Properties="@(_DotNetPreviewProperties)"
/>
</Target>
</Project>
21 changes: 11 additions & 10 deletions src/Mono.Android.Export/Mono.Android.Export.csproj
@@ -1,29 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Import Project="..\..\Configuration.props" />

<PropertyGroup>
<!-- Only build for net6.0 for $(AndroidLatestStableFrameworkVersion) -->
<TargetFrameworks Condition=" '$(AndroidFrameworkVersion)' != '$(AndroidLatestStableFrameworkVersion)' ">monoandroid10</TargetFrameworks>
<TargetFrameworks Condition=" '$(AndroidFrameworkVersion)' == '$(AndroidLatestStableFrameworkVersion)' ">monoandroid10;net6.0</TargetFrameworks>
<TargetFrameworks>monoandroid10;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<NoStdLib>true</NoStdLib>
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'monoandroid10' ">
<TargetFrameworkIdentifier>MonoAndroid</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<TargetFrameworkRootPath>$(XAInstallPrefix)xbuild-frameworks</TargetFrameworkRootPath>
<OutputPath>$(XAInstallPrefix)xbuild-frameworks\MonoAndroid\$(AndroidFrameworkVersion)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<OutputPath>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\</OutputPath>
<OutputPath>$(_MonoAndroidNETOutputDir)</OutputPath>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'monoandroid10' ">
Expand Down Expand Up @@ -53,12 +52,14 @@
</Reference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<ProjectReference Include="..\..\external\Java.Interop\src\Java.Interop\Java.Interop.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Mono.Android\Mono.Android.csproj" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- Only build the 'net6.0' version of 'Mono.Android.Export.dll' for the latest stable Android version or higher. -->
<PropertyGroup Condition=" '$(TargetFramework)' != 'monoandroid10' And '$(AndroidApiLevel)' &lt; '$(AndroidLatestStableApiLevel)' ">
<BuildDependsOn></BuildDependsOn>
</PropertyGroup>

</Project>

0 comments on commit daa5254

Please sign in to comment.