libgit2 / libgit2sharp.nativebinaries

MIT License
28 stars 62 forks source link

支持MAUI.Android #150

Closed BaY1251 closed 10 months ago

BaY1251 commented 1 year ago

基于NDK实现交叉编译,需要先配置NDK_PATH,例如export NDK_PATH=C:/android-ndk-r25c. Nuget增加 \nuget.package\runtimes\android-arm 和 \nuget.package\runtimes\android-arm64 两个文件夹.

bording commented 1 year ago

Hi, @BaY1251.

I only speak English, so I'm using Google Translate to try and understand what you've written here.

Adding support for Android on .NET MAUI is more complicated that what you've done on this PR so far. The rest of the CI system would need to be adjusted to actually build the binaries and package them.

I also can't find any .NET MAUI documentation around native C dependencies and how they need to be packaged to be picked up properly. .NET MAUI uses the Mono runtime, so it's not clear to me if it will even find the binaries in the runtime folder based on RID or not, since that is primarily a CoreCLR behavior.

Assuming all of that works, I still won't have a way to run the LibGit2Sharp tests on Android with .NET MAUI using GitHub Actions to verify that it works.

Based on all of that,.NET MAUI isn't something I'm inclined to try and add support for right now.

BaY1251 commented 1 year ago

@bording
translate: Maui Android automatically loads .so file, so there is no need for LibGit2 to make any code changes, and MAUI does not need to make any changes to the local library. I tested HTTP to be able to clone, but I did not do any other tests. https will prompt "could not load ssl libraries", which I am not good at. I have been trying to solve for a long time, but all have failed. I tried to compile OpenSSL static libraries to LibGit2, but compilation did not pass. Oh my goodness Other tests have not been conducted yet, and I am not capable of conducting a complete test I understand your concerns very well, but the fact is that the so-called MAUI Android support, this is just the Android side. MAUI is just a carrier used and has no direct relationship with support. I will try to spend some time on the next step of testing and look forward to LibGit2Sharp being applied to Android

My testing process:

  1. Create a MAUI project in VS
  2. Add the Nuget package for LibGit2Sharp
  3. Convert LibGit2Sharp Replace NativeBinaries with the following package https://github.com/BaY1251/libgit2sharp.nativebinaries/releases/download/0.0.0/LibGit2Sharp.NativeBinaries.2.0.320.nupkg
  4. Simply verify the LibGit2Sharp function without any additional operations

原文: 抱歉,我确实没有能力用英文表达. Maui.Android自动加载so,所以不需要LibGit2更改任何代码,MAUI也不需要针对本机库进行任何更改.我测试http能够clone,但其它测试我没有做.https会提示"could not load ssl libraries",这个问题我并不擅长,已经花了很长时间尝试解决,但都失败了,我尝试编译OpenSSL静态库到LibGit2,编译没有通过,天哪... 其它的测试尚未进行,而且完整的测试我是没有能力做的. 我很理解你的顾虑,但事实所谓MAUI.Android的支持,这是Android端而已,MAUI只是使用的载体,与支持没有直接的关系.我尽量花些时间进行下一步的测试,期待LibGit2Sharp应用到Android中.

我的测试过程:

  1. 在VS中创建一个MAUI工程
  2. 添加LibGit2Sharp的Nuget包.
  3. 将LibGit2Sharp.NativeBinaries.替换为以下包 https://github.com/BaY1251/libgit2sharp.nativebinaries/releases/download/0.0.0/LibGit2Sharp.NativeBinaries.2.0.320.nupkg
  4. 直接验证LibGit2Sharp功能即可,没有其它额外的操作.
BaY1251 commented 8 months ago

https://github.com/dotnet/runtime/issues/86619

This address may change your thoughts