runs-on: ubuntu-latest
# Ubuntu's version of clang doesn't support....anything that should work.
# Ubuntu is an utter trash OS and should generally never be used for anything.
- # We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
- # so we use debian testing
- container: debian:bookworm
+ # We also require dotnet so we use fedora
+ container: fedora:39
strategy:
fail-fast: false
steps:
- name: Install required dependencies
run: |
- apt-get update
- apt-get -y dist-upgrade
- apt-get -y install cargo libstd-rust-dev-windows lld llvm git g++ clang curl gcc-mingw-w64-x86-64-win32 python3 mono-devel zip faketime
+ dnf install -y mingw64-gcc git cargo dotnet clang llvm lld faketime rust-std-static-x86_64-pc-windows-gnu which diffutils
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install cbindgen
run: |
- git clone https://github.com/eqrion/cbindgen
- cd cbindgen/
- git checkout v0.20.0
- cargo update -p indexmap --precise "1.6.2" --verbose
- cargo install --locked --path .
+ cargo install cbindgen
- name: Checkout Rust-Lightning and LDK-C-Bindings git
run: |
git config --global safe.directory '*'
- name: Build Windows C# Bindings
run: |
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
- LDK_TARGET=x86_64-pc-windows-gnu faketime -f "2021-01-01 00:00:00" ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
+ LDK_TARGET=x86_64-pc-windows-gnu ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
- name: Build Linux C# Bindings
run: |
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
run: |
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
if ! diff ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg; then
- apt-get -y install diffoscope
+ dnf -y install diffoscope
diffoscope ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg || echo
exit 1
fi
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net6.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <Deterministic>true</Deterministic>
+ <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
+ <DefaultItemExcludes>$(DefaultItemExcludes);test\**\*</DefaultItemExcludes>
+ </PropertyGroup>
+
+</Project>
fi
# Compiling C# bindings with Mono
- MONO_COMPILE="-out:csharpldk.dll -langversion:3 -t:library -unsafe c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/util/*.cs c_sharp/src/org/ldk/structs/*.cs"
if [ "$3" = "true" ]; then
- mono-csc -g $MONO_COMPILE
+ mono-csc -g -out:csharpldk.dll -langversion:3 -t:library -unsafe c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/util/*.cs c_sharp/src/org/ldk/structs/*.cs
else
- mono-csc -optimize+ $MONO_COMPILE
+ cd c_sharp
+ dotnet build --configuration Release
+ cd ..
fi
echo "Building C# bindings..."
if [ "$LDK_JAR_TARGET" = "true" ]; then
# Copy resulting native binary for inclusion in release nuget zip
mkdir -p c_sharp/packaging_artifacts/lib/net3.0/
- cp csharpldk.dll c_sharp/packaging_artifacts/lib/net3.0/
+ cp c_sharp/bin/Release/net6.0/csharpldk.dll c_sharp/packaging_artifacts/lib/net3.0/
mkdir -p c_sharp/packaging_artifacts/runtimes/"$CS_PLATFORM_NAME"/native/
if [ "$IS_WIN" = "true" ]; then