From 3c9ad87b73924fa7d53a8649d787b0415bd19190 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Sun, 19 Feb 2017 15:03:11 +0000 Subject: [PATCH 1/3] Fix cake on Mac. Also added compile-time support for OSX.10.12-x64. The acceptance tests still fail on this version of OS X, however, because of the funky stuff going on in TestConfiguration.cs. Fixing this is outside the scope of this issue. --- build.cake | 32 ++++++++++++++---------- test/Ocelot.AcceptanceTests/project.json | 7 +++--- test/Ocelot.Benchmarks/project.json | 5 ++-- test/Ocelot.ManualTest/project.json | 5 ++-- test/Ocelot.UnitTests/project.json | 5 ++-- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/build.cake b/build.cake index 579f4e82..9a12e73a 100644 --- a/build.cake +++ b/build.cake @@ -80,7 +80,7 @@ Task("Version") if (AppVeyor.IsRunningOnAppVeyor) { Information("Persisting version number..."); - PersistVersion(nugetVersion); + PersistVersion(committedVersion, nugetVersion); buildVersion = nugetVersion; } else @@ -158,7 +158,7 @@ Task("CreatePackages") { EnsureDirectoryExists(packagesDir); - GenerateReleaseNotes(); + GenerateReleaseNotes(releaseNotesFile); var settings = new DotNetCorePackSettings { @@ -189,7 +189,7 @@ Task("ReleasePackagesToUnstableFeed") .IsDependentOn("CreatePackages") .Does(() => { - PublishPackages(nugetFeedUnstableKey, nugetFeedUnstableUploadUrl, nugetFeedUnstableSymbolsUploadUrl); + PublishPackages(packagesDir, artifactsFile, nugetFeedUnstableKey, nugetFeedUnstableUploadUrl, nugetFeedUnstableSymbolsUploadUrl); }); Task("EnsureStableReleaseRequirements") @@ -241,7 +241,7 @@ Task("ReleasePackagesToStableFeed") .IsDependentOn("DownloadGitHubReleaseArtifacts") .Does(() => { - PublishPackages(nugetFeedStableKey, nugetFeedStableUploadUrl, nugetFeedStableSymbolsUploadUrl); + PublishPackages(packagesDir, artifactsFile, nugetFeedStableKey, nugetFeedStableUploadUrl, nugetFeedStableSymbolsUploadUrl); }); Task("Release") @@ -262,9 +262,9 @@ private string GetNuGetVersionForCommit() } /// Updates project version in all of our projects -private void PersistVersion(string version) +private void PersistVersion(string committedVersion, string newVersion) { - Information(string.Format("We'll search all project.json files for {0} and replace with {1}...", committedVersion, version)); + Information(string.Format("We'll search all project.json files for {0} and replace with {1}...", committedVersion, newVersion)); var projectJsonFiles = GetFiles("./**/project.json"); @@ -275,24 +275,30 @@ private void PersistVersion(string version) Information(string.Format("Updating {0}...", file)); var updatedProjectJson = System.IO.File.ReadAllText(file) - .Replace(committedVersion, version); + .Replace(committedVersion, newVersion); System.IO.File.WriteAllText(file, updatedProjectJson); } } /// generates release notes based on issues closed in GitHub since the last release -private void GenerateReleaseNotes() +private void GenerateReleaseNotes(string file) { - Information("Generating release notes at " + releaseNotesFile); + if (!IsRunningOnWindows()) + { + Warning("We can't generate release notes as we're not running on Windows."); + return; + } + + Information("Generating release notes at " + file); var releaseNotesExitCode = StartProcess( @"tools/GitReleaseNotes/tools/gitreleasenotes.exe", - new ProcessSettings { Arguments = ". /o " + releaseNotesFile }); + new ProcessSettings { Arguments = ". /o " + file }); - if (string.IsNullOrEmpty(System.IO.File.ReadAllText(releaseNotesFile))) + if (string.IsNullOrEmpty(System.IO.File.ReadAllText(file))) { - System.IO.File.WriteAllText(releaseNotesFile, "No issues closed since last release"); + System.IO.File.WriteAllText(file, "No issues closed since last release"); } if (releaseNotesExitCode != 0) @@ -302,7 +308,7 @@ private void GenerateReleaseNotes() } /// Publishes code and symbols packages to nuget feed, based on contents of artifacts file -private void PublishPackages(string feedApiKey, string codeFeedUrl, string symbolFeedUrl) +private void PublishPackages(string packagesDir, string artifactsFile, string feedApiKey, string codeFeedUrl, string symbolFeedUrl) { var artifacts = System.IO.File .ReadAllLines(artifactsFile) diff --git a/test/Ocelot.AcceptanceTests/project.json b/test/Ocelot.AcceptanceTests/project.json index 41594e1f..7739992a 100644 --- a/test/Ocelot.AcceptanceTests/project.json +++ b/test/Ocelot.AcceptanceTests/project.json @@ -38,9 +38,10 @@ "xunit": "2.2.0-rc1-build3507" }, "runtimes": { - "win10-x64": {}, - "osx.10.11-x64": {}, - "win7-x64": {} + "osx.10.11-x64":{}, + "osx.10.12-x64":{}, + "win7-x64": {}, + "win10-x64": {} }, "frameworks": { "netcoreapp1.1": { diff --git a/test/Ocelot.Benchmarks/project.json b/test/Ocelot.Benchmarks/project.json index 061a2223..615b9d0e 100644 --- a/test/Ocelot.Benchmarks/project.json +++ b/test/Ocelot.Benchmarks/project.json @@ -9,9 +9,10 @@ "BenchmarkDotNet": "0.10.2" }, "runtimes": { - "win10-x64": {}, "osx.10.11-x64":{}, - "win7-x64": {} + "osx.10.12-x64":{}, + "win7-x64": {}, + "win10-x64": {} }, "frameworks": { "netcoreapp1.1": { diff --git a/test/Ocelot.ManualTest/project.json b/test/Ocelot.ManualTest/project.json index cf67f9bd..433b1dc0 100644 --- a/test/Ocelot.ManualTest/project.json +++ b/test/Ocelot.ManualTest/project.json @@ -19,9 +19,10 @@ "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "runtimes": { - "win10-x64": {}, "osx.10.11-x64":{}, - "win7-x64": {} + "osx.10.12-x64":{}, + "win7-x64": {}, + "win10-x64": {} }, "frameworks": { "netcoreapp1.1": { diff --git a/test/Ocelot.UnitTests/project.json b/test/Ocelot.UnitTests/project.json index 2f42c283..30ad3684 100644 --- a/test/Ocelot.UnitTests/project.json +++ b/test/Ocelot.UnitTests/project.json @@ -27,9 +27,10 @@ "xunit": "2.2.0-rc1-build3507" }, "runtimes": { - "win10-x64": {}, "osx.10.11-x64":{}, - "win7-x64": {} + "osx.10.12-x64":{}, + "win7-x64": {}, + "win10-x64": {} }, "frameworks": { "netcoreapp1.1": { From eb5dfc697538f8956e1dd3f04edf45fba3c686f6 Mon Sep 17 00:00:00 2001 From: TomPallister Date: Sun, 19 Feb 2017 15:43:58 +0000 Subject: [PATCH 2/3] removed test configuration nonsense --- .../TestConfiguration.cs | 36 +++---------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/test/Ocelot.AcceptanceTests/TestConfiguration.cs b/test/Ocelot.AcceptanceTests/TestConfiguration.cs index ce802efb..3265955d 100644 --- a/test/Ocelot.AcceptanceTests/TestConfiguration.cs +++ b/test/Ocelot.AcceptanceTests/TestConfiguration.cs @@ -1,36 +1,10 @@ -namespace Ocelot.AcceptanceTests -{ - using System.Runtime.InteropServices; +using System; +using System.IO; +namespace Ocelot.AcceptanceTests +{ public static class TestConfiguration { - public static double Version => 1.1; - public static string ConfigurationPath => GetConfigurationPath(); - - public static string GetConfigurationPath() - { - var osArchitecture = RuntimeInformation.OSArchitecture.ToString(); - - if(RuntimeInformation.OSDescription.ToLower().Contains("darwin")) - { - return FormatConfigurationPath("osx.10.11", osArchitecture); - } - - if(RuntimeInformation.OSDescription.ToLower().Contains("microsoft windows 10")) - { - return FormatConfigurationPath("win10", osArchitecture); - } - - return FormatConfigurationPath("win7", osArchitecture); - } - - private static string FormatConfigurationPath(string oSDescription, string osArchitecture) - { - var runTime = $"{oSDescription}-{osArchitecture}".ToLower(); - - var configPath = $"./bin/Debug/netcoreapp{Version}/{runTime}/configuration.json"; - - return configPath; - } + public static string ConfigurationPath => Path.Combine(AppContext.BaseDirectory, "configuration.json"); } } From f1a403ae29bbc5b5d2d096e5a67bd07c5d8c66f1 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Sun, 19 Feb 2017 20:56:05 +0000 Subject: [PATCH 3/3] Fix package publishing --- build.cake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.cake b/build.cake index 9a12e73a..94af4431 100644 --- a/build.cake +++ b/build.cake @@ -282,7 +282,7 @@ private void PersistVersion(string committedVersion, string newVersion) } /// generates release notes based on issues closed in GitHub since the last release -private void GenerateReleaseNotes(string file) +private void GenerateReleaseNotes(ConvertableFilePath file) { if (!IsRunningOnWindows()) { @@ -308,7 +308,7 @@ private void GenerateReleaseNotes(string file) } /// Publishes code and symbols packages to nuget feed, based on contents of artifacts file -private void PublishPackages(string packagesDir, string artifactsFile, string feedApiKey, string codeFeedUrl, string symbolFeedUrl) +private void PublishPackages(ConvertableDirectoryPath packagesDir, ConvertableFilePath artifactsFile, string feedApiKey, string codeFeedUrl, string symbolFeedUrl) { var artifacts = System.IO.File .ReadAllLines(artifactsFile) @@ -317,8 +317,7 @@ private void PublishPackages(string packagesDir, string artifactsFile, string fe var codePackage = packagesDir + File(artifacts["nuget"]); - Information("Pushing package"); - + Information("Pushing package " + codePackage); NuGetPush( codePackage, new NuGetPushSettings {