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`.'
#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")'
@{

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`.'
#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")'
@{

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
@{
@ -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<string, Exception>();
var skipped = new List<string>();
foreach(var repo in repositories)
{
var blockName = string.Format("Building {0}", repo);
@ -678,38 +686,39 @@ functions
IEnumerable<string> reposToBuild = new HashSet<string>(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");