]> git.bitcoin.ninja Git - ldk-java/commitdiff
[C#] Add packaging artifacts to build a .nuget zip
authorMatt Corallo <git@bluematt.me>
Thu, 9 Nov 2023 17:53:23 +0000 (17:53 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 11 Nov 2023 02:40:51 +0000 (02:40 +0000)
12 files changed:
.gitignore
README.md
c_sharp/build-release-nupkg.sh [new file with mode: 0755]
c_sharp/packaging_artifacts/LICENSE-APACHE [new symlink]
c_sharp/packaging_artifacts/LICENSE-MIT [new symlink]
c_sharp/packaging_artifacts/LICENSE.md [new symlink]
c_sharp/packaging_artifacts/README.md [new symlink]
c_sharp/packaging_artifacts/[Content_Types].xml [new file with mode: 0644]
c_sharp/packaging_artifacts/_rels/.rels [new file with mode: 0644]
c_sharp/packaging_artifacts/org.ldk.nuspec [new file with mode: 0644]
c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp [new file with mode: 0644]
genbindings.sh

index 8e58f6eaae94fc62f4bcf24c568d8f16ff93f70d..283ad722c299b6815dd2c16f9e1717e2ba87a438 100644 (file)
@@ -10,3 +10,5 @@ ts/version.ts
 ts/version.c
 c_sharp/src/org/ldk/impl/version.cs
 c_sharp/version.c
+c_sharp/packaging_artifacts/runtimes/
+c_sharp/packaging_artifacts/lib/
index ed88ceba2f64831f57ee30f7254ffe5ee8ff8aa3..4189b966803f4a606706771bb547673a7497e7ef 100644 (file)
--- a/README.md
+++ b/README.md
@@ -58,6 +58,11 @@ well to implement the required network handling to bridge the `lightningdevkit`
 `SocketDescriptor` interface to Node.JS TCP Sockets. For those wishing to run a lightning node in
 the browser you will need to provide your own bridge from `SocketDescriptor` to a WebSocket proxy.
 
+# C#
+
+The C# bindings are functionally complete, but should be considered alpha quality. They are brand
+new and likely contain bugs or memory leaks.
+
 ## General
 
 The only known issue resulting in a use-after-free bug requires custom a custom ChannelKeys instance
diff --git a/c_sharp/build-release-nupkg.sh b/c_sharp/build-release-nupkg.sh
new file mode 100755 (executable)
index 0000000..476a431
--- /dev/null
@@ -0,0 +1,14 @@
+#/bin/sh
+set -e
+set -x
+
+# zips are not generally deterministic without some tweaking, which we do here.
+
+echo "Checking that required release native libraries are present..."
+ls packaging_artifacts/runtimes/win-x64/native/ldkcsharp.dll
+ls packaging_artifacts/runtimes/linux-x64/native/libldkcsharp.so
+ls packaging_artifacts/lib/net3.0/csharpldk.dll
+
+cd packaging_artifacts
+find . | xargs -L1 touch -d "2021-01-01 00:00 UTC" 
+zip -Xvu ../org.ldk.nupkg * */* */*/* */*/*/* */*/*/*/*
diff --git a/c_sharp/packaging_artifacts/LICENSE-APACHE b/c_sharp/packaging_artifacts/LICENSE-APACHE
new file mode 120000 (symlink)
index 0000000..1cd601d
--- /dev/null
@@ -0,0 +1 @@
+../../LICENSE-APACHE
\ No newline at end of file
diff --git a/c_sharp/packaging_artifacts/LICENSE-MIT b/c_sharp/packaging_artifacts/LICENSE-MIT
new file mode 120000 (symlink)
index 0000000..b2cfbdc
--- /dev/null
@@ -0,0 +1 @@
+../../LICENSE-MIT
\ No newline at end of file
diff --git a/c_sharp/packaging_artifacts/LICENSE.md b/c_sharp/packaging_artifacts/LICENSE.md
new file mode 120000 (symlink)
index 0000000..f0608a6
--- /dev/null
@@ -0,0 +1 @@
+../../LICENSE.md
\ No newline at end of file
diff --git a/c_sharp/packaging_artifacts/README.md b/c_sharp/packaging_artifacts/README.md
new file mode 120000 (symlink)
index 0000000..fe84005
--- /dev/null
@@ -0,0 +1 @@
+../../README.md
\ No newline at end of file
diff --git a/c_sharp/packaging_artifacts/[Content_Types].xml b/c_sharp/packaging_artifacts/[Content_Types].xml
new file mode 100644 (file)
index 0000000..b24fef0
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
+  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
+  <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
+  <Default Extension="dll" ContentType="application/octet" />
+  <Default Extension="dylib" ContentType="application/octet" />
+  <Default Extension="so" ContentType="application/octet" />
+  <Default Extension="md" ContentType="application/octet" />
+  <Default Extension="nuspec" ContentType="application/octet" />
+  <Override PartName="//LICENSE" ContentType="application/octet" />
+</Types>
\ No newline at end of file
diff --git a/c_sharp/packaging_artifacts/_rels/.rels b/c_sharp/packaging_artifacts/_rels/.rels
new file mode 100644 (file)
index 0000000..7f80149
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+  <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/org.ldk.nuspec" Id="spec" />
+  <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/ldk.psmdcp" Id="Properties" />
+</Relationships>
diff --git a/c_sharp/packaging_artifacts/org.ldk.nuspec b/c_sharp/packaging_artifacts/org.ldk.nuspec
new file mode 100644 (file)
index 0000000..35937cb
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
+  <metadata>
+    <id>org.ldk</id>
+    <version>Set in genbindings.sh automagically</version>
+    <authors>LDK</authors>
+    <license type="file">LICENSE</license>
+    <licenseUrl>https://github.com/lightningdevkit/rust-lightning/blob/main/LICENSE.md</licenseUrl>
+    <readme>README.md</readme>
+    <projectUrl>https://lightningdevkit.org/</projectUrl>
+    <description>LDK C# Bindings</description>
+    <copyright>2023 LDK Contributors</copyright>
+    <tags>bitcoin lightning ldk sdk non-custodial</tags>
+    <repository type="git" url="https://github.com/lightningdevkit/ldk-garbagecollected" />
+    <dependencies>
+      <group targetFramework="net3.0" />
+    </dependencies>
+  </metadata>
+</package>
diff --git a/c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp b/c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp
new file mode 100644 (file)
index 0000000..ef3de09
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
+  <dc:creator>LDK</dc:creator>
+  <dc:description>LDK C# Bindings</dc:description>
+  <dc:identifier>org.ldk</dc:identifier>
+  <version>Set in genbindings.sh automagically</version>
+  <keywords>bitcoin lightning ldk sdk non-custodial</keywords>
+  <lastModifiedBy>hand</lastModifiedBy>
+</coreProperties>
index 5cb6d88a8662a616f5bbf1a6d53c80de6c947cfc..c4379775a9c5c6aa2f7d30ed248d49b82826b7b4 100755 (executable)
@@ -108,6 +108,15 @@ if [ "$2" = "c_sharp" ]; then
        IS_APPLE_CLANG=false
        [ "$($CC --version | grep "Apple clang version")" != "" ] && IS_APPLE_CLANG=true
 
+       if is_gnu_sed; then
+               sed -i "s/<version>.*<\/version>/<version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" c_sharp/packaging_artifacts/org.ldk.nuspec
+               sed -i "s/<version>.*<\/version>/<version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp
+       else
+               # OSX sed is for some reason not compatible with GNU sed
+               sed -i '' "s/<version>.*<\/version>/<version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" c_sharp/packaging_artifacts/org.ldk.nuspec
+               sed -i '' "s/<version>.*<\/version>/<version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" c_sharp/packaging_artifacts/package/services/metadata/core-properties/ldk.psmdcp
+       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