Skip to content

Commit

Permalink
Merge pull request #210 from AArnott/fix143
Browse files Browse the repository at this point in the history
Update libgit2sharp to latest stable version
  • Loading branch information
AArnott authored Aug 23, 2018
2 parents 35e70f9 + 283a122 commit 98359c2
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 55 deletions.
6 changes: 3 additions & 3 deletions src/MSBuildExtensionTask/ContextAwareTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
#if NETCOREAPP1_0
#if NETCOREAPP2_0
using System.Runtime.Loader;
#endif
using Microsoft.Build.Framework;
Expand All @@ -18,7 +18,7 @@ public abstract class ContextAwareTask : Task

public override bool Execute()
{
#if NETCOREAPP1_0
#if NETCOREAPP2_0
string taskAssemblyPath = new Uri(this.GetType().GetTypeInfo().Assembly.CodeBase).LocalPath;
var ctxt = new CustomAssemblyLoader(this);
Assembly inContextAssembly = ctxt.LoadFromAssemblyPath(taskAssemblyPath);
Expand Down Expand Up @@ -68,7 +68,7 @@ public override bool Execute()

protected abstract bool ExecuteInner();

#if NETCOREAPP1_0
#if NETCOREAPP2_0
private class CustomAssemblyLoader : AssemblyLoadContext
{
private readonly ContextAwareTask loaderTask;
Expand Down
6 changes: 3 additions & 3 deletions src/MSBuildExtensionTask/MSBuildExtensionTask.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="1.6.20-beta-gfea83a8c9e" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.1.548" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net461</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<DebugType>full</DebugType>
Expand All @@ -27,7 +27,7 @@
<PackageReference Include="7z.NET" Version="1.0.3" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="2.0.11" />
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" />
<PackageReference Include="Microsoft.Build" Version="14.3" Condition=" '$(TargetFramework)' == 'net452' " />
<PackageReference Include="Microsoft.Build" Version="14.3" Condition=" '$(TargetFramework)' == 'net461' " />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.5.24" />
<PackageReference Include="Xunit.Combinatorial" Version="1.1.12" />
<PackageReference Include="xunit" Version="2.2.0" />
Expand Down
6 changes: 3 additions & 3 deletions src/NerdBank.GitVersioning/GitExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public static IEnumerable<Commit> GetCommitsFromVersion(this Repository repo, Ve
return possibleCommits;
}

#if NET45
#if NET461
/// <summary>
/// Assists the operating system in finding the appropriate native libgit2 module.
/// </summary>
Expand Down Expand Up @@ -356,13 +356,13 @@ public static void AddDirectoryToPath(string directory)
/// <returns>Receives the directory that native binaries are expected.</returns>
public static string FindLibGit2NativeBinaries(string basePath)
{
#if !NET45
#if !NET461
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
#endif
{
return Path.Combine(basePath, "lib", "win32", IntPtr.Size == 4 ? "x86" : "x64");
}
#if !NET45
#if !NET461
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return Path.Combine(basePath, "lib", "linux", IntPtr.Size == 4 ? "x86" : "x86_64");
Expand Down
6 changes: 3 additions & 3 deletions src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugType>Full</DebugType>
<IsPackable>false</IsPackable>
<PackageId>Nerdbank.GitVersioning.Core</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetMDDocs" Version="0.111.0" PrivateAssets="all" Condition=" '$(GenerateMarkdownApiDocs)' == 'true' " />
<PackageReference Include="LibGit2Sharp" Version="0.24.7-g9fca61fdda" PrivateAssets="None" />
<PackageReference Include="LibGit2Sharp" Version="0.25.2" PrivateAssets="none" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" Condition=" '$(TargetFramework)' == 'netstandard1.3' " />
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0" Condition=" '$(TargetFramework)' == 'netcoreapp2.0' " />
<PackageReference Include="Validation" Version="2.3.7" />
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="1.6.20-beta-gfea83a8c9e" />
</ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/NerdBank.GitVersioning/VersionFile.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace Nerdbank.GitVersioning
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Validation;

/// <summary>
Expand Down Expand Up @@ -48,7 +48,7 @@ public static VersionOptions GetVersion(LibGit2Sharp.Commit commit, string repoR
{
string parentDirectory = searchDirectory.Length > 0 ? Path.GetDirectoryName(searchDirectory) : null;

string candidatePath = Path.Combine(searchDirectory, TxtFileName);
string candidatePath = Path.Combine(searchDirectory, TxtFileName).Replace('\\', '/');
var versionTxtBlob = commit.Tree[candidatePath]?.Target as LibGit2Sharp.Blob;
if (versionTxtBlob != null)
{
Expand All @@ -59,7 +59,7 @@ public static VersionOptions GetVersion(LibGit2Sharp.Commit commit, string repoR
}
}

candidatePath = Path.Combine(searchDirectory, JsonFileName);
candidatePath = Path.Combine(searchDirectory, JsonFileName).Replace('\\', '/');
var versionJsonBlob = commit.Tree[candidatePath]?.Target as LibGit2Sharp.Blob;
if (versionJsonBlob != null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class AssemblyVersionInfo : Task
{
#if NET45
#if NET461
private static readonly CodeGeneratorOptions codeGeneratorOptions = new CodeGeneratorOptions
{
BlankLinesBetweenMembers = false,
Expand Down Expand Up @@ -70,7 +70,7 @@ the code is regenerated.

public string AssemblyConfiguration { get; set; }

#if NET45
#if NET461
public override bool Execute()
{
if (CodeDomProvider.IsDefinedLanguage(this.CodeLanguage))
Expand Down
2 changes: 1 addition & 1 deletion src/Nerdbank.GitVersioning.Tasks/NativeVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private void CreateDefines()
{
if (!int.TryParse(this.AssemblyLanguage, out lcid))
{
#if NET45
#if NET461
try
{
var cultureInfo = new CultureInfo(this.AssemblyLanguage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net45</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<NuSpecFile>Nerdbank.GitVersioning.nuspec</NuSpecFile>
Expand All @@ -18,15 +18,15 @@

<Target Name="SetNuSpecPropertiesFinal" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion;SetNuSpecProperties">
<PropertyGroup>
<LibGit2SharpNativeBinaries>$(NuGetPackageRoot)libgit2sharp.nativebinaries\1.0.165\</LibGit2SharpNativeBinaries>
<LibGit2SharpNativeBinaries>$(NuGetPackageRoot)libgit2sharp.nativebinaries\1.0.217\</LibGit2SharpNativeBinaries>
<NuspecProperties>$(NuspecProperties);LicenseUrl=$(PackageLicenseUrl);Version=$(Version);BaseOutputPath=$(OutputPath);LibGit2SharpNativeBinaries=$(LibGit2SharpNativeBinaries)</NuspecProperties>
</PropertyGroup>
</Target>

<Target Name="PackBuildOutputs" DependsOnTargets="SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup">
<PropertyGroup>
<BuildSubDir Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">MSBuildCore\</BuildSubDir>
<BuildSubDir Condition=" '$(TargetFramework)' == 'net45' ">MSBuildFull\</BuildSubDir>
<BuildSubDir Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">MSBuildCore\</BuildSubDir>
<BuildSubDir Condition=" '$(TargetFramework)' == 'net461' ">MSBuildFull\</BuildSubDir>
</PropertyGroup>
<Error Text="Unrecognized TargetFramework" Condition=" '$(BuildSubDir)' == '' " />
<ItemGroup>
Expand All @@ -40,8 +40,8 @@
<PackagePath>build\$(BuildSubDir)</PackagePath>
</TfmSpecificPackageFile>
<!-- Package up the libgit2 native binaries -->
<TfmSpecificPackageFile Include="@(None)" Condition=" '%(None.CopyToOutputDirectory)' == 'PreserveNewest' ">
<PackagePath>build\$(BuildSubDir)%(None.Link)</PackagePath>
<TfmSpecificPackageFile Include="@(ContentWithTargetPath)" Condition=" '%(ContentWithTargetPath.CopyToOutputDirectory)' == 'PreserveNewest' ">
<PackagePath>build\$(BuildSubDir)%(ContentWithTargetPath.TargetPath)</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
</Target>
Expand Down
50 changes: 25 additions & 25 deletions src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,32 @@
<tags>git commit versioning version assemblyinfo</tags>
</metadata>
<files>
<file src="$BaseOutputPath$net45\LibGit2Sharp.dll" target="build\MSBuildFull\LibGit2Sharp.dll" />
<file src="$BaseOutputPath$net45\LibGit2Sharp.dll.config" target="build\MSBuildFull\LibGit2Sharp.dll.config" />
<file src="$BaseOutputPath$net45\MSBuildExtensionTask.dll" target="build\MSBuildFull\MSBuildExtensionTask.dll" />
<file src="$BaseOutputPath$net45\NerdBank.GitVersioning.dll" target="build\MSBuildFull\NerdBank.GitVersioning.dll" />
<file src="$BaseOutputPath$net45\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$net45\Newtonsoft.Json.dll" target="build\MSBuildFull\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$net45\Validation.dll" target="build\MSBuildFull\Validation.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-1196807.dll" target="build\MSBuildFull\lib\win32\x64\git2-1196807.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-1196807.dll" target="build\MSBuildCore\lib\win32\x64\git2-1196807.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-1196807.pdb" target="build\MSBuildFull\lib\win32\x64\git2-1196807.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-1196807.pdb" target="build\MSBuildCore\lib\win32\x64\git2-1196807.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-1196807.dll" target="build\MSBuildFull\lib\win32\x86\git2-1196807.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-1196807.dll" target="build\MSBuildCore\lib\win32\x86\git2-1196807.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-1196807.pdb" target="build\MSBuildFull\lib\win32\x86\git2-1196807.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-1196807.pdb" target="build\MSBuildCore\lib\win32\x86\git2-1196807.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\osx\native\libgit2-1196807.dylib" target="build\MSBuildFull\lib\osx\libgit2-1196807.dylib" />
<file src="$LibGit2SharpNativeBinaries$runtimes\osx\native\libgit2-1196807.dylib" target="build\MSBuildCore\lib\osx\libgit2-1196807.dylib" />
<file src="$LibGit2SharpNativeBinaries$runtimes\linux-x64\native\libgit2-1196807.so" target="build\MSBuildFull\lib\linux\x86_64\libgit2-1196807.so" />
<file src="$LibGit2SharpNativeBinaries$runtimes\linux-x64\native\libgit2-1196807.so" target="build\MSBuildCore\lib\linux\x86_64\libgit2-1196807.so" />
<file src="$BaseOutputPath$net461\LibGit2Sharp.dll" target="build\MSBuildFull\LibGit2Sharp.dll" />
<file src="$BaseOutputPath$net461\LibGit2Sharp.dll.config" target="build\MSBuildFull\LibGit2Sharp.dll.config" />
<file src="$BaseOutputPath$net461\MSBuildExtensionTask.dll" target="build\MSBuildFull\MSBuildExtensionTask.dll" />
<file src="$BaseOutputPath$net461\NerdBank.GitVersioning.dll" target="build\MSBuildFull\NerdBank.GitVersioning.dll" />
<file src="$BaseOutputPath$net461\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$net461\Newtonsoft.Json.dll" target="build\MSBuildFull\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$net461\Validation.dll" target="build\MSBuildFull\Validation.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-6311e88.dll" target="build\MSBuildFull\lib\win32\x64\git2-6311e88.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-6311e88.dll" target="build\MSBuildCore\lib\win32\x64\git2-6311e88.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-6311e88.pdb" target="build\MSBuildFull\lib\win32\x64\git2-6311e88.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x64\native\git2-6311e88.pdb" target="build\MSBuildCore\lib\win32\x64\git2-6311e88.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-6311e88.dll" target="build\MSBuildFull\lib\win32\x86\git2-6311e88.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-6311e88.dll" target="build\MSBuildCore\lib\win32\x86\git2-6311e88.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-6311e88.pdb" target="build\MSBuildFull\lib\win32\x86\git2-6311e88.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\win7-x86\native\git2-6311e88.pdb" target="build\MSBuildCore\lib\win32\x86\git2-6311e88.pdb" />
<file src="$LibGit2SharpNativeBinaries$runtimes\osx\native\libgit2-6311e88.dylib" target="build\MSBuildFull\lib\osx\libgit2-6311e88.dylib" />
<file src="$LibGit2SharpNativeBinaries$runtimes\osx\native\libgit2-6311e88.dylib" target="build\MSBuildCore\lib\osx\libgit2-6311e88.dylib" />
<file src="$LibGit2SharpNativeBinaries$runtimes\linux-x64\native\libgit2-6311e88.so" target="build\MSBuildFull\lib\linux\x86_64\libgit2-6311e88.so" />
<file src="$LibGit2SharpNativeBinaries$runtimes\linux-x64\native\libgit2-6311e88.so" target="build\MSBuildCore\lib\linux\x86_64\libgit2-6311e88.so" />
<file src="$LibGit2SharpNativeBinaries$libgit2\LibGit2Sharp.dll.config" target="build\MSBuildCore\LibGit2Sharp.dll.config" />
<file src="$BaseOutputPath$netcoreapp1.0\LibGit2Sharp.dll" target="build\MSBuildCore\LibGit2Sharp.dll" />
<file src="$BaseOutputPath$netcoreapp1.0\MSBuildExtensionTask.dll" target="build\MSBuildCore\MSBuildExtensionTask.dll" />
<file src="$BaseOutputPath$netcoreapp1.0\NerdBank.GitVersioning.dll" target="build\MSBuildCore\NerdBank.GitVersioning.dll" />
<file src="$BaseOutputPath$netcoreapp1.0\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildCore\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$netcoreapp1.0\Newtonsoft.Json.dll" target="build\MSBuildCore\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$netcoreapp1.0\Validation.dll" target="build\MSBuildCore\Validation.dll" />
<file src="$BaseOutputPath$netcoreapp2.0\LibGit2Sharp.dll" target="build\MSBuildCore\LibGit2Sharp.dll" />
<file src="$BaseOutputPath$netcoreapp2.0\MSBuildExtensionTask.dll" target="build\MSBuildCore\MSBuildExtensionTask.dll" />
<file src="$BaseOutputPath$netcoreapp2.0\NerdBank.GitVersioning.dll" target="build\MSBuildCore\NerdBank.GitVersioning.dll" />
<file src="$BaseOutputPath$netcoreapp2.0\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildCore\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$netcoreapp2.0\Newtonsoft.Json.dll" target="build\MSBuildCore\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$netcoreapp2.0\Validation.dll" target="build\MSBuildCore\Validation.dll" />

<file src="build\Nerdbank.GitVersioning.targets" target="build\Nerdbank.GitVersioning.targets" />
<file src="buildCrossTargeting\Nerdbank.GitVersioning.targets" target="buildCrossTargeting\Nerdbank.GitVersioning.targets" />
Expand Down
2 changes: 1 addition & 1 deletion src/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "NerdBank.GitVersioning/version.schema.json",
"version": "2.1",
"version": "2.2",
"assemblyVersion": {
"precision": "revision"
},
Expand Down

0 comments on commit 98359c2

Please sign in to comment.