Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try this again #1843

Merged
merged 6 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions cake/msbuild.cake
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,34 @@ 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",
"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").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();

EnsureDirectoryExists(OUTPUT_NUGETS_PATH);

var settings = new NuGetRestoreSettings {
Source = NUGETS_SOURCES,
Source = GetNuGetSources(),
NoCache = true,
PackagesDirectory = dir.Combine("packages"),
};
Expand Down Expand Up @@ -92,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())}\"");
});
}
13 changes: 13 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="darc-pub-dotnet-aspnetcore" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-aspnetcore-7c57ecbd-3/nuget/v3/index.json" />
<add key="darc-pub-dotnet-runtime" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-4822e3c3-5/nuget/v3/index.json" />
<add key="darc-pub-dotnet-windowsdesktop" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-windowsdesktop-59fea7da-4/nuget/v3/index.json" />
<add key="darc-pub-dotnet-emsdk" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-1ec2e17f-4/nuget/v3/index.json" />
</packageSources>
</configuration>