-
Notifications
You must be signed in to change notification settings - Fork 658
LibGit2Sharp update to 0.26.0 #1659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0fb4cac
libgit2sharp update
arturcic ccd343d
code cleanup for GitVersionTask
arturcic afb4805
remove UtilPack dependency for GitVersionTask
arturcic 2058982
split GitVersionTask in 2 projects, one with tasks another with imple…
arturcic ad3dfb5
updated to the msbuild props and targets
arturcic 425e488
rename GitVersionTask to GitVersion.MsBuild
arturcic ac27ceb
updates to build scripts
arturcic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
FROM centos:7 | ||
LABEL maintainers="GitTools Maintainers" | ||
|
||
ENV DOTNET_VERSION='2.1' | ||
ENV DOTNET_VERSION='2.1' | ||
ARG contentFolder | ||
|
||
# https://dotnet.microsoft.com/download/linux-package-manager/rhel/sdk-current | ||
RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \ | ||
&& yum update cache | ||
|
||
# if you need SDK use dotnet-sdk-$DOTNET_VERSION | ||
RUN yum install -y dotnet-runtime-$DOTNET_VERSION.x86_64 unzip libgit2-devel.x86_64 \ | ||
RUN yum install -y dotnet-runtime-$DOTNET_VERSION.x86_64 \ | ||
&& yum clean all \ | ||
&& rm -rf /tmp/* | ||
|
||
RUN ln -s /usr/lib64/libgit2.so /usr/lib64/libgit2-15e1193.so | ||
|
||
WORKDIR /app | ||
COPY $contentFolder/ ./ | ||
|
||
ENTRYPOINT ["dotnet", "GitVersion.dll"] | ||
ENTRYPOINT ["dotnet", "GitVersion.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
FROM fedora:27 | ||
LABEL maintainers="GitTools Maintainers" | ||
|
||
ENV DOTNET_VERSION='2.1' | ||
ENV DOTNET_VERSION='2.1' | ||
ARG contentFolder | ||
|
||
# https://dotnet.microsoft.com/download/linux-package-manager/rhel/sdk-current | ||
RUN rpm -Uvh https://packages.microsoft.com/config/fedora/27/packages-microsoft-prod.rpm | ||
RUN rpm -Uvh https://packages.microsoft.com/config/fedora/27/packages-microsoft-prod.rpm | ||
|
||
# if you need SDK use dotnet-sdk-$DOTNET_VERSION | ||
RUN yum install -y dotnet-runtime-$DOTNET_VERSION.x86_64 unzip libgit2-devel.x86_64 \ | ||
RUN yum install -y dotnet-runtime-$DOTNET_VERSION.x86_64\ | ||
&& yum clean all \ | ||
&& rm -rf /tmp/* | ||
|
||
RUN ln -s /usr/lib64/libgit2.so /usr/lib64/libgit2-15e1193.so | ||
|
||
WORKDIR /app | ||
COPY $contentFolder/ ./ | ||
|
||
ENTRYPOINT ["dotnet", "GitVersion.dll"] | ||
ENTRYPOINT ["dotnet", "GitVersion.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...tVersionTask.Tests/GetVersionTaskTests.cs → ...MsBuild.Task.Tests/GetVersionTaskTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...sionTask.Tests/InvalidFileCheckerTests.cs → ...ild.Task.Tests/InvalidFileCheckerTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
src/GitVersion.MsBuild.Task/GenerateGitVersionInformation.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace GitVersion.MsBuild.Task | ||
{ | ||
using Microsoft.Build.Framework; | ||
|
||
public class GenerateGitVersionInformation : GitVersionTaskBase | ||
{ | ||
[Required] | ||
public string ProjectFile { get; set; } | ||
|
||
[Required] | ||
public string IntermediateOutputPath { get; set; } | ||
|
||
[Required] | ||
public string Language { get; set; } | ||
|
||
[Output] | ||
public string GitVersionInformationFilePath { get; set; } | ||
|
||
public override bool Execute() => TaskProxy.GenerateGitVersionInformation(this); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/GitVersion.MsBuild.Task/GitVersion.MsBuild.Task.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Build" Version="15.9.20" /> | ||
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="15.9.20" /> | ||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<InternalsVisibleTo Include="GitVersion.MsBuild" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\GitVersionCore\GitVersionCore.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace GitVersion.MsBuild.Task | ||
{ | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
public abstract class GitVersionTaskBase : Task | ||
{ | ||
[Required] | ||
public string SolutionDirectory { get; set; } | ||
|
||
public bool NoFetch { get; set; } | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
src/GitVersion.MsBuild.Task/LibGit2Sharp/GitLoaderContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// This code originally copied from https://raw.githubusercontent.com/dotnet/sourcelink/master/src/Microsoft.Build.Tasks.Git/GitLoaderContext.cs | ||
#if !NET461 | ||
namespace GitVersion.MsBuild.Task.LibGit2Sharp | ||
{ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.Loader; | ||
using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; | ||
|
||
public sealed class GitLoaderContext : AssemblyLoadContext | ||
{ | ||
private readonly string[] assemblies; | ||
public static GitLoaderContext Instance { get; private set; } | ||
|
||
private GitLoaderContext(string[] assemblies) => this.assemblies = assemblies; | ||
|
||
public static void Init(params string[] assemblies) => Instance = new GitLoaderContext(assemblies); | ||
|
||
protected override Assembly Load(AssemblyName assemblyName) | ||
{ | ||
if (assemblies.Contains(assemblyName.Name)) | ||
{ | ||
var path = Path.Combine(Path.GetDirectoryName(typeof(GitLoaderContext).Assembly.Location), assemblyName.Name + ".dll"); | ||
return LoadFromAssemblyPath(path); | ||
} | ||
|
||
return Default.LoadFromAssemblyName(assemblyName); | ||
} | ||
|
||
protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) | ||
{ | ||
var modulePtr = IntPtr.Zero; | ||
|
||
if (unmanagedDllName.StartsWith("git2-", StringComparison.Ordinal) || | ||
unmanagedDllName.StartsWith("libgit2-", StringComparison.Ordinal)) | ||
{ | ||
var directory = GetNativeLibraryDirectory(); | ||
var extension = GetNativeLibraryExtension(); | ||
|
||
if (!unmanagedDllName.EndsWith(extension, StringComparison.Ordinal)) | ||
{ | ||
unmanagedDllName += extension; | ||
} | ||
|
||
var nativeLibraryPath = Path.Combine(directory, unmanagedDllName); | ||
if (!File.Exists(nativeLibraryPath)) | ||
{ | ||
nativeLibraryPath = Path.Combine(directory, "lib" + unmanagedDllName); | ||
} | ||
|
||
modulePtr = LoadUnmanagedDllFromPath(nativeLibraryPath); | ||
} | ||
|
||
return modulePtr != IntPtr.Zero ? modulePtr : base.LoadUnmanagedDll(unmanagedDllName); | ||
} | ||
|
||
internal static string GetNativeLibraryDirectory() | ||
{ | ||
var dir = Path.GetDirectoryName(typeof(GitLoaderContext).Assembly.Location); | ||
return Path.Combine(dir, "runtimes", RuntimeIdMap.GetNativeLibraryDirectoryName(RuntimeEnvironment.GetRuntimeIdentifier()), "native"); | ||
} | ||
|
||
private static string GetNativeLibraryExtension() | ||
{ | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return ".dll"; | ||
} | ||
|
||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
return ".dylib"; | ||
} | ||
|
||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
return ".so"; | ||
} | ||
|
||
throw new PlatformNotSupportedException(); | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.