Skip to content

Commit d8656f7

Browse files
authored
Merge pull request #145 from TheBlueMatt/main
Switch C# builds to use `dotnet` on Fedora
2 parents c66eb68 + ee19a18 commit d8656f7

File tree

8 files changed

+99
-75
lines changed

8 files changed

+99
-75
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,28 +162,21 @@ jobs:
162162
runs-on: ubuntu-latest
163163
# Ubuntu's version of clang doesn't support....anything that should work.
164164
# Ubuntu is an utter trash OS and should generally never be used for anything.
165-
# We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
166-
# so we use debian testing
167-
container: debian:bookworm
165+
# We also require dotnet so we use fedora
166+
container: fedora:39
168167
strategy:
169168
fail-fast: false
170169
steps:
171170
- name: Install required dependencies
172171
run: |
173-
apt-get update
174-
apt-get -y dist-upgrade
175-
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
172+
dnf install -y mingw64-gcc git cargo dotnet clang llvm lld faketime rust-std-static-x86_64-pc-windows-gnu which diffutils
176173
- name: Checkout source code
177174
uses: actions/checkout@v2
178175
with:
179176
fetch-depth: 0
180177
- name: Install cbindgen
181178
run: |
182-
git clone https://github.com/eqrion/cbindgen
183-
cd cbindgen/
184-
git checkout v0.20.0
185-
cargo update -p indexmap --precise "1.6.2" --verbose
186-
cargo install --locked --path .
179+
cargo install cbindgen
187180
- name: Checkout Rust-Lightning and LDK-C-Bindings git
188181
run: |
189182
git config --global safe.directory '*'
@@ -208,7 +201,7 @@ jobs:
208201
- name: Build Windows C# Bindings
209202
run: |
210203
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
211-
LDK_TARGET=x86_64-pc-windows-gnu faketime -f "2021-01-01 00:00:00" ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
204+
LDK_TARGET=x86_64-pc-windows-gnu ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
212205
- name: Build Linux C# Bindings
213206
run: |
214207
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
@@ -217,6 +210,10 @@ jobs:
217210
run: |
218211
cd c_sharp
219212
./build-release-nupkg.sh
213+
- uses: actions/upload-artifact@v3
214+
with:
215+
name: org.ldk.nupkg
216+
path: c_sharp/org.ldk.nupkg
220217
- name: Check latest auto-generated code is in git
221218
run: |
222219
# Checkout files that get updated with version information
@@ -241,7 +238,7 @@ jobs:
241238
run: |
242239
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
243240
if ! diff ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg; then
244-
apt-get -y install diffoscope
241+
dnf -y install diffoscope
245242
diffoscope ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg || echo
246243
exit 1
247244
fi

c_sharp/bindings.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ static inline LDKStr str_ref_to_owned_c(const jstring str) {
7272
typedef bool jboolean;
7373

7474
int64_t CS_LDK_allocate_buffer(int64_t len) {
75-
return MALLOC(len, "C#-requested buffer");
75+
return (int64_t)MALLOC(len, "C#-requested buffer");
7676
}
7777

7878
void CS_LDK_free_buffer(int64_t buf) {
79-
FREE(buf);
79+
FREE((void*)buf);
8080
}
8181

8282
jstring CS_LDK_get_ldk_c_bindings_version() {
@@ -87,21 +87,21 @@ jstring CS_LDK_get_ldk_version() {
8787
}
8888
#include "version.c"
8989

90-
typedef int8_tArray (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
90+
typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
9191
static invoker_l_l js_invoke_function_l_l;
9292
int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
9393
js_invoke_function_l_l = invoker;
9494
return 0;
9595
}
9696

97-
typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, ptrArray b);
97+
typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
9898
static invoker_l_ll js_invoke_function_l_ll;
9999
int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
100100
js_invoke_function_l_ll = invoker;
101101
return 0;
102102
}
103103

104-
typedef int8_tArray (*invoker_l_)(int obj_ptr, int fn_id);
104+
typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
105105
static invoker_l_ js_invoke_function_l_;
106106
int CS_LDK_register_l__invoker(invoker_l_ invoker) {
107107
js_invoke_function_l_ = invoker;
@@ -115,21 +115,21 @@ int CS_LDK_register_void_l_invoker(invoker_void_l invoker) {
115115
return 0;
116116
}
117117

118-
typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c, int8_tArray d);
118+
typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
119119
static invoker_l_llll js_invoke_function_l_llll;
120120
int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
121121
js_invoke_function_l_llll = invoker;
122122
return 0;
123123
}
124124

125-
typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c, int8_tArray d, int64_t e);
125+
typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e);
126126
static invoker_l_lllll js_invoke_function_l_lllll;
127127
int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
128128
js_invoke_function_l_lllll = invoker;
129129
return 0;
130130
}
131131

132-
typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c);
132+
typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
133133
static invoker_l_lll js_invoke_function_l_lll;
134134
int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
135135
js_invoke_function_l_lll = invoker;
@@ -157,21 +157,21 @@ int CS_LDK_register_l_Recipient_invoker(invoker_l_Recipient invoker) {
157157
return 0;
158158
}
159159

