From 5861cc818d0c9ab968aac1dfbcf3af2f328d42e5 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 10 Oct 2022 14:39:24 -0500 Subject: [PATCH] Bump to .NET 8 Changes: https://github.com/dotnet/installer/compare/11f6b8f7129e34d5317f47ccbc110b2b11c05749...d552037815b75e01be05b6e8d269d54413363e7f Changes: https://github.com/dotnet/linker/compare/5f9bfd94d9c687207872ae03f751ea19704381c0...493ce626f3278b2d0fd883330bf11a64254981bb Changes: https://github.com/dotnet/runtime/compare/6d10e4c8bcd9f96ccd73748ff827561afa09af57...b8d49801fe03b96d2fead3d97a11dce1e723dd17 A summary of what it took to get this working: * Run `darc update-dependencies --id 152596` * Setup .NET 6,7,8 "multi-targeting" * Setup dotnet6/dotnet7/dotnet8 NuGet feeds * `$(DotNetTargetFrameworkVersion)` should be 8.0 * Rename API diff for `net8.0` * Fix `AutoImport.props` for 8.0 * Update `.apkdesc` files * Update `CheckIncludedAssemblies` test * Use .NET Core `3.1.x` Trying to avoid: dotnet-install: Failed to locate the latest version in the channel '3.1.417' with 'preview' quality for 'dotnet-sdk', os: 'win', architecture: 'x64'. * Install .NET 6 for legacy MSBuild tests * [Mono.Android.Export] fix `NotSupportedException` Context: https://github.com/mono/mono/blob/242ac50598e4f596e1a42f9dd377701096ea3a74/mcs/class/referencesource/mscorlib/system/reflection/emit/dynamicmethod.cs#L276-L277 Context: https://github.com/dotnet/runtime/commit/e46523032d72c8b0d2b14ce4b14229a8c268a6e5 System.NotSupportedException: Wrong MethodAttributes or CallingConventions for DynamicMethod. Only public, static, standard supported * Use correct Mono pack names for `$(AotAssemblies)` * Fix `DotNetPublish` test Was failing with: Build should be using C:\a_work\1\s\xamarin-android\bin\Release\dotnet\packs\Microsoft.Android.Ref.33\34.0.0-ci.pr.gh7451.52\ref\net7.0\Mono.Android.dll Expected: True But was: False * Remove a `net7.0` assertion for build warnings See: https://github.com/dotnet/runtime/issues/77385 * Pass `-SkipNonVersionedFiles` to `dotnet-install` scripts to avoid: dotnet --info Exited with code: 137 --- Configuration.props | 1 + Directory.Build.props | 4 +- Makefile | 2 +- NuGet.config | 8 +- build-tools/automation/azure-pipelines.yaml | 3 +- .../setup-test-environment.yaml | 6 + .../yaml-templates/use-dot-net.yaml | 5 +- .../automation/yaml-templates/variables.yaml | 8 +- .../create-packs/Directory.Build.targets | 3 +- .../Microsoft.NET.Sdk.Android.proj | 4 +- build-tools/scripts/DotNet.targets | 1 + .../xaprepare/ConfigAndData/Configurables.cs | 4 +- .../Steps/Step_InstallDotNetPreview.cs | 13 +- .../xaprepare/xaprepare/package-download.proj | 1 + eng/Version.Details.xml | 20 ++- eng/Versions.props | 14 +-- .../android-bindinglib/AndroidBinding1.csproj | 2 +- .../android-wear/AndroidApp1.csproj | 2 +- .../android/AndroidApp1.csproj | 2 +- .../androidlib/AndroidLib1.csproj | 2 +- src/Mono.Android.Export/CallbackCode.cs | 2 +- .../Sdk/AutoImport.props | 4 +- .../targets/Microsoft.Android.Sdk.Aot.targets | 10 +- .../WorkloadManifest.in.json | 15 ++- .../WorkloadManifest.in.targets | 9 ++ .../PackagingTest.cs | 8 -- .../Xamarin.Android.Build.Tests/XASdkTests.cs | 56 +++++---- .../Android/XASdkProject.cs | 2 +- .../Common/DotNetStandard.cs | 21 +++- .../Common/DotNetXamarinProject.cs | 2 +- .../BuildReleaseArm64SimpleDotNet.apkdesc | 54 +++----- .../BuildReleaseArm64XFormsDotNet.apkdesc | 116 ++++++++---------- .../Tests/XASdkDeployTests.cs | 34 +++-- ...cceptable-breakages-vReference-net8.0.txt} | 0 .../remap-mam-json-to-xml.csproj | 2 +- 35 files changed, 225 insertions(+), 215 deletions(-) rename tests/api-compatibility/{acceptable-breakages-vReference-net7.0.txt => acceptable-breakages-vReference-net8.0.txt} (100%) diff --git a/Configuration.props b/Configuration.props index a38424b5179..22da4cf6596 100644 --- a/Configuration.props +++ b/Configuration.props @@ -47,6 +47,7 @@ portable True latest + 33.0.1 32.0.476 diff --git a/Directory.Build.props b/Directory.Build.props index fef6d096b52..7650326c62c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,11 +1,11 @@ - 7.0 + 8.0 net$(DotNetTargetFrameworkVersion) $(DotNetTargetFramework)-android - net6.0 + net7.0 netstandard2.0 Debug $(MSBuildThisFileDirectory)bin\$(Configuration)\ diff --git a/Makefile b/Makefile index 952d405a564..c6421429521 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ RUNTIME := $(shell which mono64 2> /dev/null && echo mono64 || echo mono) SOLUTION = Xamarin.Android.sln TEST_TARGETS = build-tools/scripts/RunTests.targets API_LEVEL ?= -PREPARE_NET_FX = net6.0 +PREPARE_NET_FX = net7.0 PREPARE_ARGS = PREPARE_PROJECT = build-tools/xaprepare/xaprepare/xaprepare.csproj PREPARE_MSBUILD_FLAGS = $(PREPARE_MSBUILD_ARGS) $(MSBUILD_ARGS) diff --git a/NuGet.config b/NuGet.config index a24c4eef1e6..4aaa20c3d71 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,13 +5,13 @@ - + - - - + + + diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 7a1fbe38c16..d123165a8e6 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -179,7 +179,8 @@ stages: # xabuild still depends on .NET Core 3 or earlier - template: yaml-templates\use-dot-net.yaml parameters: - version: 3.1.417 + version: 3.1 + quality: GA # Downgrade the XA .vsix installed into the instance of VS that we are building with so that we don't restore/build against a test version. # The VS installer will attempt to resume any failed or partial installation before trying to downgrade Xamarin.Android. diff --git a/build-tools/automation/yaml-templates/setup-test-environment.yaml b/build-tools/automation/yaml-templates/setup-test-environment.yaml index 7ed11716f57..1cc3fa8c32f 100644 --- a/build-tools/automation/yaml-templates/setup-test-environment.yaml +++ b/build-tools/automation/yaml-templates/setup-test-environment.yaml @@ -36,10 +36,16 @@ steps: displayName: set JI_JAVA_HOME condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT')) +# Install .NET 6 for legacy tests - template: use-dot-net.yaml parameters: + version: 6.0 + quality: GA remove_dotnet: ${{ parameters.remove_dotnet }} +# Install latest .NET +- template: use-dot-net.yaml + - task: DotNetCoreCLI@2 displayName: shut down existing build daemons inputs: diff --git a/build-tools/automation/yaml-templates/use-dot-net.yaml b/build-tools/automation/yaml-templates/use-dot-net.yaml index c857b38d967..77666fed5fb 100644 --- a/build-tools/automation/yaml-templates/use-dot-net.yaml +++ b/build-tools/automation/yaml-templates/use-dot-net.yaml @@ -3,6 +3,7 @@ parameters: version: $(DotNetSdkVersion) + quality: $(DotNetSdkQuality) remove_dotnet: false steps: @@ -37,7 +38,7 @@ steps: $sleepTime = $sleepTime * 2 } } - & .\dotnet-install.ps1 -Version ${{ parameters.version }} -InstallDir $DotNetRoot -Verbose + & .\dotnet-install.ps1 -Channel ${{ parameters.version }} -Quality ${{ parameters.quality }} -InstallDir $DotNetRoot -SkipNonVersionedFiles -Verbose displayName: install .NET Core ${{ parameters.version }} condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) @@ -46,7 +47,7 @@ steps: (if [[ "${{ parameters.remove_dotnet }}" == "true" ]] ; then rm -rfv $DOTNET_ROOT; fi) && curl -L https://dot.net/v1/dotnet-install.sh --retry 5 --retry-max-time 300 > dotnet-install.sh && chmod +x dotnet-install.sh && - ./dotnet-install.sh --version ${{ parameters.version }} --install-dir $DOTNET_ROOT --verbose && + ./dotnet-install.sh --channel ${{ parameters.version }} --quality ${{ parameters.quality }} --install-dir $DOTNET_ROOT --skip-non-versioned-files --verbose && PATH="$DOTNET_ROOT:$PATH" && echo "##vso[task.setvariable variable=DOTNET_ROOT]$DOTNET_ROOT" && echo "##vso[task.setvariable variable=PATH]$PATH" diff --git a/build-tools/automation/yaml-templates/variables.yaml b/build-tools/automation/yaml-templates/variables.yaml index 31576a1957c..21a45f095c3 100644 --- a/build-tools/automation/yaml-templates/variables.yaml +++ b/build-tools/automation/yaml-templates/variables.yaml @@ -18,7 +18,9 @@ variables: - name: NUnit.NumberOfTestWorkers value: 4 - name: DotNetSdkVersion - value: 6.0.300 + value: 7.0.1xx +- name: DotNetSdkQuality + value: preview - name: GitHub.Token value: $(github--pat--vs-mobiletools-engineering-service2) - name: HostedMacImage @@ -32,9 +34,9 @@ variables: - name: TeamName value: XamarinAndroid - name: DotNetTargetFramework - value: net7.0 + value: net8.0 - name: DotNetStableTargetFramework - value: net6.0 + value: net7.0 # Workaround: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1585820 - name: _WriteTelemetryProperties value: false diff --git a/build-tools/create-packs/Directory.Build.targets b/build-tools/create-packs/Directory.Build.targets index 2938d01f7e1..8cb06e245c0 100644 --- a/build-tools/create-packs/Directory.Build.targets +++ b/build-tools/create-packs/Directory.Build.targets @@ -122,7 +122,8 @@ <_NuGetSources Include="$(OutputPath.TrimEnd('\'))" /> - + + <_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" /> <_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" /> <_PreviewPacks Condition=" '$(AndroidLatestStableApiLevel)' != '$(AndroidLatestUnstableApiLevel)' " Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Ref.$(AndroidLatestUnstableApiLevel).*.nupkg" /> <_InstallArguments Include="android" /> diff --git a/build-tools/create-packs/Microsoft.NET.Sdk.Android.proj b/build-tools/create-packs/Microsoft.NET.Sdk.Android.proj index ae1ea2eb8ee..2282c6b119f 100644 --- a/build-tools/create-packs/Microsoft.NET.Sdk.Android.proj +++ b/build-tools/create-packs/Microsoft.NET.Sdk.Android.proj @@ -35,12 +35,12 @@ about the various Microsoft.Android workloads. + Replacements="@WORKLOAD_VERSION@=$(WorkloadVersion);@NET7_VERSION@=$(AndroidNet7Version);@NET6_VERSION@=$(AndroidNet6Version)"> + Replacements="@NET7_VERSION@=$(AndroidNet7Version);@NET6_VERSION@=$(AndroidNet6Version)"> diff --git a/build-tools/scripts/DotNet.targets b/build-tools/scripts/DotNet.targets index 8ac1249be23..1aae6db4c3e 100644 --- a/build-tools/scripts/DotNet.targets +++ b/build-tools/scripts/DotNet.targets @@ -70,6 +70,7 @@ + <_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" /> <_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" /> <_InstallArguments Include="--skip-manifest-update" /> <_InstallArguments Include="--verbosity diag" /> diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs index accb0405ad9..12ca364969b 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs @@ -329,7 +329,7 @@ public static partial class Paths public static string MicrosoftNETWorkloadMonoPackageDir => Path.Combine ( XAPackagesDir, - $"microsoft.net.workload.mono.toolchain.{{0}}.manifest-{ctx.Properties.GetRequiredValue (KnownProperties.DotNetMonoManifestVersionBand)}", + $"microsoft.net.workload.mono.toolchain{{0}}.manifest-{ctx.Properties.GetRequiredValue (KnownProperties.DotNetMonoManifestVersionBand)}", ctx.Properties.GetRequiredValue (KnownProperties.MicrosoftNETCoreAppRefPackageVersion) ); @@ -337,7 +337,7 @@ public static partial class Paths public static string MicrosoftNETWorkloadEmscriptenPackageDir => Path.Combine ( XAPackagesDir, - $"microsoft.net.workload.emscripten.{{0}}.manifest-{ctx.Properties.GetRequiredValue (KnownProperties.DotNetEmscriptenManifestVersionBand)}", + $"microsoft.net.workload.emscripten{{0}}.manifest-{ctx.Properties.GetRequiredValue (KnownProperties.DotNetEmscriptenManifestVersionBand)}", ctx.Properties.GetRequiredValue (KnownProperties.MicrosoftNETWorkloadEmscriptenPackageVersion) ); diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs b/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs index 55e1772a41c..077bc47da8a 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs @@ -49,15 +49,18 @@ protected override async Task Execute (Context context) var sdk_manifests = Path.Combine (dotnetPath, "sdk-manifests", context.Properties.GetRequiredValue (KnownProperties.DotNetSdkManifestsFolder)); // Copy the WorkloadManifest.* files from the latest Microsoft.NET.Workload.* listed in package-download.proj - var dotnets = new [] { "net6", "net7" }; + // NOTE: the packages that actually *exist* in .NET 8 are mismatched right now... + var dotnets = new [] { ".net6", ".net7", "" }; foreach (var dotnet in dotnets) { - var destination = Path.Combine (sdk_manifests, $"microsoft.net.workload.mono.toolchain.{dotnet}"); + var destination = Path.Combine (sdk_manifests, $"microsoft.net.workload.mono.toolchain{dotnet}"); foreach (var file in Directory.GetFiles (string.Format (Configurables.Paths.MicrosoftNETWorkloadMonoToolChainDir, dotnet), "WorkloadManifest.*")) { Utilities.CopyFileToDir (file, destination); } - destination = Path.Combine (sdk_manifests, $"microsoft.net.workload.emscripten.{dotnet}"); - foreach (var file in Directory.GetFiles (string.Format (Configurables.Paths.MicrosoftNETWorkloadEmscriptenDir, dotnet), "WorkloadManifest.*")) { - Utilities.CopyFileToDir (file, destination); + if (dotnet != "") { + destination = Path.Combine (sdk_manifests, $"microsoft.net.workload.emscripten{dotnet}"); + foreach (var file in Directory.GetFiles (string.Format (Configurables.Paths.MicrosoftNETWorkloadEmscriptenDir, dotnet), "WorkloadManifest.*")) { + Utilities.CopyFileToDir (file, destination); + } } } diff --git a/build-tools/xaprepare/xaprepare/package-download.proj b/build-tools/xaprepare/xaprepare/package-download.proj index 5fe3c418bc5..6d6d4805ac5 100644 --- a/build-tools/xaprepare/xaprepare/package-download.proj +++ b/build-tools/xaprepare/xaprepare/package-download.proj @@ -20,6 +20,7 @@ Otherwise, $(MicrosoftNETCoreAppRefPackageVersion) from eng/Versions.props will + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 13ad1cd3254..a0db29e71ce 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,24 +1,20 @@ - + https://github.com/dotnet/installer - 11f6b8f7129e34d5317f47ccbc110b2b11c05749 + fa294e422a71311738071f8cdb2d405eca86a3a1 - + https://github.com/dotnet/linker - 5f9bfd94d9c687207872ae03f751ea19704381c0 + 6000a84c7e0b3678af032c25b7319aefdd057f6c - + https://github.com/dotnet/runtime - 6d10e4c8bcd9f96ccd73748ff827561afa09af57 + 636777273b152a34bb244b35527ca563735efa35 - + https://github.com/dotnet/emsdk - 8d8d2122b16c81df4b158fe43995f958e8fe115e - - - https://github.com/dotnet/emsdk - 8d8d2122b16c81df4b158fe43995f958e8fe115e + 52e3130a816a7c8d734f1e9f0dc9ed6d5936e7ae diff --git a/eng/Versions.props b/eng/Versions.props index aee1064345c..2906e789e40 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,13 +1,13 @@ - 7.0.100-rc.2.22459.2 - 7.0.100-1.22452.1 - 7.0.0-rc.2.22451.11 + 8.0.200-alpha.1.22511.1 + 7.0.100-1.22507.1 + 8.0.0-alpha.1.22507.5 7.0.0-beta.22103.1 7.0.0-beta.22103.1 - 7.0.0-rc.2.22430.5 - $(MicrosoftNETWorkloadEmscriptennet7Manifest70100Version) + 8.0.0-alpha.1.22504.1 + $(MicrosoftNETWorkloadEmscriptennet7Manifest80100Version) 7.0.100-rc.1.22410.7 @@ -16,7 +16,7 @@ $(DotNetPreviewVersionBand)$([System.Text.RegularExpressions.Regex]::Match($(MicrosoftDotnetSdkInternalPackageVersion), `\-(preview|rc).\d+`)) $(DotNetPreviewVersionBand) - $(DotNetPreviewVersionBand) - $(DotNetPreviewVersionBand) + 8.0.100 + 8.0.100 diff --git a/src/Microsoft.Android.Templates/android-bindinglib/AndroidBinding1.csproj b/src/Microsoft.Android.Templates/android-bindinglib/AndroidBinding1.csproj index cc53c7b8326..c0b7afc265a 100644 --- a/src/Microsoft.Android.Templates/android-bindinglib/AndroidBinding1.csproj +++ b/src/Microsoft.Android.Templates/android-bindinglib/AndroidBinding1.csproj @@ -1,6 +1,6 @@ - net7.0-android + net8.0-android SUPPORTED_OS_PLATFORM_VERSION AndroidBinding1 enable diff --git a/src/Microsoft.Android.Templates/android-wear/AndroidApp1.csproj b/src/Microsoft.Android.Templates/android-wear/AndroidApp1.csproj index 015ba495310..b5bc3138f82 100644 --- a/src/Microsoft.Android.Templates/android-wear/AndroidApp1.csproj +++ b/src/Microsoft.Android.Templates/android-wear/AndroidApp1.csproj @@ -1,6 +1,6 @@ - net7.0-android + net8.0-android SUPPORTED_OS_PLATFORM_VERSION AndroidApp1 Exe diff --git a/src/Microsoft.Android.Templates/android/AndroidApp1.csproj b/src/Microsoft.Android.Templates/android/AndroidApp1.csproj index ffe09512dde..9935379ad52 100644 --- a/src/Microsoft.Android.Templates/android/AndroidApp1.csproj +++ b/src/Microsoft.Android.Templates/android/AndroidApp1.csproj @@ -1,6 +1,6 @@ - net7.0-android + net8.0-android SUPPORTED_OS_PLATFORM_VERSION AndroidApp1 Exe diff --git a/src/Microsoft.Android.Templates/androidlib/AndroidLib1.csproj b/src/Microsoft.Android.Templates/androidlib/AndroidLib1.csproj index 787e6f8939b..4a6dd3eea38 100644 --- a/src/Microsoft.Android.Templates/androidlib/AndroidLib1.csproj +++ b/src/Microsoft.Android.Templates/androidlib/AndroidLib1.csproj @@ -1,6 +1,6 @@ - net7.0-android + net8.0-android SUPPORTED_OS_PLATFORM_VERSION AndroidLib1 enable diff --git a/src/Mono.Android.Export/CallbackCode.cs b/src/Mono.Android.Export/CallbackCode.cs index dafd6fba0d7..f43efa8e2a6 100644 --- a/src/Mono.Android.Export/CallbackCode.cs +++ b/src/Mono.Android.Export/CallbackCode.cs @@ -637,7 +637,7 @@ public override void GenerateNativeCallbackDelegate () paramTypes.AddRange (parameter_type_infos.ConvertAll (p => p.NativeType).ToArray ()); var m = GenerateNativeCallbackDelegate (name); //Console.WriteLine (m.PrintCode ()); - var dm = new DynamicMethod (name, System.Reflection.MethodAttributes.Static, CallingConventions.Standard, + var dm = new DynamicMethod (name, System.Reflection.MethodAttributes.Static | System.Reflection.MethodAttributes.Public, CallingConventions.Standard, return_type_info.NativeType, paramTypes.ToArray (), DynamicCallbackFactory.Module, true); m.Generate (dm.GetILGenerator ()); result = dm.CreateDelegate (GetDelegateType ()); diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props index db78acd0790..d9823bc3b9a 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props @@ -16,13 +16,13 @@ https://github.com/dotnet/designs/blob/4703666296f5e59964961464c25807c727282cae/ --> - + - + diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Aot.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Aot.targets index 6d8de79020b..e547f11a8dc 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Aot.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Aot.targets @@ -23,11 +23,11 @@ They run in a context of an inner build with a single $(RuntimeIdentifier). https://github.com/dotnet/runtime/blob/69711860262e44458bbe276393ea3eb9f7a2192a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in#L20-L25 --> - - - - - + + + + + diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json b/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json index 2059e1d56f7..fda900c8208 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json @@ -4,6 +4,7 @@ "android": { "description": ".NET SDK Workload for building Android applications.", "packs": [ + "Microsoft.Android.Sdk.net8", "Microsoft.Android.Sdk.net7", "Microsoft.Android.Sdk.net6", "Microsoft.Android.Ref.33", @@ -23,7 +24,7 @@ } }, "packs": { - "Microsoft.Android.Sdk.net7": { + "Microsoft.Android.Sdk.net8": { "kind": "sdk", "version": "@WORKLOAD_VERSION@", "alias-to": { @@ -35,6 +36,18 @@ "linux-x64": "Microsoft.Android.Sdk.Linux" } }, + "Microsoft.Android.Sdk.net7": { + "kind": "sdk", + "version": "@NET7_VERSION@", + "alias-to": { + "osx-x64": "Microsoft.Android.Sdk.Darwin", + "osx-arm64": "Microsoft.Android.Sdk.Darwin", + "win-x86": "Microsoft.Android.Sdk.Windows", + "win-x64": "Microsoft.Android.Sdk.Windows", + "win-arm64": "Microsoft.Android.Sdk.Windows", + "linux-x64": "Microsoft.Android.Sdk.Linux" + } + }, "Microsoft.Android.Sdk.net6": { "kind": "sdk", "version": "@NET6_VERSION@", diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.targets index 6d433f1003c..7bd5faa24e7 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.targets @@ -1,11 +1,20 @@ + + + + ResourceData.JavaSourceJarTestJar, } - }, - ExtraNuGetConfigSources = { - // Projects targeting net6.0 require ref/runtime packs on NuGet.org - "https://api.nuget.org/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", - }, + } }; + proj.AddNuGetSourcesForOlderTargetFrameworks (); using var b = new Builder (); var legacyTargetFrameworkVersion = "13.0"; @@ -969,12 +975,8 @@ public void MauiTargetFramework (string dotnetVersion, string platform, int apiL var targetFramework = $"{dotnetVersion}-{platform}"; var library = new XASdkProject (outputType: "Library") { TargetFramework = targetFramework, - ExtraNuGetConfigSources = { - // Projects targeting net6.0 require ref/runtime packs on NuGet.org - "https://api.nuget.org/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", - }, }; + library.AddNuGetSourcesForOlderTargetFrameworks (); var preview = IsPreviewFrameworkVersion (targetFramework); if (preview) { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XASdkProject.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XASdkProject.cs index 491b222a2d9..ec5b58011bf 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XASdkProject.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XASdkProject.cs @@ -55,7 +55,7 @@ public static void SaveNuGetConfig (string directory) public XASdkProject (string outputType = "Exe", [CallerMemberName] string packageName = "") { Sdk = "Microsoft.NET.Sdk"; - TargetFramework = "net7.0-android"; + TargetFramework = "net8.0-android"; SupportedOSPlatformVersion = "21"; PackageName = $"com.xamarin.{(packageName ?? ProjectName).ToLower ()}"; JavaPackageName = JavaPackageName ?? PackageName.ToLowerInvariant (); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetStandard.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetStandard.cs index 95ba72809c5..2a061d81bc3 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetStandard.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetStandard.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -34,6 +34,25 @@ public string TargetFramework { get { return GetProperty ("TargetFramework"); } set { SetProperty ("TargetFramework", value); } } + + /// + /// Projects targeting net6.0/net7.0 require ref/runtime packs on NuGet.org or dotnet6/dotnet7 + /// + public void AddNuGetSourcesForOlderTargetFrameworks () + { + if (TargetFramework.IndexOf ("net6.0", StringComparison.OrdinalIgnoreCase) != -1) { + ExtraNuGetConfigSources = new List { + "https://api.nuget.org/v3/index.json", + "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", + }; + } else if (TargetFramework.IndexOf ("net7.0", StringComparison.OrdinalIgnoreCase) != -1) { + ExtraNuGetConfigSources = new List { + "https://api.nuget.org/v3/index.json", + "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json", + }; + } + } + public string Sdk { get; set; } public IList OtherBuildItems { get; private set; } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetXamarinProject.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetXamarinProject.cs index 223511d6364..a6ef3a10b97 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetXamarinProject.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetXamarinProject.cs @@ -26,7 +26,7 @@ protected DotNetXamarinProject (string debugConfigurationName = "Debug", string SetProperty ("AssemblyName", () => AssemblyName ?? ProjectName); if (Builder.UseDotNet) { - SetProperty ("TargetFramework", "net7.0-android"); + SetProperty ("TargetFramework", "net8.0-android"); SetProperty ("EnableDefaultItems", "false"); SetProperty ("AppendTargetFrameworkToOutputPath", "false"); } else { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleDotNet.apkdesc b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleDotNet.apkdesc index 33cfb16c606..a415e51ee10 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleDotNet.apkdesc +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleDotNet.apkdesc @@ -5,82 +5,64 @@ "Size": 3032 }, "assemblies/Java.Interop.dll": { - "Size": 59187 + "Size": 58990 }, "assemblies/Mono.Android.dll": { - "Size": 88390 + "Size": 87490 }, "assemblies/Mono.Android.Runtime.dll": { - "Size": 5776 + "Size": 5860 }, "assemblies/rc.bin": { "Size": 1182 }, "assemblies/System.Console.dll": { - "Size": 6408 - }, - "assemblies/System.Diagnostics.Tracing.dll": { - "Size": 2089 + "Size": 6627 }, "assemblies/System.Linq.dll": { - "Size": 9096 - }, - "assemblies/System.Memory.dll": { - "Size": 3388 + "Size": 9252 }, "assemblies/System.Private.CoreLib.dll": { - "Size": 533617 + "Size": 470830 }, "assemblies/System.Runtime.dll": { - "Size": 3655 + "Size": 2626 }, "assemblies/System.Runtime.InteropServices.dll": { - "Size": 3770 - }, - "assemblies/System.Threading.dll": { - "Size": 5486 - }, - "assemblies/System.Threading.Thread.dll": { - "Size": 1978 - }, - "assemblies/System.Threading.ThreadPool.dll": { - "Size": 2008 - }, - "assemblies/System.Transactions.Local.dll": { - "Size": 62998 + "Size": 2267 }, "assemblies/UnnamedProject.dll": { - "Size": 3559 + "Size": 3629 }, "classes.dex": { - "Size": 18612 + "Size": 18968 }, "lib/arm64-v8a/libmonodroid.so": { - "Size": 433600 + "Size": 434632 }, "lib/arm64-v8a/libmonosgen-2.0.so": { - "Size": 3073392 + "Size": 3076080 }, "lib/arm64-v8a/libSystem.IO.Compression.Native.so": { "Size": 723840 }, "lib/arm64-v8a/libSystem.Native.so": { - "Size": 93032 + "Size": 94136 }, "lib/arm64-v8a/libSystem.Security.Cryptography.Native.Android.so": { - "Size": 148696 + "Size": 149552 }, "lib/arm64-v8a/libxamarin-app.so": { - "Size": 16896 + "Size": 16128 }, "META-INF/BNDLTOOL.RSA": { "Size": 1213 }, "META-INF/BNDLTOOL.SF": { - "Size": 3446 + "Size": 2794 }, "META-INF/MANIFEST.MF": { - "Size": 3319 + "Size": 2667 }, "res/drawable-hdpi-v4/icon.png": { "Size": 4762 @@ -107,5 +89,5 @@ "Size": 1904 } }, - "PackageSize": 2730619 + "PackageSize": 2590859 } \ No newline at end of file diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64XFormsDotNet.apkdesc b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64XFormsDotNet.apkdesc index db99dbbb8a5..71a0c27e82e 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64XFormsDotNet.apkdesc +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64XFormsDotNet.apkdesc @@ -8,145 +8,127 @@ "Size": 7314 }, "assemblies/Java.Interop.dll": { - "Size": 66760 + "Size": 66843 }, "assemblies/Mono.Android.dll": { - "Size": 444587 + "Size": 444220 }, "assemblies/Mono.Android.Runtime.dll": { - "Size": 5776 + "Size": 5860 }, "assemblies/mscorlib.dll": { - "Size": 3859 + "Size": 3854 }, "assemblies/netstandard.dll": { - "Size": 5573 + "Size": 5569 }, "assemblies/rc.bin": { "Size": 1182 }, "assemblies/System.Collections.Concurrent.dll": { - "Size": 10484 + "Size": 10716 }, "assemblies/System.Collections.dll": { - "Size": 15299 + "Size": 15456 }, "assemblies/System.Collections.NonGeneric.dll": { - "Size": 7434 + "Size": 7630 }, "assemblies/System.ComponentModel.dll": { - "Size": 1940 + "Size": 2152 }, "assemblies/System.ComponentModel.Primitives.dll": { - "Size": 2554 + "Size": 2643 }, "assemblies/System.ComponentModel.TypeConverter.dll": { - "Size": 6032 + "Size": 6200 }, "assemblies/System.Console.dll": { - "Size": 7268 + "Size": 7467 }, "assemblies/System.Core.dll": { - "Size": 1986 + "Size": 1982 }, "assemblies/System.Diagnostics.TraceSource.dll": { - "Size": 6551 - }, - "assemblies/System.Diagnostics.Tracing.dll": { - "Size": 2089 + "Size": 6739 }, "assemblies/System.dll": { - "Size": 2341 + "Size": 2336 }, "assemblies/System.Drawing.dll": { - "Size": 2026 + "Size": 2022 }, "assemblies/System.Drawing.Primitives.dll": { - "Size": 11973 + "Size": 12154 }, "assemblies/System.IO.Compression.dll": { - "Size": 16675 + "Size": 16792 }, "assemblies/System.IO.IsolatedStorage.dll": { - "Size": 9988 + "Size": 10151 }, "assemblies/System.Linq.dll": { - "Size": 19139 + "Size": 19484 }, "assemblies/System.Linq.Expressions.dll": { - "Size": 163894 - }, - "assemblies/System.Memory.dll": { - "Size": 3388 + "Size": 164025 }, "assemblies/System.Net.Http.dll": { - "Size": 66840 + "Size": 67022 }, "assemblies/System.Net.Primitives.dll": { - "Size": 21879 + "Size": 22007 }, "assemblies/System.Net.Requests.dll": { - "Size": 3602 + "Size": 3739 }, "assemblies/System.ObjectModel.dll": { - "Size": 8106 + "Size": 8168 }, "assemblies/System.Private.CoreLib.dll": { - "Size": 786299 + "Size": 774582 }, "assemblies/System.Private.DataContractSerialization.dll": { - "Size": 192243 + "Size": 192492 }, "assemblies/System.Private.Uri.dll": { - "Size": 42217 + "Size": 42547 }, "assemblies/System.Private.Xml.dll": { - "Size": 215338 + "Size": 215891 }, "assemblies/System.Private.Xml.Linq.dll": { - "Size": 16635 + "Size": 16804 }, "assemblies/System.Runtime.dll": { - "Size": 3808 + "Size": 2788 }, "assemblies/System.Runtime.InteropServices.dll": { - "Size": 3770 + "Size": 2267 }, "assemblies/System.Runtime.Serialization.dll": { - "Size": 1950 + "Size": 1943 }, "assemblies/System.Runtime.Serialization.Formatters.dll": { - "Size": 2480 + "Size": 2677 }, "assemblies/System.Runtime.Serialization.Primitives.dll": { - "Size": 3759 + "Size": 3850 }, "assemblies/System.Security.Cryptography.dll": { - "Size": 7783 + "Size": 7945 }, "assemblies/System.Text.RegularExpressions.dll": { - "Size": 154181 - }, - "assemblies/System.Threading.dll": { - "Size": 5486 - }, - "assemblies/System.Threading.Thread.dll": { - "Size": 1978 - }, - "assemblies/System.Threading.ThreadPool.dll": { - "Size": 2008 - }, - "assemblies/System.Transactions.Local.dll": { - "Size": 62998 + "Size": 154209 }, "assemblies/System.Xml.dll": { - "Size": 1838 + "Size": 1831 }, "assemblies/System.Xml.Linq.dll": { - "Size": 1860 + "Size": 1856 }, "assemblies/UnnamedProject.dll": { - "Size": 117251 + "Size": 117372 }, "assemblies/Xamarin.AndroidX.Activity.dll": { "Size": 5872 @@ -215,25 +197,25 @@ "Size": 40159 }, "classes.dex": { - "Size": 3090268 + "Size": 3090508 }, "lib/arm64-v8a/libmonodroid.so": { - "Size": 433600 + "Size": 434632 }, "lib/arm64-v8a/libmonosgen-2.0.so": { - "Size": 3073392 + "Size": 3076080 }, "lib/arm64-v8a/libSystem.IO.Compression.Native.so": { "Size": 723840 }, "lib/arm64-v8a/libSystem.Native.so": { - "Size": 93032 + "Size": 94136 }, "lib/arm64-v8a/libSystem.Security.Cryptography.Native.Android.so": { - "Size": 148696 + "Size": 149552 }, "lib/arm64-v8a/libxamarin-app.so": { - "Size": 324464 + "Size": 323696 }, "META-INF/android.support.design_material.version": { "Size": 12 @@ -347,13 +329,13 @@ "Size": 1213 }, "META-INF/BNDLTOOL.SF": { - "Size": 79735 + "Size": 79083 }, "META-INF/com.google.android.material_material.version": { "Size": 10 }, "META-INF/MANIFEST.MF": { - "Size": 79608 + "Size": 78956 }, "META-INF/proguard/androidx-annotations.pro": { "Size": 339 @@ -1988,5 +1970,5 @@ "Size": 341228 } }, - "PackageSize": 8057909 + "PackageSize": 7971397 } \ No newline at end of file diff --git a/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs b/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs index e6dddedb980..68eb6d66170 100644 --- a/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/XASdkDeployTests.cs @@ -23,26 +23,36 @@ public class XASdkDeployTests : DeviceTest new object[] { /* isRelease */ false, /* xamarinForms */ false, - /* targetFramework*/ "net7.0-android", + /* targetFramework*/ "net8.0-android", }, new object[] { /* isRelease */ true, /* xamarinForms */ false, - /* targetFramework*/ "net7.0-android", + /* targetFramework*/ "net8.0-android", }, new object[] { /* isRelease */ false, /* xamarinForms */ true, - /* targetFramework*/ "net7.0-android", + /* targetFramework*/ "net8.0-android", }, new object[] { /* isRelease */ true, /* xamarinForms */ true, - /* targetFramework*/ "net7.0-android", + /* targetFramework*/ "net8.0-android", }, new object[] { /* isRelease */ true, /* xamarinForms */ false, + /* targetFramework*/ "net8.0-android", + }, + new object[] { + /* isRelease */ false, + /* xamarinForms */ true, + /* targetFramework*/ "net7.0-android", + }, + new object[] { + /* isRelease */ true, + /* xamarinForms */ true, /* targetFramework*/ "net7.0-android", }, new object[] { @@ -74,13 +84,7 @@ public void DotNetInstallAndRun (bool isRelease, bool xamarinForms, string targe }; } proj.TargetFramework = targetFramework; - if (targetFramework.Contains ("net6.0")) { - proj.ExtraNuGetConfigSources = new List () { - // Projects targeting net6.0 require ref/runtime packs on NuGet.org or dotnet6 - "https://api.nuget.org/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", - }; - } + proj.AddNuGetSourcesForOlderTargetFrameworks (); proj.SetRuntimeIdentifier (DeviceAbi); var relativeProjDir = Path.Combine ("temp", TestName); @@ -160,13 +164,7 @@ public void DotNetDebug ([Values("net6.0-android", "net7.0-android")] string tar var proj = new XASdkProject (); proj.TargetFramework = targetFramework; - if (targetFramework.Contains ("net6.0")) { - proj.ExtraNuGetConfigSources = new List () { - // Projects targeting net6.0 require ref/runtime packs on NuGet.org or dotnet6 - "https://api.nuget.org/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", - }; - } + proj.AddNuGetSourcesForOlderTargetFrameworks (); proj.SetRuntimeIdentifier (DeviceAbi); string runtimeId = proj.GetProperty (KnownProperties.RuntimeIdentifier); diff --git a/tests/api-compatibility/acceptable-breakages-vReference-net7.0.txt b/tests/api-compatibility/acceptable-breakages-vReference-net8.0.txt similarity index 100% rename from tests/api-compatibility/acceptable-breakages-vReference-net7.0.txt rename to tests/api-compatibility/acceptable-breakages-vReference-net8.0.txt diff --git a/tools/remap-mam-json-to-xml/remap-mam-json-to-xml.csproj b/tools/remap-mam-json-to-xml/remap-mam-json-to-xml.csproj index 6f1d6e85d38..0b7aae475c9 100644 --- a/tools/remap-mam-json-to-xml/remap-mam-json-to-xml.csproj +++ b/tools/remap-mam-json-to-xml/remap-mam-json-to-xml.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + $(DotNetStableTargetFramework) Xamarin.Android.Tools.RemapMapjsonToXml enable enable