From 3f2b090f550d5c1fa8d63b309a64f9df05698768 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Wed, 15 Nov 2023 18:29:52 -0500 Subject: [PATCH] [build] Remove NuGet.exe provisioning (#8506) Our build requires the .NET SDK, and NuGet operations should now be performed by `dotnet build` and `dotnet nuget` invocations. We no longer need to install an out of date NuGet.exe. --- .../xaprepare/Application/Scenario.cs | 5 +- .../xaprepare/ConfigAndData/Configurables.cs | 3 -- .../ConfigAndData/Dependencies/Linux.Arch.cs | 1 - .../Dependencies/Linux.DebianCommon.cs | 1 - .../Dependencies/Linux.Fedora.cs | 1 - .../Dependencies/Linux.Gentoo.cs | 1 - .../xaprepare/Steps/Step_DownloadNuGet.cs | 51 ------------------- .../Xamarin.ProjectTools.csproj | 4 -- 8 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 build-tools/xaprepare/xaprepare/Steps/Step_DownloadNuGet.cs diff --git a/build-tools/xaprepare/xaprepare/Application/Scenario.cs b/build-tools/xaprepare/xaprepare/Application/Scenario.cs index 18bf933fd7f..8fc45c50464 100644 --- a/build-tools/xaprepare/xaprepare/Application/Scenario.cs +++ b/build-tools/xaprepare/xaprepare/Application/Scenario.cs @@ -59,10 +59,7 @@ public void Init (Context context) } protected virtual void AddStartSteps (Context context) - { - // These are steps that have to be executed by all the scenarios - Steps.Add (new Step_DownloadNuGet ()); - } + {} protected virtual void AddEndSteps (Context context) {} diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs index 5911e6bce70..5ff25c65367 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs @@ -45,8 +45,6 @@ public static partial class Urls /// public static readonly Uri AndroidToolchain_AndroidUri = new Uri ("https://dl.google.com/android/repository/"); - public static readonly Uri NugetUri = new Uri ("https://dist.nuget.org/win-x86-commandline/v6.0.0/nuget.exe"); - public static Uri MonoArchive_BaseUri = new Uri ("https://xamjenkinsartifact.azureedge.net/mono-sdks/"); public static Uri BinutilsArchive = new Uri ($"https://github.com/xamarin/xamarin-android-binutils/releases/download/{BinutilsVersion}/xamarin-android-toolchain-{BinutilsVersion}.7z"); @@ -238,7 +236,6 @@ public static partial class Paths public static readonly string BuildToolsScriptsDir = Path.Combine (BuildToolsDir, "scripts"); public static readonly string BinDirRoot = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "bin"); public static readonly string ExternalDir = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "external"); - public static readonly string LocalNugetPath = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, ".nuget", "NuGet.exe"); public static readonly string ExternalGitDepsFilePath = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, ".external"); public static readonly string ExternalGitDepsDestDir = ExternalDir; public static readonly string ExternalXamarinAndroidToolsSln = Path.Combine (ExternalDir, "xamarin-android-tools", "Xamarin.Android.Tools.sln"); diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Arch.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Arch.cs index 3a50773eea8..eeaa713b6bf 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Arch.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Arch.cs @@ -27,7 +27,6 @@ class LinuxArch : Linux new ArchLinuxProgram ("libzip"), new ArchLinuxProgram ("m4"), new ArchLinuxProgram ("make"), - new ArchLinuxProgram ("nuget"), new ArchLinuxProgram ("patch"), new ArchLinuxProgram ("pkg-config"), new ArchLinuxProgram ("referenceassemblies-pcl"), diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.DebianCommon.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.DebianCommon.cs index a37e9ff3217..405440add33 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.DebianCommon.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.DebianCommon.cs @@ -24,7 +24,6 @@ abstract class LinuxDebianCommon : Linux new DebianLinuxProgram ("linux-libc-dev"), new DebianLinuxProgram ("make"), new DebianLinuxProgram ("ninja-build", "ninja"), - new DebianLinuxProgram ("nuget"), new DebianLinuxProgram ("p7zip-full", "7z"), new DebianLinuxProgram ("sqlite3"), new DebianLinuxProgram ("vim-common"), diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Fedora.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Fedora.cs index a5b86053c5b..bbd244b5267 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Fedora.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Fedora.cs @@ -27,7 +27,6 @@ class LinuxFedora : Linux new FedoraLinuxProgram ("libzip"), new FedoraLinuxProgram ("m4"), new FedoraLinuxProgram ("make"), - new FedoraLinuxProgram ("nuget"), new FedoraLinuxProgram ("patch"), new FedoraLinuxProgram ("pkgconf"), new FedoraLinuxProgram ("referenceassemblies-pcl"), diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Gentoo.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Gentoo.cs index b7a085b5760..d335db6edb6 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Gentoo.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Gentoo.cs @@ -27,7 +27,6 @@ class LinuxGentoo : Linux new GentooLinuxProgram ("dev-libs/libzip"), new GentooLinuxProgram ("sys-devel/m4"), new GentooLinuxProgram ("sys-devel/make"), - //new GentooLinuxProgram ("nuget"), new GentooLinuxProgram ("sys-devel/patch"), new GentooLinuxProgram ("dev-util/pkgconf"), //new GentooLinuxProgram ("referenceassemblies-pcl"), diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_DownloadNuGet.cs b/build-tools/xaprepare/xaprepare/Steps/Step_DownloadNuGet.cs deleted file mode 100644 index a2bdbbf287a..00000000000 --- a/build-tools/xaprepare/xaprepare/Steps/Step_DownloadNuGet.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.IO; -using System.Net; -using System.Threading.Tasks; - -namespace Xamarin.Android.Prepare -{ - class Step_DownloadNuGet : StepWithDownloadProgress - { - public Step_DownloadNuGet () - : base ("Download NuGet") - {} - - protected override async Task Execute (Context context) - { - if (context == null) - throw new ArgumentNullException (nameof (context)); - - Uri nugetUrl = Configurables.Urls.NugetUri; - string localNugetPath = Configurables.Paths.LocalNugetPath; - - if (Utilities.FileExists (localNugetPath)) { - Log.StatusLine ($"NuGet already downloaded ({localNugetPath})"); - return true; - } - - Utilities.CreateDirectory (Path.GetDirectoryName (localNugetPath)); - Log.StatusLine ("Downloading NuGet"); - - (bool success, ulong size, HttpStatusCode status) = await Utilities.GetDownloadSizeWithStatus (nugetUrl); - if (!success) { - if (status == HttpStatusCode.NotFound) - Log.ErrorLine ("NuGet URL not found"); - else - Log.ErrorLine ("Failed to obtain NuGet size. HTTP status code: {status} ({(int)status})"); - return false; - } - - DownloadStatus downloadStatus = Utilities.SetupDownloadStatus (context, size, context.InteractiveSession); - Log.StatusLine ($" {context.Characters.Link} {nugetUrl}", ConsoleColor.White); - await Download (context, nugetUrl, localNugetPath, "NuGet", Path.GetFileName (localNugetPath), downloadStatus); - - if (!File.Exists (localNugetPath)) { - Log.ErrorLine ($"Download of NuGet from {nugetUrl} failed"); - return false; - } - - return true; - } - } -} diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj index fb4dfe53ce0..1f10e632927 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.csproj @@ -20,10 +20,6 @@ - - ..\nuget\NuGet.exe - PreserveNewest - PreserveNewest