diff --git a/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs index e2ff9e57a00..263f6ba221f 100644 --- a/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs +++ b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs @@ -61,10 +61,14 @@ public sealed class CheckApiCompatibility : Task [Required] public string ApiCompatibilityPath { get; set; } + // In case API diffs vary between e.g. Classic MonoAndroid & .NET 6+ + public string TargetFramework { get; set; } + // This Build tasks validates that changes are not breaking Api public override bool Execute () { Log.LogMessage (MessageImportance.High, $"CheckApiCompatibility for ApiLevel: {ApiLevel}"); + Log.LogWarning ($"# jonp: TargetFramework={TargetFramework}"); // Check to see if Api has a previous Api defined. if (!api_versions.TryGetValue (ApiLevel, out string previousApiLevel)) { @@ -173,8 +177,14 @@ void ValidateApiCompat (string contractPath, bool validateAgainstReference) // Verify if there is a file with acceptable issues. - var acceptableIssuesFile = new FileInfo (Path.Combine (ApiCompatibilityPath, $"acceptable-breakages-{ (validateAgainstReference ? "vReference" : ApiLevel) }.txt")); - if (acceptableIssuesFile.Exists) { + var acceptableIssuesFiles = new[]{ + Path.Combine (ApiCompatibilityPath, $"acceptable-breakages-{ (validateAgainstReference ? "vReference" : ApiLevel) }-{TargetFramework}.txt"), + Path.Combine (ApiCompatibilityPath, $"acceptable-breakages-{ (validateAgainstReference ? "vReference" : ApiLevel) }.txt"), + }; + var acceptableIssuesFile = acceptableIssuesFiles.Select (p => new FileInfo (p)) + .Where (v => v.Exists) + .FirstOrDefault (); + if (acceptableIssuesFile != null) { genApiProcess.StartInfo.Arguments += $"--baseline \"{acceptableIssuesFile.FullName}\" --validate-baseline "; } diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index d47cf628aec..837cb554ecd 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -245,6 +245,7 @@ stages: msbuildArguments: >- /restore /t:RunJavaInteropTests + /p:SkipJSUTests=true /p:TestAssembly="bin\Test$(XA.Build.Configuration)\generator-Tests.dll;bin\Test$(XA.Build.Configuration)\Java.Interop.Tools.JavaCallableWrappers-Tests.dll;bin\Test$(XA.Build.Configuration)\logcat-parse-Tests.dll;bin\Test$(XA.Build.Configuration)\Xamarin.Android.Tools.ApiXmlAdjuster-Tests.dll;bin\Test$(XA.Build.Configuration)\Xamarin.Android.Tools.Bytecode-Tests.dll" /bl:$(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\msbuild-run-ji-tests.binlog continueOnError: True @@ -360,6 +361,7 @@ stages: msbuildArguments: >- /restore /t:RunJavaInteropTests + /p:SkipJSUTests=true /p:TestAssembly="bin\Test$(XA.Build.Configuration)\generator-Tests.dll;bin\Test$(XA.Build.Configuration)\Java.Interop.Tools.JavaCallableWrappers-Tests.dll;bin\Test$(XA.Build.Configuration)\logcat-parse-Tests.dll;bin\Test$(XA.Build.Configuration)\Xamarin.Android.Tools.ApiXmlAdjuster-Tests.dll;bin\Test$(XA.Build.Configuration)\Xamarin.Android.Tools.Bytecode-Tests.dll" /bl:$(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\dotnet-run-ji-tests.binlog continueOnError: True diff --git a/external/Java.Interop b/external/Java.Interop index 7f1a5ab1606..aac3e9acca5 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit 7f1a5ab1606e4055eb4705aeafa7a22117998a33 +Subproject commit aac3e9acca503c38c5616ef84d8af28197da254c diff --git a/src/Mono.Android/Java.Interop/JavaTypeParametersAttribute.cs b/src/Mono.Android/Java.Interop/JavaTypeParametersAttribute.cs index 33eab1aa283..e50ed483738 100644 --- a/src/Mono.Android/Java.Interop/JavaTypeParametersAttribute.cs +++ b/src/Mono.Android/Java.Interop/JavaTypeParametersAttribute.cs @@ -1,5 +1,12 @@ using System; +#if NET +using System.Runtime.CompilerServices; + +[assembly: TypeForwardedTo (typeof (Java.Interop.JavaTypeParametersAttribute))] + +#else // !NET + namespace Java.Interop { public class JavaTypeParametersAttribute : Attribute @@ -13,3 +20,4 @@ public JavaTypeParametersAttribute (string [] typeParameters) } } +#endif // !NET diff --git a/src/Mono.Android/Mono.Android.targets b/src/Mono.Android/Mono.Android.targets index af716f206c4..d47234bc25f 100644 --- a/src/Mono.Android/Mono.Android.targets +++ b/src/Mono.Android/Mono.Android.targets @@ -263,6 +263,7 @@ LastStableApiLevel="$(AndroidLatestStableFrameworkVersion)" TargetImplementationPath="$(OutputPath)" ApiCompatibilityPath="$(ApiCompatibilityDir)" + TargetFramework="$(TargetFramework)" />