Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Target netstandard2.0 #48

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,7 @@ src/_NCrunch_GitTools.Core/
####################
# JetBrains IDEs
####################
.idea
.idea

# Visual Studio 2017
.vs
15 changes: 4 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
language: csharp
solution: src/GitTools.Core.sln
sudo: false
dotnet: 1.0.3
dotnet: 2.1.300
dist: trusty
mono: none
addons:
apt:
sources:
- sourceline: 'deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main'
key_url: 'https://apt-mo.trafficmanager.net/keys/microsoft.asc'
packages:
- dotnet-dev-1.0.3
install:
# - sudo nuget update -self
- dotnet restore "./src/GitTools.Core.sln"
script:
- dotnet restore "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" /p:TargetFramework=netcoreapp1.1 /verbosity:detailed
- dotnet build "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" --configuration Debug --framework netcoreapp1.1 /verbosity:detailed
- dotnet test "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" --framework netcoreapp1.1 --filter TestCategory!=NoMono
- dotnet restore "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" /p:TargetFramework=netcoreapp2.0 /verbosity:detailed
- dotnet build "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" --configuration Debug --framework netcoreapp2.0 /verbosity:detailed
- dotnet test "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" --framework netcoreapp2.0 --filter TestCategory!=NoMono
# - mono --debug --runtime=v4.0.30319 %userprofile%.nuget/packages/nunit.consolerunner/3.6.1/tools/nunit3-console.exe ./output/debug/GitTools.Core.Tests/net45/GitTools.Core.Tests.dll -where "cat != NoMono"
18 changes: 5 additions & 13 deletions src/GitTools.Core.Tests/GitTools.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
<OutputType>Library</OutputType>
<TargetFramework>net46</TargetFramework>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -22,21 +21,14 @@

<ItemGroup>
<PackageReference Include="GitTools.Testing" Version="1.2.0" />
<PackageReference Include="NUnit" Version="3.7.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.8.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.*" />
<PackageReference Include="Shouldly" Version="2.8.3" />
<PackageReference Include="Atlassian.SDK" Version="10.2.2" />
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' == 'netcoreapp1.1' ">
<PackageReference Include="Atlassian.SDK" Version="9.5.0" />
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' == 'net46' ">
<PackageReference Include="Atlassian.SDK" Version="2.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GitTools.Core\GitTools.Core.csproj" />
</ItemGroup>
Expand Down
11 changes: 0 additions & 11 deletions src/GitTools.Core.Tests/app.config

This file was deleted.

3 changes: 1 addition & 2 deletions src/GitTools.Core/Git/Extensions/LibGitExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ public static void CheckoutFilesIfExist(this IRepository repository, params stri
}
}

#if !NETSTANDARD1_3
public static void DumpGraph(this IRepository repository, Action<string> writer = null, int? maxCommits = null)
{
DumpGraph(repository.Info.Path, writer, maxCommits);
Expand Down Expand Up @@ -191,7 +190,7 @@ public static void DumpGraph(string workingDirectory, Action<string> writer = nu
Console.Write(output.ToString());
}
}
#endif

public static string CreateGitLogArgs(int? maxCommits)
{
return @"log --graph --format=""%h %cr %d"" --decorate --date=relative --all --remotes=*" + (maxCommits != null ? string.Format(" -n {0}", maxCommits) : null);
Expand Down
39 changes: 4 additions & 35 deletions src/GitTools.Core/GitTools.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--<TargetFramework>netstandard1.3</TargetFramework>-->
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard1.3;net45;net40</TargetFrameworks>

<!--Start of Nuspec metadata-->
<PackageId>GitTools.Core</PackageId>
Expand All @@ -15,45 +14,15 @@
<Copyright>Copyright GitTools 2015.</Copyright>
<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>

<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<DefineConstants>TRACE;NET45;NETDESKTOP</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net40'">
<DefineConstants>TRACE;NET40;NETDESKTOP</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<DefineConstants>TRACE;LIBLOG_PORTABLE;NETSTANDARD1_3;</DefineConstants>
<DefineConstants>TRACE;LIBLOG_PORTABLE;</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibGit2Sharp" Version="0.25.0-preview-0033" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<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" />
<PackageReference Include="JetBrains.Annotations" Version="10.4.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<PackageReference Include="LibGit2Sharp" Version="0.25.2" />
<PackageReference Include="JetBrains.Annotations" Version="10.4.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="JetBrains.Annotations" Version="10.4.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
</ItemGroup>
</Project>
25 changes: 2 additions & 23 deletions src/GitTools.Core/Helpers/ProcessHelper.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#if !NETSTANDARD1_3
namespace GitTools
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;


Expand Down Expand Up @@ -184,33 +182,14 @@ public struct ChangeErrorMode : IDisposable

public ChangeErrorMode(ErrorModes mode)
{
try
{
oldMode = SetErrorMode((int)mode);
}
catch (EntryPointNotFoundException)
{
oldMode = (int)mode;
}
Environment.ExitCode = oldMode = (int) mode;
}


void IDisposable.Dispose()
{
try
{
SetErrorMode(oldMode);
}
catch (EntryPointNotFoundException)
{
// NOTE: Mono doesn't support DllImport("kernel32.dll") and its SetErrorMode method, obviously. @asbjornu
}
Environment.ExitCode = oldMode;
}

[DllImport("kernel32.dll")]
static extern int SetErrorMode(int newMode);
}
}
}

#endif