Add support for Coherence build

This commit is contained in:
Pranav K 2016-02-18 09:39:42 -08:00
parent 1a94903930
commit 53eb708a8b
5 changed files with 109 additions and 22 deletions

View File

@ -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`.' #deep-clean .clean-npm-modules .clean-bin-folder description='Clean folders that may cause problems for `git clean`.'
#repo-initialize target='initialize' #repo-initialize target='initialize'
use-volatile-feed
dotnet-restore if='!NoRestore' dotnet-restore if='!NoRestore'
#target-dir-clean target='clean' #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-install target='install' description='Install NuGet packages to local repo'
nuget-packages-add sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}' -if (Directory.Exists("src")) {
nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' 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")' #xunit-test target='test' if='Directory.Exists("test")'
@{ @{

View File

@ -0,0 +1,36 @@
use namespace="System.Collections"
use namespace="System.Xml.Linq"
@{
var prefix = "NUGET_VOLATILE_FEED_";
var feeds = Environment.GetEnvironmentVariables()
.Cast<DictionaryEntry>()
.Where(entry => ((string)entry.Key).StartsWith("NUGET_VOLATILE_FEED_"))
.Select(entry => new KeyValuePair<string, string>(((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");
}

View File

@ -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`.' #deep-clean .clean-npm-modules .clean-bin-folder description='Clean folders that may cause problems for `git clean`.'
#repo-initialize target='initialize' #repo-initialize target='initialize'
use-volatile-feed
k-restore k-restore
#target-dir-clean target='clean' #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' #nuget-install target='install' description='Install NuGet packages to local repo'
kpm-publish sourcePackagesDir='${BUILD_DIR}' targetPackagesDir='${E("PACKAGES_PUBLISH_DIR")}' -if (Directory.Exists("src") {
nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' 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")' #xunit-test target='test' if='Directory.Exists("test")'
@{ @{

View File

@ -0,0 +1,36 @@
use namespace="System.Collections"
use namespace="System.Xml.Linq"
@{
var prefix = "NUGET_VOLATILE_FEED_";
var feeds = Environment.GetEnvironmentVariables()
.Cast<DictionaryEntry>()
.Where(entry => ((string)entry.Key).StartsWith("NUGET_VOLATILE_FEED_"))
.Select(entry => new KeyValuePair<string, string>(((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");
}

View File

@ -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 #fix-project-json
@{ @{
@ -87,11 +89,14 @@ var buildTarget = "compile"
updateText = updateText.Replace(".NETPortable,Version=v4.6,Profile=Profile151", "foo"); updateText = updateText.Replace(".NETPortable,Version=v4.6,Profile=Profile151", "foo");
} }
#change-default-build-target #change-default-build-target-to-verify
@{ @{
buildTarget = "verify"; buildTarget = "verify";
} }
#change-default-build-target-for-coherence-build
- buildTarget = "compile nuget-install";
#init #init
@{ @{
var templatePath = Path.Combine(BASE_DIR, "build-template"); 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<string, Exception>(); var failed = new Dictionary<string, Exception>();
var skipped = new List<string>(); var skipped = new List<string>();
foreach(var repo in repositories) foreach(var repo in repositories)
{ {
var blockName = string.Format("Building {0}", repo); var blockName = string.Format("Building {0}", repo);
@ -678,38 +686,39 @@ functions
IEnumerable<string> reposToBuild = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { IEnumerable<string> reposToBuild = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
// The repos list is topologically sorted based on build order // The repos list is topologically sorted based on build order
"Common", "Common",
"JsonPatch",
"FileSystem",
"Configuration", "Configuration",
"DependencyInjection", "DependencyInjection",
"Microsoft.Data.Sqlite",
"EventNotification", "EventNotification",
"Options", "Options",
"Logging", "Logging",
"dnx-watch",
"HtmlAbstractions",
"UserSecrets", "UserSecrets",
"DataProtection", "DataProtection",
"Caching",
"HttpAbstractions", "HttpAbstractions",
"Testing", "Testing",
"aspnet.xunit", "aspnet.xunit",
"FileSystem", "Microsoft.Data.Sqlite",
"JsonPatch", "Caching",
"Razor", "Razor",
"RazorTooling", "RazorTooling",
"Hosting", "Hosting",
"EntityFramework", "EntityFramework",
"WebListener", "WebListener",
"libuv-build",
"KestrelHttpServer", "KestrelHttpServer",
"IISIntegration", "IISIntegration",
"ServerTests", "ServerTests",
"Diagnostics", "Session",
"Antiforgery",
"CORS", "CORS",
"Security",
"Routing", "Routing",
"StaticFiles", "StaticFiles",
"Diagnostics",
"Security",
"Antiforgery",
"WebSockets", "WebSockets",
"Localization", "Localization",
"Session",
"BasicMiddleware", "BasicMiddleware",
"Proxy", "Proxy",
"Mvc", "Mvc",
@ -718,10 +727,10 @@ functions
"SignalR-Server", "SignalR-Server",
"SignalR-SQLServer", "SignalR-SQLServer",
"SignalR-Redis", "SignalR-Redis",
"SignalR-ServiceBus",
"BrowserLink", "BrowserLink",
"dnx-watch",
"Entropy", "Entropy",
"MusicStore" "MusicStore",
}; };
var repositoryInclude = Environment.GetEnvironmentVariable("KOREBUILD_REPOSITORY_INCLUDE"); var repositoryInclude = Environment.GetEnvironmentVariable("KOREBUILD_REPOSITORY_INCLUDE");