From 4a8119e94c29589fcf89637d2aae5e4f400b0538 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 13:24:00 -0700 Subject: [PATCH 01/10] Migrate code to new .NET Core projects and target netstandard1.3 --- .../GitTools.Testing.Tests.csproj | 104 ++++-------------- src/GitTools.Testing.sln | 4 +- src/GitTools.Testing/GitTools.Testing.csproj | 100 ++++------------- 3 files changed, 46 insertions(+), 162 deletions(-) diff --git a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj index 3e9b281..bd5598b 100644 --- a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj +++ b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj @@ -1,92 +1,34 @@ - - - - + + - Debug - AnyCPU - {5CF365CF-85B2-4AA3-8A17-680EFDF617C5} - Library - Properties - GitTools.Testing.Tests - GitTools.Testing.Tests - v4.5 - 512 - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + net452;netcoreapp1.0 + true + false + - - - - - - - - - ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True - - - ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll - True - - - ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll - True - + + + + + - - - - + + + - - - Designer - + + + + + - + + - - {3DCA1530-7A7F-46E4-955F-B4358F1299FA} - GitTools.Testing - + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/GitTools.Testing.sln b/src/GitTools.Testing.sln index d376d76..164a639 100644 --- a/src/GitTools.Testing.sln +++ b/src/GitTools.Testing.sln @@ -12,9 +12,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".configs", ".configs", "{EB ..\README.md = ..\README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTools.Testing.Tests", "GitTools.Testing.Tests\GitTools.Testing.Tests.csproj", "{5CF365CF-85B2-4AA3-8A17-680EFDF617C5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitTools.Testing.Tests", "GitTools.Testing.Tests\GitTools.Testing.Tests.csproj", "{5CF365CF-85B2-4AA3-8A17-680EFDF617C5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitTools.Testing", "GitTools.Testing\GitTools.Testing.csproj", "{3DCA1530-7A7F-46E4-955F-B4358F1299FA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitTools.Testing", "GitTools.Testing\GitTools.Testing.csproj", "{3DCA1530-7A7F-46E4-955F-B4358F1299FA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/GitTools.Testing/GitTools.Testing.csproj b/src/GitTools.Testing/GitTools.Testing.csproj index 56136ec..23fe320 100644 --- a/src/GitTools.Testing/GitTools.Testing.csproj +++ b/src/GitTools.Testing/GitTools.Testing.csproj @@ -1,92 +1,34 @@ - - - - + + - Debug - AnyCPU - {3DCA1530-7A7F-46E4-955F-B4358F1299FA} - Library - Properties - GitTools.Testing - GitTools.Testing - v4.0 - 512 - 5 - - - + net452;netstandard1.3 + true + false + + + + $(DefineConstants);LIBLOG_PORTABLE + - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - bin\GitTools.Testing.xml 1591,414 - true - false - pdbonly - true - bin\ - TRACE - prompt - 4 - bin\GitTools.Testing.xml 1591 - true - false + - - ..\packages\LibGit2Sharp.0.23.0-pre20150419160303\lib\net40\LibGit2Sharp.dll - True - - - - - - - - + - - - - - - - - - - - - - - - - + + + - - + + + + + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file From 24d36ed5d8824ebae6a020eb96b8d6b9d219c447 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 14:48:25 -0700 Subject: [PATCH 02/10] Fix all Obsolete/Deprecated method calls for LibGit2Sharp methods --- .../Fixtures/BaseGitFlowRepositoryFixture.cs | 8 ++++---- src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs | 8 +++++--- src/GitTools.Testing/GitTestExtensions.cs | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs b/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs index e90d30d..02ee597 100644 --- a/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs +++ b/src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs @@ -12,17 +12,17 @@ public class BaseGitFlowRepositoryFixture : EmptyRepositoryFixture { /// /// Creates a repo with a develop branch off master which is a single commit ahead of master - /// + /// /// Master will be tagged with the initial version before branching develop /// - public BaseGitFlowRepositoryFixture(string initialVersion) : + public BaseGitFlowRepositoryFixture(string initialVersion) : this(r => r.MakeATaggedCommit(initialVersion)) { } /// /// Creates a repo with a develop branch off master which is a single commit ahead of master - /// + /// /// The initial setup actions will be performed before branching develop /// public BaseGitFlowRepositoryFixture(Action initialMasterAction) @@ -38,7 +38,7 @@ void SetupRepo(Action initialMasterAction) initialMasterAction(Repository); - Repository.Checkout(Repository.CreateBranch("develop")); + Commands.Checkout(Repository, Repository.CreateBranch("develop")); Repository.MakeACommit(); } } diff --git a/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs b/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs index 9bedc65..9c38132 100644 --- a/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs +++ b/src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs @@ -65,7 +65,7 @@ public virtual void Dispose() public void Checkout(string branch) { - Repository.Checkout(branch); + Commands.Checkout(Repository, branch); } public void MakeATaggedCommit(string tag) @@ -83,13 +83,15 @@ public void ApplyTag(string tag) public void BranchTo(string branchName, string @as = null) { _sequenceDiagram.BranchTo(branchName, Repository.Head.FriendlyName, @as); - Repository.Checkout(Repository.CreateBranch(branchName)); + var branch = Repository.CreateBranch(branchName); + Commands.Checkout(Repository, branch); } public void BranchToFromTag(string branchName, string fromTag, string onBranch, string @as = null) { _sequenceDiagram.BranchToFromTag(branchName, fromTag, onBranch, @as); - Repository.Checkout(Repository.CreateBranch(branchName)); + var branch = Repository.CreateBranch(branchName); + Commands.Checkout(Repository, branch); } public void MakeACommit() diff --git a/src/GitTools.Testing/GitTestExtensions.cs b/src/GitTools.Testing/GitTestExtensions.cs index 33cd93c..c667577 100644 --- a/src/GitTools.Testing/GitTestExtensions.cs +++ b/src/GitTools.Testing/GitTestExtensions.cs @@ -63,7 +63,7 @@ public static Tag MakeATaggedCommit(this IRepository repository, string tag) public static Commit CreatePullRequestRef(this IRepository repository, string from, string to, int prNumber = 2, bool normalise = false, bool allowFastFowardMerge = false) { - repository.Checkout(repository.Branches[to].Tip); + Commands.Checkout(repository, repository.Branches[to].Tip); if (allowFastFowardMerge) { repository.Merge(repository.Branches[from], Generate.SignatureNow()); @@ -74,11 +74,11 @@ public static Commit CreatePullRequestRef(this IRepository repository, string fr } var commit = repository.Head.Tip; repository.Refs.Add("refs/pull/" + prNumber + "/merge", commit.Id); - repository.Checkout(to); + Commands.Checkout(repository, to); if (normalise) { // Turn the ref into a real branch - repository.Checkout(repository.Branches.Add("pull/" + prNumber + "/merge", commit)); + Commands.Checkout(repository, repository.Branches.Add("pull/" + prNumber + "/merge", commit)); } return commit; From a64e5cbdde52b04e7b7a36a5d45821db7b441b4f Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 15:06:59 -0700 Subject: [PATCH 03/10] Comment out logging code for Example because System.Remoting is not supported. --- src/GitTools.Testing.Tests/Example.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/GitTools.Testing.Tests/Example.cs b/src/GitTools.Testing.Tests/Example.cs index dbfb240..f69213e 100644 --- a/src/GitTools.Testing.Tests/Example.cs +++ b/src/GitTools.Testing.Tests/Example.cs @@ -4,7 +4,9 @@ namespace GitTools.Testing.Tests { using System; +#if NET452 using System.Runtime.Remoting.Messaging; +#endif using JetBrains.Annotations; using Logging; @@ -16,8 +18,10 @@ public class Example [Fact] public void TheReadmeSample() { +#if NET452 using (LogHelper.Capture(_outputHelper, LogProvider.SetCurrentLogProvider)) { +#endif using (var fixture = new EmptyRepositoryFixture()) { fixture.MakeACommit(); @@ -28,10 +32,13 @@ public void TheReadmeSample() fixture.Checkout("master"); fixture.MergeNoFF("develop"); } +#if NET452 } +#endif } } +#if NET452 public static class LogHelper { private static readonly XUnitProvider Provider; @@ -45,7 +52,7 @@ public static IDisposable Capture(ITestOutputHelper outputHelper, Action @@ -101,4 +108,5 @@ public IDisposable OpenMappedContext(string key, string value) throw new NotImplementedException(); } } +#endif } \ No newline at end of file From 2138ae8577baa77089894dca24eca6c60fba7a23 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 15:20:48 -0700 Subject: [PATCH 04/10] Add NuGet properties into csproj --- .../GitTools.Testing.Tests.csproj | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj index bd5598b..f7eee0c 100644 --- a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj +++ b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj @@ -6,6 +6,19 @@ false + + + GitTools.Testing + GitTools Contributors + Makes it easy to automate git for testing libraries which interact with git + git tools testing + Copyright GitTools 2015 + https://github.com/GitTools/GitTools.Core + https://github.com/GitTools/GitTools.Core/blob/master/LICENSE + https://raw.github.com/GitTools/GitTools.Core/master/GitTools_logo.png + + From e77aa1986bc2ffc2305b8754c3252c21fa84a4bd Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 15:31:46 -0700 Subject: [PATCH 05/10] Update appveyor.yml to use dotnet instead of NuGet to create package --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f51d4f7..c3f9314 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,14 +11,14 @@ assembly_info: patch: false before_build: - - nuget restore src\ + - dotnet restore src\GitTools.Testing.sln - ps: gitversion /l console /output buildserver /updateAssemblyInfo build: project: src\GitTools.Testing.sln after_build: - - cmd: nuget pack src\GitTools.Testing.nuspec -version "%GitVersion_NuGetVersion%" + - cmd: dotnet pack src\GitTools.Testing\GitTools.Testing.csproj /p:PackageVersion="%GitVersion_NuGetVersion%" /p:NoBuild=true /p:PackageOutputPath=%APPVEYOR_BUILD_FOLDER% - cmd: appveyor PushArtifact "GitTools.Testing.%GitVersion_NuGetVersion%.nupkg" cache: - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified From 92cd1a382505d5ee8e3c833ff1c7399b09709840 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 15:44:42 -0700 Subject: [PATCH 06/10] Use VS2017 image --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index c3f9314..dec41fa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,6 @@ +image: + - Visual Studio 2017 + install: - choco install gitversion.portable -pre -y From d0623f96ad24ba8d6487fc1efb41ee65dfe1b2d0 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 15:55:09 -0700 Subject: [PATCH 07/10] Remove Platform: Any CPU because it is built by default --- appveyor.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dec41fa..517236a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,9 +4,6 @@ image: install: - choco install gitversion.portable -pre -y -platform: - - Any CPU - configuration: - Release From 365fbe03a82d0abd2328d9f672cc3b2873ef049d Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 16:53:20 -0700 Subject: [PATCH 08/10] Use dotnet test to run .NET Core tests in AppVeyor --- appveyor.yml | 8 ++++++++ src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj | 2 ++ 2 files changed, 10 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 517236a..49df6fc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,5 +20,13 @@ build: after_build: - cmd: dotnet pack src\GitTools.Testing\GitTools.Testing.csproj /p:PackageVersion="%GitVersion_NuGetVersion%" /p:NoBuild=true /p:PackageOutputPath=%APPVEYOR_BUILD_FOLDER% - cmd: appveyor PushArtifact "GitTools.Testing.%GitVersion_NuGetVersion%.nupkg" + +# Setting this off until the auto-detection for dotnet test tooling in AppVeyor +# is integrated. https://github.com/appveyor/ci/issues/1404 +# The test_script is used as a workaround to fix this. +test: off +test_script: + - cmd: dotnet test src\GitTools.Testing.Tests\GitTools.Testing.Tests.csproj --configuration %Configuration% --no-build + cache: - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified diff --git a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj index f7eee0c..20ad377 100644 --- a/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj +++ b/src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj @@ -25,6 +25,8 @@ + + From 312a0c696bec1545395da4bc062e6384f2bdb42b Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 17:01:11 -0700 Subject: [PATCH 09/10] Remove unnecessary packages.config and nuspec files --- src/GitTools.Testing.Tests/packages.config | 7 ------ src/GitTools.Testing.nuspec | 25 ---------------------- src/GitTools.Testing/packages.config | 6 ------ 3 files changed, 38 deletions(-) delete mode 100644 src/GitTools.Testing.Tests/packages.config delete mode 100644 src/GitTools.Testing.nuspec delete mode 100644 src/GitTools.Testing/packages.config diff --git a/src/GitTools.Testing.Tests/packages.config b/src/GitTools.Testing.Tests/packages.config deleted file mode 100644 index 0b39336..0000000 --- a/src/GitTools.Testing.Tests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/GitTools.Testing.nuspec b/src/GitTools.Testing.nuspec deleted file mode 100644 index 25b1cbe..0000000 --- a/src/GitTools.Testing.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - GitTools.Testing - $version$ - GitTools.Testing - GitTools Contributors - GitTools Contributors - Makes it easy to automate git for testing libraries which interact with git - git tools testing - false - Copyright GitTools 2015 - en-US - https://github.com/GitTools/GitTools.Core - https://github.com/GitTools/GitTools.Core/blob/master/LICENSE - https://raw.github.com/GitTools/GitTools.Core/master/GitTools_logo.png - - - - - - - - - \ No newline at end of file diff --git a/src/GitTools.Testing/packages.config b/src/GitTools.Testing/packages.config deleted file mode 100644 index 705055c..0000000 --- a/src/GitTools.Testing/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From d1b323b83a5c956d2f008477439b1b70e922d098 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 2 Jul 2017 23:45:35 -0700 Subject: [PATCH 10/10] Update .travis.yml to support building for .NET Core --- .travis.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f91d31..174054f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,16 @@ language: csharp +mono: latest +dotnet: 1.0.4 +dist: trusty + solution: src/GitTools.Testing.sln sudo: false install: - # - sudo nuget update -self - - nuget restore src/GitTools.Testing.sln - nuget install xunit.runner.console -Version 2.1.0 -OutputDirectory ./src/packages script: - - xbuild ./src/GitTools.Testing.sln /property:Configuration="Debug" /verbosity:detailed - - mono --debug --runtime=v4.0.30319 ./src/packages/xunit.runner.console.2.1.0/tools/xunit.console.exe ./src/GitTools.Testing.Tests/bin/Debug/GitTools.Testing.Tests.dll + - dotnet restore src/GitTools.Testing.sln + - msbuild ./src/GitTools.Testing.sln /property:Configuration=Debug + - dotnet test ./src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj --configuration Debug --no-build --framework netcoreapp1.0 +# Disable testing against .NET 4.5.2 through Mono because it tries to resolve +# the Windows libgit binary instead of the linux one. +# - mono --debug --runtime=v4.0.30319 ./src/packages/xunit.runner.console.2.1.0/tools/xunit.console.exe ./src/GitTools.Testing.Tests/bin/Debug/net452/GitTools.Testing.Tests.dll \ No newline at end of file