Skip to content

Commit 4154e4e

Browse files
committed
Remove the bindings crate from the root namespace to let it break
Until we get the bindings generation process super stable, let the bindings get stale with respect to the main repo while still letting `cargo check` pass.
1 parent 83322e1 commit 4154e4e

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ jobs:
1717
include:
1818
- toolchain: stable
1919
build-net-tokio: true
20-
build-bindings: true
2120
- toolchain: beta
2221
build-net-tokio: true
23-
build-bindings: true
2422
- toolchain: 1.39.0
2523
build-net-tokio: true
26-
build-bindings: true
2724
coverage: true
2825
- toolchain: 1.34.2
29-
build-bindings: true
3026
runs-on: ubuntu-latest
3127
steps:
3228
- name: Checkout source code
@@ -43,9 +39,6 @@ jobs:
4339
- name: Build on Rust ${{ matrix.toolchain }}
4440
if: "! matrix.build-net-tokio"
4541
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -p lightning
46-
- name: Build bindings on Rust ${{ matrix.toolchain }}
47-
if: matrix.build-bindings
48-
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -p lightning-c-bindings
4942
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio
5043
if: matrix.build-net-tokio
5144
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
@@ -127,6 +120,8 @@ jobs:
127120
apt-get -y install cargo valgrind lld git g++ clang
128121
- name: Checkout source code
129122
uses: actions/checkout@v2
123+
- name: Sanity test bindings
124+
run: cd lightning-c-bindings && cargo check && cd ..
130125
- name: Install cbindgen
131126
run: cargo install --force cbindgen
132127
- name: Rebuild bindings, and check the sample app builds + links

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
members = [
44
"lightning",
55
"lightning-net-tokio",
6-
"lightning-c-bindings",
76
]
87

98
# Our tests do actual crypo and lots of work, the tradeoff for -O1 is well worth it

genbindings.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ fi
4848
# Finally, sanity-check the generated C and C++ bindings with demo apps:
4949

5050
# Naively run the C demo app:
51-
gcc -Wall -g -pthread demo.c ../target/debug/liblightning.a -ldl
51+
gcc -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
5252
./a.out
5353

5454
# And run the C++ demo app in valgrind to test memory model correctness and lack of leaks.
55-
g++ -std=c++11 -Wall -g -pthread demo.cpp -L../target/debug/ -llightning -ldl
55+
g++ -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -llightning -ldl
5656
if [ -x "`which valgrind`" ]; then
57-
LD_LIBRARY_PATH=../target/debug/ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
57+
LD_LIBRARY_PATH=target/debug/ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
5858
echo
5959
else
6060
echo "WARNING: Please install valgrind for more testing"
6161
fi
6262

6363
# Test a statically-linked C++ version, tracking the resulting binary size and runtime
6464
# across debug, LTO, and cross-language LTO builds (using the same compiler each time).
65-
clang++ -std=c++11 -Wall -pthread demo.cpp ../target/debug/liblightning.a -ldl
65+
clang++ -std=c++11 -Wall -pthread demo.cpp target/debug/liblightning.a -ldl
6666
./a.out >/dev/null
6767
echo " C++ Bin size and runtime w/o optimization:"
6868
ls -lha a.out
@@ -75,19 +75,19 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then
7575
if [ -x "$(which clang-$LLVM_V)" ]; then
7676
cargo +nightly clean
7777
cargo +nightly rustc -Zbuild-std --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes
78-
mv ../target/x86_64-unknown-linux-gnu/debug/liblightning.* ../target/debug/
78+
mv target/x86_64-unknown-linux-gnu/debug/liblightning.* target/debug/
7979

8080
# Sadly, std doesn't seem to compile into something that is memsan-safe as of Aug 2020,
8181
# so we'll always fail, not to mention we may be linking against git rustc LLVM which
8282
# may differ from clang-llvm, so just allow everything here to fail.
8383
set +e
8484

8585
# First the C demo app...
86-
clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c ../target/debug/liblightning.a -ldl
86+
clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
8787
./a.out
8888

8989
# ...then the C++ demo app
90-
clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp ../target/debug/liblightning.a -ldl
90+
clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp target/debug/liblightning.a -ldl
9191
./a.out >/dev/null
9292

9393
# restore exit-on-failure
@@ -153,11 +153,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" -o "$HOST_PLATFORM" = "
153153
mv Cargo.toml.bk Cargo.toml
154154

155155
# First the C demo app...
156-
$CLANG -fsanitize=address -Wall -g -pthread demo.c ../target/debug/liblightning.a -ldl
156+
$CLANG -fsanitize=address -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
157157
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out
158158

159159
# ...then the C++ demo app
160-
$CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp ../target/debug/liblightning.a -ldl
160+
$CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp target/debug/liblightning.a -ldl
161161
ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out >/dev/null
162162
else
163163
echo "WARNING: Please install clang-$RUSTC_LLVM_V and clang++-$RUSTC_LLVM_V to build with address sanitizer"
@@ -168,7 +168,7 @@ fi
168168

169169
# Now build with LTO on on both C++ and rust, but without cross-language LTO:
170170
cargo rustc -v --release -- -C lto
171-
clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp ../target/release/liblightning.a -ldl
171+
clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp target/release/liblightning.a -ldl
172172
echo "C++ Bin size and runtime with only RL (LTO) optimized:"
173173
ls -lha a.out
174174
time ./a.out > /dev/null
@@ -180,7 +180,7 @@ if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then
180180
# packaging than simply shipping the rustup binaries (eg Debian should Just Work
181181
# here).
182182
cargo rustc -v --release -- -C linker-plugin-lto -C lto -C link-arg=-fuse-ld=lld
183-
$CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp ../target/release/liblightning.a -ldl
183+
$CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp target/release/liblightning.a -ldl
184184
echo "C++ Bin size and runtime with cross-language LTO:"
185185
ls -lha a.out
186186
time ./a.out > /dev/null

lightning-c-bindings/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ crate-type = ["staticlib"
1717
[dependencies]
1818
bitcoin = "0.24"
1919
lightning = { version = "0.0.11", path = "../lightning" }
20+
21+
# We eventually want to join the root workspace, but for now, the bindings generation is
22+
# a bit brittle and we don't want to hold up other developers from making changes just
23+
# because they break the bindings
24+
[workspace]

0 commit comments

Comments
 (0)