160-
typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int8_tArray b, int64_t c);
160+
typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
161161
static invoker_l_Recipientll js_invoke_function_l_Recipientll;
162162
int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
163163
js_invoke_function_l_Recipientll = invoker;
164164
return 0;
165165
}
166166

167-
typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int8_tArray a, ptrArray b, int32_t c);
167+
typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
168168
static invoker_l_llRecipient js_invoke_function_l_llRecipient;
169169
int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
170170
js_invoke_function_l_llRecipient = invoker;
171171
return 0;
172172
}
173173

174-
typedef int8_tArray (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int8_tArray c);
174+
typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
175175
static invoker_l_bll js_invoke_function_l_bll;
176176
int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
177177
js_invoke_function_l_bll = invoker;
@@ -185,7 +185,7 @@ int CS_LDK_register_i_ConfirmationTarget_invoker(invoker_i_ConfirmationTarget in
185185
return 0;
186186
}
187187

188-
typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_tArray c, int64_t d, int8_tArray e, int8_tArray f);
188+
typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, int64_t f);
189189
static invoker_l_llllll js_invoke_function_l_llllll;
190190
int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
191191
js_invoke_function_l_llllll = invoker;
@@ -199,7 +199,7 @@ int CS_LDK_register_s__invoker(invoker_s_ invoker) {
199199
return 0;
200200
}
201201

202-
typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, jstring a, jstring b, jstring c, jboolean d);
202+
typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
203203
static invoker_l_lllb js_invoke_function_l_lllb;
204204
int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
205205
js_invoke_function_l_lllb = invoker;
@@ -227,21 +227,21 @@ int CS_LDK_register_void__invoker(invoker_void_ invoker) {
227227
return 0;
228228
}
229229

230-
typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int8_tArray a, int64_tArray b, int32_t c);
230+
typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
231231
static invoker_void_lli js_invoke_function_void_lli;
232232
int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
233233
js_invoke_function_void_lli = invoker;
234234
return 0;
235235
}
236236

237-
typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int8_tArray a, int32_t b);
237+
typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
238238
static invoker_void_li js_invoke_function_void_li;
239239
int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
240240
js_invoke_function_void_li = invoker;
241241
return 0;
242242
}
243243

244-
typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, jboolean c);
244+
typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
245245
static invoker_l_llb js_invoke_function_l_llb;
246246
int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
247247
js_invoke_function_l_llb = invoker;
@@ -255,14 +255,14 @@ int CS_LDK_register_b__invoker(invoker_b_ invoker) {
255255
return 0;
256256
}
257257

258-
typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int8_tArray b);
258+
typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
259259
static invoker_l_sl js_invoke_function_l_sl;
260260
int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
261261
js_invoke_function_l_sl = invoker;
262262
return 0;
263263
}
264264

265-
typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int8_tArray a, jboolean b);
265+
typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
266266
static invoker_l_lb js_invoke_function_l_lb;
267267
int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
268268
js_invoke_function_l_lb = invoker;
@@ -276,7 +276,7 @@ int CS_LDK_register_b_l_invoker(invoker_b_l invoker) {
276276
return 0;
277277
}
278278

279-
typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int8_tArray a, int64_tArray b, int64_tArray c, int32_t d);
279+
typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
280280
static invoker_l_llli js_invoke_function_l_llli;
281281
int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
282282
js_invoke_function_l_llli = invoker;
@@ -12000,7 +12000,7 @@ LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr p
1200012000
LDKStr key_str = key;
1200112001
jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
1200212002
Str_free(key_str);
12003-
uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 53, primary_namespace_conv, secondary_namespace_conv, key_conv);
12003+
uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 53, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
1200412004
void* ret_ptr = untag_ptr(ret);
1200512005
CHECK_ACCESS(ret_ptr);
1200612006
LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
@@ -12021,7 +12021,7 @@ LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr prim
1202112021
LDKu8slice buf_var = buf;
1202212022
int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
1202312023
memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
12024-
uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 54, primary_namespace_conv, secondary_namespace_conv, key_conv, (int64_t)buf_arr);
12024+
uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 54, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
1202512025
void* ret_ptr = untag_ptr(ret);
1202612026
CHECK_ACCESS(ret_ptr);
1202712027
LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
@@ -12040,7 +12040,7 @@ LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr pri
1204012040
jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
1204112041
Str_free(key_str);
1204212042
jboolean lazy_conv = lazy;
12043-
uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 55, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
12043+
uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 55, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
1204412044
void* ret_ptr = untag_ptr(ret);
1204512045
CHECK_ACCESS(ret_ptr);
1204612046
LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
@@ -12055,7 +12055,7 @@ LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr
1205512055
LDKStr secondary_namespace_str = secondary_namespace;
1205612056
jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
1205712057
Str_free(secondary_namespace_str);
12058-
uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 56, primary_namespace_conv, secondary_namespace_conv);
12058+
uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 56, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
1205912059
void* ret_ptr = untag_ptr(ret);
1206012060
CHECK_ACCESS(ret_ptr);
1206112061
LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);

0 commit comments

Comments
 (0)