From fc5506d8f72351cf46777ba39986b0e00c8319f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:30:50 -0500 Subject: [PATCH 1/4] Bump to xamarin/Java.Interop/main@ae65609 (#8744) Changes: https://github.com/xamarin/java.interop/compare/7d1e7057cf4b0adcf65e7064186326dafce11b72...ae6560976d7a8d20ae18bed96e33ae6a2fc5c754 * xamarin/java.interop@ae656097: [Java.Interop] restore `IL2035` suppression (xamarin/java.interop#1195) * xamarin/java.interop@c6e38933: [Java.Interop] use `Type.GetType()` to find `MarshalMemberBuilder` (xamarin/java.interop#1193) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- external/Java.Interop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/Java.Interop b/external/Java.Interop index 7d1e7057cf4..ae6560976d7 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit 7d1e7057cf4b0adcf65e7064186326dafce11b72 +Subproject commit ae6560976d7a8d20ae18bed96e33ae6a2fc5c754 From 7680e6ef240d0e9b567cae5cf440c41ac742b92e Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Wed, 21 Feb 2024 10:08:31 -0800 Subject: [PATCH 2/4] Bump to xamarin/monodroid@cb01503327 (#8742) Changes: https://github.com/xamarin/monodroid/compare/848d1277b76a599d8a280d58ec06e95477b4a7e5...cb01503327f7723ec138ec4cc051610fecee1bf7 * xamarin/monodroid@cb0150332: Bump external/xamarin-android from `0c0f1fe` to `7368487` * xamarin/monodroid@52e7c4c09: Bump external/android-sdk-installer from `4127490` to `13b2fb3` * xamarin/monodroid@5003ccb4d: Bump external/android-sdk-installer from `9e143d7` to `4127490` * xamarin/monodroid@d7ff10afb: Bump tools/msbuild/external/androidtools from `15350e7` to `8aeb717` * xamarin/monodroid@ae8c39d59: Bump external/xamarin-android from `80ee320` to `0c0f1fe` * xamarin/monodroid@d76e18694: [tools/msbuild] introduce $(_AndroidAllowJavaDebugging) feature switch --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 8d6cb0be54a..8d72a200199 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:main@848d1277b76a599d8a280d58ec06e95477b4a7e5 +xamarin/monodroid:main@cb01503327f7723ec138ec4cc051610fecee1bf7 From e199d62210bfb666595d95ca60579c5c766be1d6 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Wed, 21 Feb 2024 08:55:08 -1000 Subject: [PATCH 3/4] Bump to xamarin/Java.Interop/main@c825dcad (#8701) Changes: https://github.com/xamarin/java.interop/compare/ae6560976d7a8d20ae18bed96e33ae6a2fc5c754...c825dcad8e7fe2e1ba5846a592a02f6a578db991 * xamarin/java.interop@c825dcad: [Java.Interop.Tools.JavaCallableWrappers] Refactor (xamarin/java.interop#1174) `Java.Interop.Tools.JavaCallableWrappers.dll` was refactored and now has a significant API changes. Bump to xamarin/Java.Interop@c825dcad and update callsites accordingly. --- external/Java.Interop | 2 +- .../Tasks/GenerateJavaStubs.cs | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/external/Java.Interop b/external/Java.Interop index ae6560976d7..c825dcad8e7 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit ae6560976d7a8d20ae18bed96e33ae6a2fc5c754 +Subproject commit c825dcad8e7fe2e1ba5846a592a02f6a578db991 diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs index 6a0444e872b..453885d1758 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs @@ -20,6 +20,7 @@ using Xamarin.Android.Tools; using Microsoft.Android.Build.Tasks; +using Java.Interop.Tools.JavaCallableWrappers.Adapters; namespace Xamarin.Android.Tasks { @@ -463,6 +464,16 @@ bool CreateJavaSources (IEnumerable newJavaTypes, TypeDefinitionCache bool hasExportReference = ResolvedAssemblies.Any (assembly => Path.GetFileName (assembly.ItemSpec) == "Mono.Android.Export.dll"); bool generateOnCreateOverrides = int.Parse (AndroidSdkPlatform) <= 10; + var reader_options = new CallableWrapperReaderOptions { + DefaultApplicationJavaClass = ApplicationJavaClass, + DefaultGenerateOnCreateOverrides = generateOnCreateOverrides, + DefaultMonoRuntimeInitialization = monoInit, + MethodClassifier = classifier, + }; + var writer_options = new CallableWrapperWriterOptions { + CodeGenerationTarget = JavaPeerStyle.XAJavaInterop1 + }; + bool ok = true; foreach (JavaType jt in newJavaTypes) { TypeDefinition t = jt.Type; // JCW generator doesn't care about ABI-specific types or token ids @@ -473,23 +484,21 @@ bool CreateJavaSources (IEnumerable newJavaTypes, TypeDefinitionCache using (var writer = MemoryStreamPool.Shared.CreateStreamWriter ()) { try { - var jti = new JavaCallableWrapperGenerator (t, Log.LogWarning, cache, classifier) { - GenerateOnCreateOverrides = generateOnCreateOverrides, - ApplicationJavaClass = ApplicationJavaClass, - MonoRuntimeInitialization = monoInit, - }; + var jcw_type = CecilImporter.CreateType (t, cache, reader_options); + + jcw_type.Generate (writer, writer_options); - jti.Generate (writer); if (useMarshalMethods) { if (classifier.FoundDynamicallyRegisteredMethods (t)) { Log.LogWarning ($"Type '{t.GetAssemblyQualifiedName (cache)}' will register some of its Java override methods dynamically. This may adversely affect runtime performance. See preceding warnings for names of dynamically registered methods."); } } + writer.Flush (); - var path = jti.GetDestinationPath (outputPath); + var path = jcw_type.GetDestinationPath (outputPath); Files.CopyIfStreamChanged (writer.BaseStream, path); - if (jti.HasExport && !hasExportReference) + if (jcw_type.HasExport && !hasExportReference) Diagnostic.Error (4210, Properties.Resources.XA4210); } catch (XamarinAndroidException xae) { ok = false; From d21f6dbf40953fe7b7e3dbf2104e671b83ce2c25 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 21 Feb 2024 14:41:12 -0600 Subject: [PATCH 4/4] [xamarin-android-tools] import $(LibZipSharpVersion) value (#8738) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/dotnet/maui/issues/20752 Context: d1ba2ccdd1377677a6dd24dc13c7a23fd1b8b930 Context: https://github.com/xamarin/xamarin-android-tools/commit/34e98e2b65917d105169f868b5648f67e68b6784 Context: https://github.com/xamarin/xamarin-android/pull/8746 `dotnet build` (.NET Core) ignores assembly versions. `msbuild.exe` (.NET Framework) does not. Enter d1ba2ccd, which updates the `libZipSharp.dll` assembly version from 3.0.0.0 to 3.1.1.0. However, this change only impacted `Xamarin.Android.Build.Tasks.dll`: % monodis --assemblyref bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/34.99.0/tools/Xamarin.Android.Build.Tasks.dll … 11: Version=3.1.1.0 Name=libZipSharp Flags=0x00000000 It did *not* impact `Microsoft.Android.Build.BaseTasks.dll`, as it is built by `external/xamarin-android-tools` and was using a `@(PackageReference)` for libZipSharp 3.0.0: % monodis --assemblyref bin/Release/lib/packs/Microsoft.Android.Sdk.Darwin/34.99.0/tools/Microsoft.Android.Build.BaseTasks.dll … 5: Version=3.0.0.0 Name=libZipSharp Flags=0x00000000 The resulting NuGet package only contains *one* `libZipSharp.dll`, the 3.1.1.0 version (what `Xamarin.Android.Build.Tasks.dll` refs). On PR builds and CI, everything was fine, because all the tests we have use `dotnet build`, and .NET Core ignores assembly versions. However, if you use *`msbuild.exe`* to invoke the tasks within `Microsoft.Android.Build.BaseTasks.dll`, things fail: XARLP7028 System.IO.FileNotFoundException: Could not load file or assembly 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' or one of its dependencies. The system cannot find the file specified.File name: 'libZipSharp, Version=3.0.0.0, Culture=neutral, PublicKeyToken=276db85bc4e20efc' at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(IDictionary`2 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments, ICollection`1 proguardConfigFiles) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 Fix this by adding an `external/xamarin-android-tools.override.props` file (xamarin/xamarin-android-tools@34e98e2b) which imports `Directory.Build.props`, which causes `$(LibZipSharpVersion)` to be set so that the xamarin-android-tools build uses values provided by xamarin-android. TODO: xamarin/xamarin-android#8746 adds a unit test for the "build with `msbuild.exe`" scenario. --- external/xamarin-android-tools.override.props | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 external/xamarin-android-tools.override.props diff --git a/external/xamarin-android-tools.override.props b/external/xamarin-android-tools.override.props new file mode 100644 index 00000000000..f11b5fdc4b9 --- /dev/null +++ b/external/xamarin-android-tools.override.props @@ -0,0 +1,4 @@ + + + +