From cb2047514460042c4fc2609252cda4265fb0409a Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 31 Oct 2013 14:58:24 +1100 Subject: [PATCH 1/5] this is all @paulcbetts fault --- Octokit.Tests/OctoKit.Tests-NetCore45.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj index 4b5e4a7b..46736d12 100644 --- a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj +++ b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj @@ -109,7 +109,7 @@ {c8bc13b6-3fa3-4716-827d-e7706f976fe1} - OctokitRT + Octokit-NetCore45 From db2fae206cd11b9126ca7ae09ea2753f179ce8fb Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 31 Oct 2013 15:01:31 +1100 Subject: [PATCH 2/5] down with compatibility shims! --- .../Clients/IObservableMiscellaneousClient.cs | 1 + .../Clients/ObservableMiscellaneousClient.cs | 1 + Octokit/Clients/CommitStatusClient.cs | 4 +- Octokit/Clients/ICommitStatusClient.cs | 4 +- Octokit/Helpers/Net45CompatibilityShim.cs | 114 ------------------ Octokit/Octokit.csproj | 3 +- 6 files changed, 5 insertions(+), 122 deletions(-) delete mode 100644 Octokit/Helpers/Net45CompatibilityShim.cs diff --git a/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs b/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs index 9c216adb..ecf58209 100644 --- a/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs +++ b/Octokit.Reactive/Clients/IObservableMiscellaneousClient.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace Octokit.Reactive diff --git a/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs b/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs index d18d4c12..702e7ee1 100644 --- a/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs +++ b/Octokit.Reactive/Clients/ObservableMiscellaneousClient.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Reactive.Threading.Tasks; namespace Octokit.Reactive diff --git a/Octokit/Clients/CommitStatusClient.cs b/Octokit/Clients/CommitStatusClient.cs index a9fb46cf..d743c237 100644 --- a/Octokit/Clients/CommitStatusClient.cs +++ b/Octokit/Clients/CommitStatusClient.cs @@ -1,6 +1,4 @@ -#if NETFX_CORE -using System.Collections.Generic; -#endif +using System.Collections.Generic; using System.Threading.Tasks; namespace Octokit diff --git a/Octokit/Clients/ICommitStatusClient.cs b/Octokit/Clients/ICommitStatusClient.cs index 41842253..30f15d13 100644 --- a/Octokit/Clients/ICommitStatusClient.cs +++ b/Octokit/Clients/ICommitStatusClient.cs @@ -1,6 +1,4 @@ -#if NETFX_CORE -using System.Collections.Generic; -#endif +using System.Collections.Generic; using System.Threading.Tasks; namespace Octokit diff --git a/Octokit/Helpers/Net45CompatibilityShim.cs b/Octokit/Helpers/Net45CompatibilityShim.cs deleted file mode 100644 index 7037a88c..00000000 --- a/Octokit/Helpers/Net45CompatibilityShim.cs +++ /dev/null @@ -1,114 +0,0 @@ -// ---------------------------------------------------- -// THIS WHOLE File CAN GO AWAY WHEN WE TARGET 4.5 ONLY -// ---------------------------------------------------- -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; - -namespace Octokit -{ - [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - public interface IReadOnlyDictionary : IReadOnlyCollection> - { - bool ContainsKey(TKey key); - bool TryGetValue(TKey key, out TValue value); - - TValue this[TKey key] { get; } - IEnumerable Keys { get; } - IEnumerable Values { get; } - } - - [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - public interface IReadOnlyList : IReadOnlyCollection - { - TItem this[int index] { get; } - } - - public interface IReadOnlyCollection : IEnumerable - { - int Count { get; } - } - - public class ReadOnlyCollection : IReadOnlyList - { - readonly List _source; - - public ReadOnlyCollection(IList source) - { - _source = new List(source); - } - - public IEnumerator GetEnumerator() - { - return _source.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public int Count - { - get { return _source.Count; } - } - - public TItem this[int index] - { - get { return _source[index]; } - } - } - - [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - public class ReadOnlyDictionary : IReadOnlyDictionary - { - readonly IDictionary _source; - - public ReadOnlyDictionary(IDictionary source) - { - _source = new Dictionary(source); - } - - public IEnumerator> GetEnumerator() - { - return _source.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public int Count - { - get { return _source.Count; } - } - - public bool ContainsKey(TKey key) - { - return _source.ContainsKey(key); - } - - public bool TryGetValue(TKey key, out TValue value) - { - return _source.TryGetValue(key, out value); - } - - public TValue this[TKey key] - { - get { return _source[key]; } - } - - public IEnumerable Keys - { - get { return _source.Keys; } - } - - public IEnumerable Values - { - get { return _source.Values; } - } - } -} diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index ec45f73d..03b85f2d 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -117,7 +117,6 @@ - @@ -211,4 +210,4 @@ --> - + \ No newline at end of file From de2f978c1d3600bbf88c61c6e3bd8d773bf9dbb6 Mon Sep 17 00:00:00 2001 From: Haacked Date: Thu, 31 Oct 2013 10:06:50 -0700 Subject: [PATCH 3/5] Fix broken lukewarm test Synce we just return the task, this method is called immediately. That's fine for now. This unit test is just here to document the current behavior so we know when it changes. It changed! --- Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs index c9ee5e6c..dbbe60bf 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs @@ -26,7 +26,8 @@ namespace Octokit.Tests.Reactive var gitHubClient = new GitHubClient(connection); var client = new ObservableRepositoriesClient(gitHubClient); var observable = client.Get("stark", "ned"); - connection.Received(0).GetAsync(Args.Uri); + + connection.Received(1).GetAsync(Args.Uri, null, null); var result = await observable; connection.Received(1).GetAsync(Args.Uri, null, null); From dfb2790d462afc1c6018ec5f1c891b365135f267 Mon Sep 17 00:00:00 2001 From: Haacked Date: Thu, 31 Oct 2013 10:16:26 -0700 Subject: [PATCH 4/5] Fix output path for Octokit --- Octokit/Octokit.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index a81f702f..fc451b35 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -17,8 +17,8 @@ true full false - obj\Debug\Net40 - bin\Debug\Net40 + obj\Debug\Net45 + bin\Debug\Net45 TRACE;DEBUG;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 @@ -31,8 +31,8 @@ pdbonly true - obj\Release\Net40 - bin\Release\Net40 + obj\Release\Net45 + bin\Release\Net45 TRACE;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 From 818593bf3f99911134a844832c13d848a6ccb678 Mon Sep 17 00:00:00 2001 From: Haacked Date: Thu, 31 Oct 2013 16:13:15 -0700 Subject: [PATCH 5/5] Fix the CI build A recent change renamed the NetCore Octokit assembly to Octokit.dll. Since both our test projects are in the same directory, one will cause the NetCore Octokit.dll to overwrite the Net45 Octokit.dll. This commit makes sure the unit tests compile to different directories. --- Octokit.Reactive/Octokit.Reactive.csproj | 4 ++-- .../Octokit.Tests.Integration.csproj | 2 +- Octokit.Tests/OctoKit.Tests-NetCore45.csproj | 4 ++-- Octokit.Tests/Octokit.Tests.csproj | 4 ++-- Octokit.msbuild | 8 ++++---- Octokit/Octokit-netcore45.csproj | 4 ++-- Octokit/Octokit.csproj | 4 ++-- build.cmd | 4 ++-- script/cibuild.ps1 | 12 ++++++------ 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index 79722400..2bdad6a6 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -18,7 +18,7 @@ full false obj\Debug\Net40 - bin\Debug\Net40 + bin\Debug\Net45\ DEBUG;TRACE;CODE_ANALYSIS;NET_45 prompt 4 @@ -31,7 +31,7 @@ pdbonly true obj\Release\Net40 - bin\Release\Net40 + bin\Release\Net45\ TRACE;NET_45 prompt 4 diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj index c0b63d67..0366926c 100644 --- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj +++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj @@ -24,7 +24,7 @@ pdbonly true - bin\Release\ + bin\Release\Net45\ TRACE prompt 4 diff --git a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj index 46736d12..803627b3 100644 --- a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj +++ b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj @@ -16,7 +16,7 @@ true full false - bin\Debug\ + bin\Debug\NetCore45\ TRACE;DEBUG;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 @@ -24,7 +24,7 @@ pdbonly true - bin\Release\ + bin\Release\NetCore45\ TRACE;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj index 2bec1229..2e399b78 100644 --- a/Octokit.Tests/Octokit.Tests.csproj +++ b/Octokit.Tests/Octokit.Tests.csproj @@ -16,7 +16,7 @@ true full false - bin\Debug\ + bin\Debug\Net45\ TRACE;DEBUG;NET_45 prompt 4 @@ -24,7 +24,7 @@ pdbonly true - bin\Release\ + bin\Release\Net45\ TRACE;NET_45 prompt 4 diff --git a/Octokit.msbuild b/Octokit.msbuild index f6bd6b8f..1ffc872a 100644 --- a/Octokit.msbuild +++ b/Octokit.msbuild @@ -14,11 +14,11 @@ - + - - + + @@ -31,5 +31,5 @@ - + diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index 4ce98065..23698df4 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -29,7 +29,7 @@ pdbonly true obj\Release\NetCore45 - bin\Release\NetCore45 + bin\Release\NetCore45\ TRACE;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 @@ -180,4 +180,4 @@ --> - + \ No newline at end of file diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index fc451b35..b9a387e7 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -32,7 +32,7 @@ pdbonly true obj\Release\Net45 - bin\Release\Net45 + bin\Release\Net45\ TRACE;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 @@ -210,4 +210,4 @@ --> - + \ No newline at end of file diff --git a/build.cmd b/build.cmd index 7c4b2fc7..6b135685 100644 --- a/build.cmd +++ b/build.cmd @@ -14,8 +14,8 @@ if not exist packaging\octokit\lib\netcore45 mkdir packaging\octokit\lib\netcore copy LICENSE.txt packaging\octokit\ copy README.md packaging\octokit\ -copy Octokit\bin\Release\Octokit.dll packaging\octokit\lib\net45\ -copy Octokit\bin\WinRT\Release\OctokitRT.dll packaging\octokit\lib\netcore45\ +copy Octokit\bin\%config%\Net45\Octokit.dll packaging\octokit\lib\net45\ +copy Octokit\bin\%config%\NetCore45\Octokit.dll packaging\octokit\lib\netcore45\ tools\nuget\nuget.exe pack "octokit.nuspec" -BasePath packaging\octokit -Output packaging diff --git a/script/cibuild.ps1 b/script/cibuild.ps1 index bb26e07e..5212d2ab 100644 --- a/script/cibuild.ps1 +++ b/script/cibuild.ps1 @@ -84,8 +84,8 @@ if ($LastExitCode -ne 0) { Die-WithOutput $exitCode $output } -function Run-XUnit([string]$project, [int]$timeoutDuration, [string]$projectFolder = $project) { - $dll = "$projectFolder\bin\Release\$project.dll" +function Run-XUnit([string]$platform, [string]$project, [int]$timeoutDuration, [string]$projectFolder = $project) { + $dll = "$projectFolder\bin\Release\$platform\$project.dll" $xunitDirectory = Join-Path $rootDirectory tools\xunit $consoleRunner = Join-Path $xunitDirectory xunit.console.clr4.x86.exe @@ -102,7 +102,7 @@ function Run-XUnit([string]$project, [int]$timeoutDuration, [string]$projectFold $exitCode = 0 Write-Output "Running Octokit.Tests..." -$result = Run-XUnit Octokit.Tests 120 +$result = Run-XUnit Net45 Octokit.Tests 120 if ($result.ExitCode -eq 0) { # Print out the test result summary. Write-Output $result.Output[-1] @@ -112,8 +112,8 @@ if ($result.ExitCode -eq 0) { } Write-Output "" -Write-Output "Running OctokitRT.Tests..." -$result = Run-XUnit OctokitRT.Tests 120 Octokit.Tests +Write-Output "Running Octokit.Tests-NetCore45..." +$result = Run-XUnit NetCore45 Octokit.Tests-NetCore45 120 Octokit.Tests if ($result.ExitCode -eq 0) { # Print out the test result summary. Write-Output $result.Output[-1] @@ -124,7 +124,7 @@ if ($result.ExitCode -eq 0) { Write-Output "" Write-Output "Running Octokit.Tests.Integration..." -$result = Run-XUnit Octokit.Tests.Integration 180 +$result = Run-XUnit Net45 Octokit.Tests.Integration 180 if ($result.ExitCode -eq 0) { # Print out the test result summary. Write-Output $result.Output[-1]