Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Migrates library to .NETStandard 1.3 #6

Merged
merged 10 commits into from
Jul 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 13 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
image:
- Visual Studio 2017

install:
- choco install gitversion.portable -pre -y

platform:
- Any CPU

configuration:
- Release

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"

# 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
10 changes: 9 additions & 1 deletion src/GitTools.Testing.Tests/Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
namespace GitTools.Testing.Tests
{
using System;
#if NET452
using System.Runtime.Remoting.Messaging;
#endif
using JetBrains.Annotations;
using Logging;

Expand All @@ -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();
Expand All @@ -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;
Expand All @@ -45,7 +52,7 @@ public static IDisposable Capture(ITestOutputHelper outputHelper, Action<ILogPro
{
// TODO Only do this once
setProvider(Provider);

CallContext.SetData("CurrentOutputHelper", outputHelper);

return new DelegateDisposable(() =>
Expand Down Expand Up @@ -101,4 +108,5 @@ public IDisposable OpenMappedContext(string key, string value)
throw new NotImplementedException();
}
}
#endif
}
117 changes: 37 additions & 80 deletions src/GitTools.Testing.Tests/GitTools.Testing.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,92 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5CF365CF-85B2-4AA3-8A17-680EFDF617C5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GitTools.Testing.Tests</RootNamespace>
<AssemblyName>GitTools.Testing.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<TargetFrameworks>net452;netcoreapp1.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>

<!-- NuGet properties for creating a NuGet package.
More information: https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets -->
<PropertyGroup>
<Title>GitTools.Testing</Title>
<Authors>GitTools Contributors</Authors>
<Description>Makes it easy to automate git for testing libraries which interact with git</Description>
<PackageTags>git tools testing</PackageTags>
<Copyright>Copyright GitTools 2015</Copyright>
<PackageProjectUrl>https://github.com/GitTools/GitTools.Core</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/GitTools/GitTools.Core/blob/master/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://raw.github.com/GitTools/GitTools.Core/master/GitTools_logo.png</PackageIconUrl>
</PropertyGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="15.0.0" />
<PackageReference Include="xunit.abstractions" Version="2.0.1" />
<PackageReference Include="xunit.core" Version="2.3.0-beta3-build3705" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta3-build3705" />
<PackageReference Include="xunit.runner.console" Version="2.3.0-beta3-build3705" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta2-build3683" />
</ItemGroup>
<ItemGroup>
<Compile Include="Example.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\JetBrainsAnnotations.cs" />

<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
<PackageReference Include="LibGit2Sharp" Version="0.24.0" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>

<!-- TODO: Unify this dependency with the LibGit2Sharp NuGet dependency
when the portable NuGet has been officially released. -->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
<PackageReference Include="LibGit2Sharp.Portable" Version="0.24.10" />
</ItemGroup>

<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
<ProjectReference Include="..\GitTools.Testing\GitTools.Testing.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GitTools.Testing\GitTools.Testing.csproj">
<Project>{3DCA1530-7A7F-46E4-955F-B4358F1299FA}</Project>
<Name>GitTools.Testing</Name>
</ProjectReference>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
7 changes: 0 additions & 7 deletions src/GitTools.Testing.Tests/packages.config

This file was deleted.

25 changes: 0 additions & 25 deletions src/GitTools.Testing.nuspec

This file was deleted.

4 changes: 2 additions & 2 deletions src/GitTools.Testing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ public class BaseGitFlowRepositoryFixture : EmptyRepositoryFixture
{
/// <summary>
/// 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
/// </summary>
public BaseGitFlowRepositoryFixture(string initialVersion) :
public BaseGitFlowRepositoryFixture(string initialVersion) :
this(r => r.MakeATaggedCommit(initialVersion))
{
}

/// <summary>
/// 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
/// </summary>
public BaseGitFlowRepositoryFixture(Action<IRepository> initialMasterAction)
Expand All @@ -38,7 +38,7 @@ void SetupRepo(Action<IRepository> initialMasterAction)

initialMasterAction(Repository);

Repository.Checkout(Repository.CreateBranch("develop"));
Commands.Checkout(Repository, Repository.CreateBranch("develop"));
Repository.MakeACommit();
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions src/GitTools.Testing/GitTestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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;
Expand Down
Loading