Skip to content

Update to .NET 6, Update libgit2sharp to include macOS ARM64 #689

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
wants to merge 23 commits into from

Conversation

drasticactions
Copy link

In order to use GitVersioning with the .NET 6 SDK on the M1, we need to update libgit2sharp to the newest release, which includes macOS ARM64 (libgit2/libgit2sharp.nativebinaries#132) support.

So, in order to use that, we also need to update the base library to include .NET 6.

I also had to include some using fixes for the tests, since it got an ambiguous reference between 'System.IO.Compression.ZLibStream' and 'Nerdbank.GitVersioning.ManagedGit.ZLibStream'.

Copy link
Collaborator

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you for contributing.

@AArnott AArnott enabled auto-merge November 13, 2021 02:59
auto-merge was automatically disabled November 13, 2021 03:02

Head branch was pushed to by a user without write access

@drasticactions
Copy link
Author

Sorry, I had to fix the source generator, I didn't know you would commit on top of this while I was trying to fix it, lol.

It should actually build now!

@drasticactions
Copy link
Author

Gahhh, alright, I got as close as I could. I'm not sure what needs to be flipped for the x86 tests on Windows to run and why it's now getting BadImageExceptions. The other tests should be okay, and they all run locally on my M1 Max Mac and pass.

I can come back to fix that test, but if you want to, you can commit to it. I won't disrupt, lol.

Thanks again for building this!

@AArnott
Copy link
Collaborator

AArnott commented Nov 13, 2021

BadImageFormatException typically means you're loading the wrong an assembly with a mismatched bitness. For example the x86 test process may be trying to load an x64 binary. That binary could by libgit2 or it could even be an arch-specific managed assembly.

I may have time to look into it today.

@AArnott
Copy link
Collaborator

AArnott commented Nov 13, 2021

I fixed a couple more issues, but the kicker is that the MSBuild.Locator is finding the 64-bit MSBuild when running on .NET 5. The odd thing is we've had .NET 5 in a 32-bit process find 32-bit MSBuild before, so I don't know what about this PR broke it. I'll keep looking into it. There may be a bug elsewhere that we need to workaround.

@AArnott
Copy link
Collaborator

AArnott commented Nov 23, 2021

I'm tackling a smaller number of problems in #696 first. Then I'll come back to this.

@AArnott
Copy link
Collaborator

AArnott commented Nov 24, 2021

@drasticactions now that my smaller PR has completed, which included a libgit2sharp upgrade, is there anything more you actually need? Your PR would add testing on net6.0, which is not something that my PR did.

@drasticactions
Copy link
Author

I think so? The only thing that might need to be added is this,

return Path.Combine(basePath, "lib", "osx", RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "arm_64" : "x86_64");

There is a call to look for the correct libgit2 library, and that might need the call to get the ARM64 version, but I'm not sure if that code is called or not.

IMO you can close this PR and add that change yourself if it's needed.

@AArnott
Copy link
Collaborator

AArnott commented Nov 25, 2021

Done in #697. Thanks for catching what would likely have been a regression from my change.

@AArnott AArnott closed this Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants