Cysharp/YetAnotherHttpHandler

Please document how to compile from source and add the results to a unity project

RubenGarcia opened this issue · 2 comments

cd native
cargo ndk -t arm64-v8a build
cd ..
dotnet pack YetAnotherHttpHandler.sln --runtime android-arm64 --include-symbols --include-source -o publish

generates

native/target/aarch64-linux-android/debug/libyaha_native.so
publish/YetAnotherHttpHandler.0.1.0.nupkg
publish/YetAnotherHttpHandler.0.1.0.symbols.nupkg

and publish/YetAnotherHttpHandler.0.1.0.nupkg contains Cysharp.Net.Http.YetAnotherHttpHandler.dll
but the installation from https://github.com/Cysharp/YetAnotherHttpHandler.git?path=src/YetAnotherHttpHandler#v0.1.0 provides instead

libCysharp.Net.Http.YetAnotherHttpHandler.Native.so

How is libCysharp.Net.Http.YetAnotherHttpHandler.Native.so created?

The build.yml instruction gives

unzip -o ./publish/YetAnotherHttpHandler.*[0-9].nupkg 'runtimes/*' -d src/YetAnotherHttpHandler/Plugins/Cysharp.Net.Http.YetAnotherHttpHandler.Native/ || true
Archive:  ./publish/YetAnotherHttpHandler.0.1.0.nupkg
caution: filename not matched:  runtimes/*

See #18 for details on how to proceed.

When creating a NuGet package, it is renamed from libyaha_native.so to libCysharp.Net.Http.YetAnotherHttpHandler.so, and the result of unzipping it is committed to Git. At this point, if you want to test it in a local environment, you need to manually rename and place it, or extract it from the NuGet package.

The path to the DLL referenced when creating a NuGet package is as follows:

native\artifacts\[target]\(lib)yaha_native.{so,dll}

<Target Name="YahaBeforePack" BeforeTargets="DispatchToInnerBuilds" Condition="'$(ContinuePackingAfterGeneratingNuspec)' != ''">
<ItemGroup>
<Content Include="@(YahaNativeArtifact-&gt;'%(LibraryPath)'-&gt;Exists())" />
<Content Remove="@(YahaNativeArtifact-&gt;'%(RustOutputDebugPath)'-&gt;Exists())" />
<Content Remove="@(YahaNativeArtifact-&gt;'%(RustOutputReleasePath)'-&gt;Exists())" />
</ItemGroup>
</Target>

<!-- for Content -->
<Link>runtimes\%(YahaNativeArtifact.Rid)\native\%(YahaNativeArtifact.Prefix)$(YahaNativeLibraryName)%(Ext)</Link>
<PackagePath>runtimes\%(YahaNativeArtifact.Rid)\native\%(YahaNativeArtifact.Prefix)$(YahaNativeLibraryName)%(Ext)</PackagePath>