-
Notifications
You must be signed in to change notification settings - Fork 897
Move native binaries into separate NuGet package #984
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
</Target> | ||
|
||
<Target Name="Test" DependsOnTargets="Build"> | ||
<xunit Assembly="$(TestBuildDir)/LibGit2Sharp.Tests.dll" Xml="$(DeployFolder)/Test-result.xml" /> | ||
<xunit Assembly="$(TestBuildDir)/LibGit2Sharp.Tests.dll" ShadowCopy="false" Xml="$(DeployFolder)/Test-result.xml" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please share what led to this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mentioned it a bit in my comments above somewhere, but didn't go into a ton of detail. The I was curious about when this might have been added to mono, and I ended up grabbing a copy of the mono source and tracked down the library loading code. After looking through the history, I found that the particular side-by-side behavior has been around since mono 2.10, and before that it would first look in the current directory instead, which was changed because it was deemed to be dangerous. I removed the path variables from the scripts, and everything worked fine on my mac. However, the build was failing on my ubuntu vm, with an exception indicating it couldn't find libgit2. I spent some time in the mono debug logs, and I saw that the libgit2sharp libraries were being shadow copied while being run by the xunit msbuild test runner. When run on linux, this was causing a problem, but osx had no problem, was was loading the library fine. After turning off shadow copy in the If you look through my commits, you'll see at one point I had worked around the problem on linux by adding a LD_LIBRARY_PATH value back, but since that needs an absolute path, I added a Travis value to get the path passed in. The linux Travis build passed after that. I wasn't thinking about that not existing when not running Travis, and I ran the script on my local ubuntu vm... and it worked! After experimenting, I realized that the path didn't even need to be valid to work, it just need to have a semicolon in the value. If you look at the latest version of So, with that workaround in place, strictly speaking, the change to So, that's my super-longwinded explanation for why that got changed! 😄 I'm hoping I'll be able to track down the bug in the mono code and see if I can get it fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, you're aware that |
||
</Target> | ||
|
||
<Target Name="Deploy" DependsOnTargets="Test"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.IO; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace CustomBuildTasks | ||
{ | ||
public class GenerateNativeDllNameTask : Task | ||
{ | ||
public ITaskItem InputHashFile { get; set; } | ||
|
||
public string OutputFile { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
var fileName = InputHashFile.GetMetadata("FullPath"); | ||
string hash; | ||
|
||
using (var sr = new StreamReader(fileName)) | ||
{ | ||
hash = sr.ReadLine(); | ||
} | ||
|
||
var shortHash = hash.Substring(0, 7); | ||
|
||
var nativeDllName = @"namespace LibGit2Sharp.Core | ||
{{ | ||
internal static class NativeDllName | ||
{{ | ||
public const string Name = ""git2-{0}""; | ||
}} | ||
}} | ||
"; | ||
|
||
using (var sw = new StreamWriter(OutputFile)) | ||
{ | ||
sw.Write(nativeDllName, shortHash); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<UsingTask TaskName="GenerateNativeDllNameTask" AssemblyFile="..\Lib\CustomBuildTasks\CustomBuildTasks.dll" /> | ||
|
||
<PropertyGroup> | ||
<LibGit2SharpPath Condition="'$(MSBuildThisFileDirectory)' == ''">.</LibGit2SharpPath> | ||
<LibGit2SharpPath Condition="'$(MSBuildThisFileDirectory)' != ''">$(MSBuildThisFileDirectory)</LibGit2SharpPath> | ||
<NativeDllNamePath>$(LibGit2SharpPath)\Core\NativeDllName.cs</NativeDllNamePath> | ||
<CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateNativeDllNameCs</CoreCompileDependsOn> | ||
<CoreCleanDependsOn>$(CoreCleanDependsOn);CleanNativeDllNameCs</CoreCleanDependsOn> | ||
</PropertyGroup> | ||
|
||
<Target Name="GenerateNativeDllNameCs" | ||
Inputs="@(EmbeddedResource)" | ||
Outputs="$(NativeDllNamePath)"> | ||
<GenerateNativeDllNameTask InputHashFile="@(EmbeddedResource)" Condition=" '%(Filename)%(Extension)' == 'libgit2_hash.txt' " OutputFile="$(NativeDllNamePath)" /> | ||
</Target> | ||
|
||
<Target Name="CleanNativeDllNameCs"> | ||
<Delete Files="$(NativeDllNamePath)" /> | ||
</Target> | ||
</Project> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="LibGit2Sharp.NativeBinaries" version="1.0.25" targetFramework="net40" allowedVersions="[1.0.25]" /> | ||
</packages> |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we start ignoring it, shouldn't we also drop it from the index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, thought 76eaeea included that, or is there something more that you're wanting me to do here?