From 9c963af1745b6b7ca2bdb621aa7c1b4cc0e3da51 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Thu, 28 Oct 2021 18:46:25 +0200 Subject: [PATCH 1/5] Try this again --- cake/msbuild.cake | 1 - 1 file changed, 1 deletion(-) diff --git a/cake/msbuild.cake b/cake/msbuild.cake index 8bd1234ee7..338cc1f0f3 100644 --- a/cake/msbuild.cake +++ b/cake/msbuild.cake @@ -5,7 +5,6 @@ DirectoryPath OUTPUT_SYMBOLS_NUGETS_PATH = MakeAbsolute(ROOT_PATH.Combine("outpu var NUGETS_SOURCES = new [] { OUTPUT_NUGETS_PATH.FullPath, - "https://api.nuget.org/v3/index.json", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json", "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", "https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json", From 0a657868c11254261c5624501405342be3ef2817 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Thu, 28 Oct 2021 23:15:06 +0200 Subject: [PATCH 2/5] fast build --- scripts/azure-templates-bootstrapper.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/azure-templates-bootstrapper.yml b/scripts/azure-templates-bootstrapper.yml index 021fddeb9e..0ef6ed6853 100644 --- a/scripts/azure-templates-bootstrapper.yml +++ b/scripts/azure-templates-bootstrapper.yml @@ -17,7 +17,7 @@ parameters: condition: succeeded() # whether or not to run this template shouldPublish: true # whether or not to publish the artifacts configuration: $(CONFIGURATION) # the build configuration - buildExternals: '' # the build number to download externals from + buildExternals: '5382981' # the build number to download externals from verbosity: $(VERBOSITY) # the level of verbosity to use when building docker: '' # the Docker image to build and use dockerArgs: '' # any additional arguments to pass to docker build @@ -31,18 +31,18 @@ parameters: artifactName: '' # the name of the artifact to merge this run into jobs: -# - ${{ if startsWith(parameters.name, 'native_') }}: -# - template: azure-templates-download.yml -# parameters: -# name: ${{ parameters.name }} -# displayName: ${{ parameters.displayName }} -# vmImage: ${{ parameters.vmImage }} -# condition: ${{ parameters.condition }} -# postBuildSteps: ${{ parameters.postBuildSteps }} -# buildExternals: ${{ parameters.buildExternals }} -# artifactName: ${{ parameters.artifactName }} +- ${{ if startsWith(parameters.name, 'native_') }}: + - template: azure-templates-download.yml + parameters: + name: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + vmImage: ${{ parameters.vmImage }} + condition: ${{ parameters.condition }} + postBuildSteps: ${{ parameters.postBuildSteps }} + buildExternals: ${{ parameters.buildExternals }} + artifactName: ${{ parameters.artifactName }} -# - ${{ if not(startsWith(parameters.name, 'native_')) }}: +- ${{ if not(startsWith(parameters.name, 'native_')) }}: - job: ${{ parameters.name }} displayName: ${{ parameters.displayName }} timeoutInMinutes: 120 From 3e8bece14286bd450df7eb36d7981858cff51090 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Fri, 5 Nov 2021 01:23:49 +0200 Subject: [PATCH 3/5] Use a nuget.config file --- cake/msbuild.cake | 32 +++++++++++++++++++++----------- nuget.config | 13 +++++++++++++ 2 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 nuget.config diff --git a/cake/msbuild.cake b/cake/msbuild.cake index 338cc1f0f3..5d906b89e6 100644 --- a/cake/msbuild.cake +++ b/cake/msbuild.cake @@ -5,16 +5,26 @@ DirectoryPath OUTPUT_SYMBOLS_NUGETS_PATH = MakeAbsolute(ROOT_PATH.Combine("outpu var NUGETS_SOURCES = new [] { OUTPUT_NUGETS_PATH.FullPath, - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json", - "https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-7c57ecbd-3/nuget/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-4822e3c3-5/nuget/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-windowsdesktop-59fea7da-4/nuget/v3/index.json", - "https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-1ec2e17f-4/nuget/v3/index.json" }; +string[] GetNuGetSources() +{ + // load all the sources from nuget.config + var xdoc = XDocument.Load("nuget.config"); + var xmlns = xdoc.Root.Name.Namespace; + var adds = xdoc.Elements(xmlns + "configuration") + .Elements(xmlns + "packageSources") + .Elements(xmlns + "add") + .Select(x => x.Attribute("value")) + .ToList(); + + // add the NUGETS_SOURCES because it may contain local folders + adds.AddRange(NUGETS_SOURCES); + + // return all + return adds.ToArray(); +} + void RunNuGetRestorePackagesConfig(FilePath sln) { var dir = sln.GetDirectory(); @@ -22,7 +32,7 @@ void RunNuGetRestorePackagesConfig(FilePath sln) EnsureDirectoryExists(OUTPUT_NUGETS_PATH); var settings = new NuGetRestoreSettings { - Source = NUGETS_SOURCES, + Source = GetNuGetSources(), NoCache = true, PackagesDirectory = dir.Combine("packages"), }; @@ -91,8 +101,8 @@ void RunMSBuild( c.Properties [prop.Key] = new [] { prop.Value }; } } - // c.Properties ["RestoreSources"] = NUGETS_SOURCES; + // c.Properties ["RestoreSources"] = GetNuGetSources(); var sep = IsRunningOnWindows() ? ";" : "%3B"; - c.ArgumentCustomization = args => args.Append($"/p:RestoreSources=\"{string.Join(sep, NUGETS_SOURCES)}\""); + c.ArgumentCustomization = args => args.Append($"/p:RestoreSources=\"{string.Join(sep, GetNuGetSources())}\""); }); } diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000000..e796bb2610 --- /dev/null +++ b/nuget.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + From c7bd4e622019b8ae200396c25593f72bcd132fbc Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Fri, 5 Nov 2021 02:35:50 +0200 Subject: [PATCH 4/5] oops --- cake/msbuild.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/msbuild.cake b/cake/msbuild.cake index 5d906b89e6..cef3b6839c 100644 --- a/cake/msbuild.cake +++ b/cake/msbuild.cake @@ -15,7 +15,7 @@ string[] GetNuGetSources() var adds = xdoc.Elements(xmlns + "configuration") .Elements(xmlns + "packageSources") .Elements(xmlns + "add") - .Select(x => x.Attribute("value")) + .Select(x => x.Attribute("value").Value) .ToList(); // add the NUGETS_SOURCES because it may contain local folders From 87c320dbafd5ab3eb200bfcec218005e9df46916 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sat, 6 Nov 2021 00:16:08 +0200 Subject: [PATCH 5/5] Restore azure-templates-bootstrapper.yml --- scripts/azure-templates-bootstrapper.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/azure-templates-bootstrapper.yml b/scripts/azure-templates-bootstrapper.yml index 0ef6ed6853..021fddeb9e 100644 --- a/scripts/azure-templates-bootstrapper.yml +++ b/scripts/azure-templates-bootstrapper.yml @@ -17,7 +17,7 @@ parameters: condition: succeeded() # whether or not to run this template shouldPublish: true # whether or not to publish the artifacts configuration: $(CONFIGURATION) # the build configuration - buildExternals: '5382981' # the build number to download externals from + buildExternals: '' # the build number to download externals from verbosity: $(VERBOSITY) # the level of verbosity to use when building docker: '' # the Docker image to build and use dockerArgs: '' # any additional arguments to pass to docker build @@ -31,18 +31,18 @@ parameters: artifactName: '' # the name of the artifact to merge this run into jobs: -- ${{ if startsWith(parameters.name, 'native_') }}: - - template: azure-templates-download.yml - parameters: - name: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - vmImage: ${{ parameters.vmImage }} - condition: ${{ parameters.condition }} - postBuildSteps: ${{ parameters.postBuildSteps }} - buildExternals: ${{ parameters.buildExternals }} - artifactName: ${{ parameters.artifactName }} +# - ${{ if startsWith(parameters.name, 'native_') }}: +# - template: azure-templates-download.yml +# parameters: +# name: ${{ parameters.name }} +# displayName: ${{ parameters.displayName }} +# vmImage: ${{ parameters.vmImage }} +# condition: ${{ parameters.condition }} +# postBuildSteps: ${{ parameters.postBuildSteps }} +# buildExternals: ${{ parameters.buildExternals }} +# artifactName: ${{ parameters.artifactName }} -- ${{ if not(startsWith(parameters.name, 'native_')) }}: +# - ${{ if not(startsWith(parameters.name, 'native_')) }}: - job: ${{ parameters.name }} displayName: ${{ parameters.displayName }} timeoutInMinutes: 120