Skip to content

Commit 2bc0d31

Browse files
moljacpjcollinsjonathanpeppers
authored
[.NET10] multi-target net8.0-android;net10.0-android (#1118)
Context: dotnet/maui#28997 Context: #1148 .NET 10 binding assemblies have changes to generate better code to support trimming and NativeAOT scenarios. We want to ship a copy of .NET 10 assemblies alongside their `net8.0-android` counterparts. To verify API compatibility between the `net8.0-android` and `net10.0-android` assemblies you can run: dotnet tool install --global Microsoft.DotNet.ApiCompat.Tool Get-Item *.nupkg | ForEach-Object { Write-Output "apicompat package $_" ; & apicompat package $_.Name 2>&1 | ForEach-Object { "$_" } } > apidiff.txt At first, we saw ~452 errors, but all appear to be due to changes toward "hiding" internal Kotlin members in .NET 9: * dotnet/java-interop@06214ff General list of changes: * Update `_PackageLevelCustomizations.cshtml` * metadata + Additions cleanup for net10.0 * `nuget.config` from dotnet/android added * <CheckEolWorkloads>false</CheckEolWorkloads> needed to work around some warnings and errors * Create nuget-install.cake * Provision `platforms/android-34` * `Update Metadata.xml` obj/Controls.DeviceTests/Debug/net10.0-android/android/src/mono/androidx/recyclerview/widget/RecyclerView_ItemAnimator_ItemAnimatorListenerImplementor.java(8,57): javac error JAVAC0000: error: ItemAnimatorListener is not public in ItemAnimator; cannot be accessed from outside package * [build] remove `Install extra Android SDK packages` * `$(AndroidManifestType)=GoogleV2` Warning : Dependency `platforms;android-36` should have been installed but could not be resolved. You can attempt to install it with... * Restore BaseOnOffsetChangedListener metadata.xml javac.exe error JAVAC0000: error: BaseOnOffsetChangedListener cannot be inherited with different arguments: <com.google.android.material.appbar.AppBarLayout> and <> * Fix javac error for `ActivityChooserModel` Xamarin.Android.Javac.targets(161,5): error XAJVC0000: C:\a\_work\1\s\artifacts\obj\Benchmarks.Droid\Release\net10.0-android\android-arm64\android\src\mono\androidx\appcompat\widget\ActivityChooserModel_OnChooseActivityListenerImplementor.java:8: error: package androidx.appcompat.widget.ActivityChooserModel does not exist Xamarin.Android.Javac.targets(161,5): error XAJVC0000: androidx.appcompat.widget.ActivityChooserModel.OnChooseActivityListener Xamarin.Android.Javac.targets(161,5): error XAJVC0000: ^ Co-authored-by: Peter Collins <[email protected]> Co-authored-by: Jonathan Peppers <[email protected]>
1 parent 56a595c commit 2bc0d31

File tree

89 files changed

+3631
-3813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+3631
-3813
lines changed

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<_DefaultTargetFrameworks>net8.0-android</_DefaultTargetFrameworks>
1010
<_DefaultNetTargetFrameworks>net8.0</_DefaultNetTargetFrameworks>
1111

12+
<CheckEolWorkloads>false</CheckEolWorkloads>
13+
1214
<!-- Enable DIM/SIM for Classic (defaults to true on .NET) -->
1315
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
1416

build.cake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#addin nuget:?package=SharpZipLib&version=1.4.2
88

99
// Imported scripts
10+
#load "build/cake/nuget-install.cake"
1011
#load "build/cake/setup-environment.cake"
1112
#load "build/cake/update-config.cake"
1213
#load "build/cake/tests.cake"
@@ -18,6 +19,10 @@
1819
#load "build/cake/executive-order.cake"
1920
#load "build/cake/clean.cake"
2021
#load "build/cake/performance-timings.cake"
22+
#load "build/cake/build-android-libraries-net10-net8.cake"
23+
24+
// Migrate packages to net10
25+
bool IsMigratingNet10 = false;
2126

2227
using System.Xml.Linq;
2328
using Newtonsoft.Json;
@@ -43,6 +48,13 @@ Information ($"BUILD_COMMIT : {BUILD_COMMIT}");
4348
Information ($"BUILD_NUMBER : {BUILD_NUMBER}");
4449
Information ($"BUILD_TIMESTAMP : {BUILD_TIMESTAMP}");
4550

51+
RunTarget("nuget-install");
52+
53+
if (IsMigratingNet10)
54+
{
55+
RunTarget("build-android-libraries-net10-net8");
56+
}
57+
4658
Task ("packages")
4759
.IsDependentOn ("binderate")
4860
.IsDependentOn ("nuget");

build/cake/build-and-package.cake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Task ("nuget")
1818
"./generated/AndroidX.sln",
1919
new DotNetBuildSettings { MSBuildSettings = settings }
2020
);
21+
22+
RunTarget("nuget-uninstall");
23+
2124
});
2225

2326
Task ("nuget-pack-without-build")

0 commit comments

Comments
 (0)