diff --git a/KoreBuild-dotnet/build/_k-standard-goals.shade b/KoreBuild-dotnet/build/_k-standard-goals.shade index 4f377468bc..e1c5977720 100644 --- a/KoreBuild-dotnet/build/_k-standard-goals.shade +++ b/KoreBuild-dotnet/build/_k-standard-goals.shade @@ -69,6 +69,7 @@ default NUGET_FEED = 'https://api.nuget.org/v3/index.json' #deep-clean .clean-npm-modules .clean-bin-folder description='Clean folders that may cause problems for `git clean`.' #repo-initialize target='initialize' + use-volatile-feed dotnet-restore if='!NoRestore' #target-dir-clean target='clean' @@ -170,9 +171,11 @@ default NUGET_FEED = 'https://api.nuget.org/v3/index.json' } } -#nuget-install target='install' if='Directory.Exists("src")' description='Install NuGet packages to local repo' - nuget-packages-add sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}' - nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' +#nuget-install target='install' description='Install NuGet packages to local repo' + -if (Directory.Exists("src")) { + nuget-packages-add sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}' + nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' + -} #xunit-test target='test' if='Directory.Exists("test")' @{ diff --git a/KoreBuild-dotnet/build/_use-volatile-feed.shade b/KoreBuild-dotnet/build/_use-volatile-feed.shade new file mode 100644 index 0000000000..f23e301037 --- /dev/null +++ b/KoreBuild-dotnet/build/_use-volatile-feed.shade @@ -0,0 +1,36 @@ +use namespace="System.Collections" +use namespace="System.Xml.Linq" + +@{ + var prefix = "NUGET_VOLATILE_FEED_"; + + var feeds = Environment.GetEnvironmentVariables() + .Cast() + .Where(entry => ((string)entry.Key).StartsWith("NUGET_VOLATILE_FEED_")) + .Select(entry => new KeyValuePair(((string)entry.Key).Substring(prefix.Length), (string)entry.Value)) + .ToList(); + + if (!feeds.Any()) + { + return; + } + + var nugetConfig = XDocument.Load("NuGet.config"); + var packageSources = nugetConfig.Element("configuration").Element("packageSources"); + var addElements = packageSources.Elements("add").ToList(); + foreach (var feed in feeds) + { + var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase)); + if (valueToUpdate == null) + { + packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value))); + } + else + { + valueToUpdate.Attribute("value").Value = feed.Value; + } + } + + nugetConfig.Save("NuGet.config"); +} + diff --git a/build/_k-standard-goals.shade b/build/_k-standard-goals.shade index 90519f56c9..f4b8c3519f 100644 --- a/build/_k-standard-goals.shade +++ b/build/_k-standard-goals.shade @@ -71,6 +71,7 @@ default NUGET_FEED = 'https://api.nuget.org/v3/index.json' #deep-clean .clean-npm-modules .clean-bin-folder description='Clean folders that may cause problems for `git clean`.' #repo-initialize target='initialize' + use-volatile-feed k-restore #target-dir-clean target='clean' @@ -202,9 +203,11 @@ default NUGET_FEED = 'https://api.nuget.org/v3/index.json' } } -#nuget-install target='install' if='Directory.Exists("src")' description='Install NuGet packages to local repo' - kpm-publish sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}' - nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' +#nuget-install target='install' description='Install NuGet packages to local repo' + -if (Directory.Exists("src") { + kpm-publish sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}' + nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' + - } #xunit-test target='test' if='Directory.Exists("test")' @{ diff --git a/build/_use-volatile-feed.shade b/build/_use-volatile-feed.shade new file mode 100644 index 0000000000..f23e301037 --- /dev/null +++ b/build/_use-volatile-feed.shade @@ -0,0 +1,36 @@ +use namespace="System.Collections" +use namespace="System.Xml.Linq" + +@{ + var prefix = "NUGET_VOLATILE_FEED_"; + + var feeds = Environment.GetEnvironmentVariables() + .Cast() + .Where(entry => ((string)entry.Key).StartsWith("NUGET_VOLATILE_FEED_")) + .Select(entry => new KeyValuePair(((string)entry.Key).Substring(prefix.Length), (string)entry.Value)) + .ToList(); + + if (!feeds.Any()) + { + return; + } + + var nugetConfig = XDocument.Load("NuGet.config"); + var packageSources = nugetConfig.Element("configuration").Element("packageSources"); + var addElements = packageSources.Elements("add").ToList(); + foreach (var feed in feeds) + { + var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase)); + if (valueToUpdate == null) + { + packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value))); + } + else + { + valueToUpdate.Attribute("value").Value = feed.Value; + } + } + + nugetConfig.Save("NuGet.config"); +} + diff --git a/makefile.shade b/makefile.shade index c6fa7d010c..3bb49a6845 100644 --- a/makefile.shade +++ b/makefile.shade @@ -70,9 +70,11 @@ var buildTarget = "compile" }); } -#verify-all .pull .change-default-build-target .only-compile +#verify-all .pull .change-default-build-target-to-verify .build-all -#smoke-test-mono .pull .fix-project-json .change-default-build-target .only-compile +#build-and-install-all .pull .change-default-build-target-for-coherence-build .build-all + +#smoke-test-mono .pull .fix-project-json .change-default-build-target-to-verify .build-all #fix-project-json @{ @@ -87,11 +89,14 @@ var buildTarget = "compile" updateText = updateText.Replace(".NETPortable,Version=v4.6,Profile=Profile151", "foo"); } -#change-default-build-target +#change-default-build-target-to-verify @{ buildTarget = "verify"; } +#change-default-build-target-for-coherence-build + - buildTarget = "compile nuget-install"; + #init @{ var templatePath = Path.Combine(BASE_DIR, "build-template"); @@ -309,11 +314,14 @@ var buildTarget = "compile" } } -#only-compile target='compile' +#only-compile .build-all + -Log.Warn("only-compile target is deprecated. Use build-all"); + +#build-all target='compile' @{ var failed = new Dictionary(); var skipped = new List(); - + foreach(var repo in repositories) { var blockName = string.Format("Building {0}", repo); @@ -678,38 +686,39 @@ functions IEnumerable reposToBuild = new HashSet(StringComparer.OrdinalIgnoreCase) { // The repos list is topologically sorted based on build order "Common", + "JsonPatch", + "FileSystem", "Configuration", "DependencyInjection", - "Microsoft.Data.Sqlite", "EventNotification", "Options", "Logging", + "dnx-watch", + "HtmlAbstractions", "UserSecrets", "DataProtection", - "Caching", "HttpAbstractions", "Testing", "aspnet.xunit", - "FileSystem", - "JsonPatch", + "Microsoft.Data.Sqlite", + "Caching", "Razor", "RazorTooling", "Hosting", "EntityFramework", "WebListener", - "libuv-build", "KestrelHttpServer", "IISIntegration", "ServerTests", - "Diagnostics", - "Antiforgery", + "Session", "CORS", - "Security", "Routing", "StaticFiles", + "Diagnostics", + "Security", + "Antiforgery", "WebSockets", "Localization", - "Session", "BasicMiddleware", "Proxy", "Mvc", @@ -718,10 +727,10 @@ functions "SignalR-Server", "SignalR-SQLServer", "SignalR-Redis", + "SignalR-ServiceBus", "BrowserLink", - "dnx-watch", "Entropy", - "MusicStore" + "MusicStore", }; var repositoryInclude = Environment.GetEnvironmentVariable("KOREBUILD_REPOSITORY_INCLUDE");