-
Notifications
You must be signed in to change notification settings - Fork 890
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
Provide .NET 4.6.1 framework target #1606
Conversation
It would seem MSBuild property |
@devlead wooo 👍 .. It would be wonderful if you could get this... I'm trying to migrate https://github.com/YellowLineParking/Appy.GitDb and we want to keep both frameworks too. |
Ok checking MSBuild log seems |
@devlead Yeah, since this PR adds multi-targeting, that will be an issue. We'll have to update LibGit2Sharp.NativeBinaries first before we can move forward with this. |
@bording tested with package generated from libgit2/libgit2sharp.nativebinaries#75 https://ci.appveyor.com/project/devlead/libgit2sharp-nativebinaries/build/1.0.1 And then I could successfully build a nuget package. |
Neat! Once the NativeBinaries changes are ready to go, we'll merge this. Thanks! |
@ethomson Just an FYI I do have some review comments to make before we merge this, but I was waiting for the NativeBinaries update. |
@bording I have now updated libgit2/libgit2sharp.nativebinaries#75 to import and not copy. |
libgit2/libgit2sharp.nativebinaries#75 has been released as LibGit2Sharp.NativeBinaries 1.0.233, so you can update this PR to use it. |
450a223
to
4583888
Compare
@bording native binaries updated and PR rebased. |
Azure Pipelines currently doesn't allow setting build numbers on PRs, whish thet did, but that's why builds are failing. But Mac / Linux |
Cool, I should be able to look over this tomorrow then. |
Directory.Build.props
Outdated
@@ -7,4 +7,8 @@ | |||
<DefineConstants Condition=" '$(ExtraDefine)' != '' ">$(DefineConstants);$(ExtraDefine)</DefineConstants> | |||
</PropertyGroup> | |||
|
|||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> | |||
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants> |
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.
Instead of defining a new constant, let's use the built-in ones: NETCOREAPP
, NETSTANDARD
, and NETFRAMEWORK
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.
Reverted.
LibGit2Sharp/Core/Platform.cs
Outdated
@@ -13,11 +13,16 @@ internal enum OperatingSystemType | |||
internal static class Platform | |||
{ | |||
public static string ProcessorArchitecture => IntPtr.Size == 8 ? "x64" : "x86"; | |||
#if !NETCORE | |||
private static bool? _isRunningOnMac; | |||
public static bool IsRunningOnMac() => _isRunningOnMac ?? (_isRunningOnMac = TryGetIsRunningOnMac()) ?? false; |
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.
Not sure we need this to be public.
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.
Internal class, but sure made it private.
LibGit2Sharp/Core/Platform.cs
Outdated
|
||
#if !NETCORE | ||
#pragma warning disable IDE1006 // Naming Styles | ||
[DllImport("libc")] |
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.
Is there a danger here of this throwing? For example, what if we're running on a musl libc instead of glibc?
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.
Unlikely to find a system without libc (even if it’s not glibc) but this is not ideal. uname
takes a struct
of char arrays (of a well defined size) not a single char array. So this should work everywhere (since it’s an appropriately large buffer) but I don’t love it.
I don’t think that libgit2 has a mechanism to tell you what OS you’re running on, but it seems like we could.
But without that, I think I would recommend sysctl
instead of uname
.
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.
Is there a danger here of this throwing? For example, what if we're running on a musl libc instead of glibc?
libc
should not be an issue.
I don’t think that libgit2 has a mechanism to tell you what OS you’re running on, but it seems like we could.
As this is used to decide how to load libgit
, I don't see how we could use it, right?
But without that, I think I would recommend sysctl instead of uname.
Used uname
trick for years in Mono projects, so didn't think of sysctl
will investigate.
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.
Haven't looked at sysctl
implementation yet, but while seeking inspiration it does seem many use uname
for os detection and then sysctl
for kernel revision detection, wonder if there's some reasoning around that.
https://github.com/dotnet/corefx/blob/0566028e42a8f2fa86b8e0dd856d1f13d0fdce05/src/Native/Unix/System.Native/pal_runtimeinformation.c#L25-L39
Could be a legacy from the project "k" days, which I now see also used uname
https://github.com/aspnet/PlatformAbstractions/blob/174f51f3180ac9718de48d155b819e8a05310ab0/src/Microsoft.Extensions.PlatformAbstractions/Native/NativeMethods.Unix.cs#L10-L27
Maybe sysctl
kern.ostype
is good enough will give it a go and refactor PR.
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.
Refactored PR to use sysctl
and kern.ostype
.
9a2f0b5
to
9fce228
Compare
9fce228
to
7da0e1e
Compare
LibGit2Sharp/Core/Platform.cs
Outdated
@@ -13,11 +13,16 @@ internal enum OperatingSystemType | |||
internal static class Platform | |||
{ | |||
public static string ProcessorArchitecture => IntPtr.Size == 8 ? "x64" : "x86"; | |||
#if !NETSTANDARD |
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.
I want to change this eventually, but Platform.cs is also included in the Tests project, so using NETSTANDARD
here means the test project has these members defined when they don't need to be.
To make this work in both places, basing the logic on NETFRAMEWORK
is going to be the way to go.
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.
Addressed
* adds Pollyfil for System.Runtime.InteropServices.RuntimeInformation * fixes libgit2#1605
7da0e1e
to
d6f6322
Compare
@bording ready for next release? 🙄 |
@jrgcubano well @bording seems happy ;) |
Can we get a new release to nuget.org with this fix please? |
Interesting the GH release 0.25.3 has this PR in it But the NuGet release seems to have been done from Which doesn't have this pr in it, so currently the release doesn't match the release binaries 🤔 But perhaps that was unintentional and this will come in 0.26.0? |
That link shows you what isn't in 0.25.3. The last release was 0.26.0-preview-0027, built from this commit, which does not include this PR. |
Ok I just clicked commits on the release |
That's a misleading link, I guess. But look carefully at the wording of that link:
|
Ah sorry you're correct. |
@AArnott: you bet - https://www.nuget.org/packages/LibGit2Sharp/0.26.0-preview-0054 |
Provide .NET 4.6.1 framework target
As discuessed in #1605