]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Remove the bindings crate from the root namespace to let it break
authorMatt Corallo <git@bluematt.me>
Fri, 11 Sep 2020 23:31:13 +0000 (19:31 -0400)
committerMatt Corallo <git@bluematt.me>
Mon, 14 Sep 2020 00:58:50 +0000 (20:58 -0400)
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.

.github/workflows/build.yml
Cargo.toml
genbindings.sh
lightning-c-bindings/Cargo.toml

index a7a62041745992f48cf506faa43ac0b385f16a8d..95372d729273d6731102ce17450c7e400e057360 100644 (file)
@@ -17,16 +17,12 @@ jobs:
         include:
           - toolchain: stable
             build-net-tokio: true
-            build-bindings: true
           - toolchain: beta
             build-net-tokio: true
-            build-bindings: true
           - toolchain: 1.39.0
             build-net-tokio: true
-            build-bindings: true
             coverage: true
           - toolchain: 1.34.2
-            build-bindings: true
     runs-on: ubuntu-latest
     steps:
       - name: Checkout source code
@@ -43,9 +39,6 @@ jobs:
       - name: Build on Rust ${{ matrix.toolchain }}
         if: "! matrix.build-net-tokio"
         run: RUSTFLAGS="-C link-dead-code" cargo build --verbose  --color always -p lightning
-      - name: Build bindings on Rust ${{ matrix.toolchain }}
-        if: matrix.build-bindings
-        run: RUSTFLAGS="-C link-dead-code" cargo build --verbose  --color always -p lightning-c-bindings
       - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
         if: matrix.build-net-tokio
         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
@@ -127,6 +120,9 @@ jobs:
           apt-get -y install cargo valgrind lld git g++ clang
       - name: Checkout source code
         uses: actions/checkout@v2
+      - name: Sanity test bindings
+        working-directory: lightning-c-bindings
+        run: cargo check
       - name: Install cbindgen
         run: cargo install --force cbindgen
       - name: Rebuild bindings, and check the sample app builds + links
index 069e49e8b7c2c2756c9954a48305f2af498e550e..03d58b202cf39ea5526d683711cff464e04b1c10 100644 (file)
@@ -3,7 +3,6 @@
 members = [
     "lightning",
     "lightning-net-tokio",
-    "lightning-c-bindings",
 ]
 
 # Our tests do actual crypo and lots of work, the tradeoff for -O1 is well worth it
index c801c44c07f599ee0948ea86a0f4b0f4eb09b0fe..2d3d9ab6ab290b8bb666ff540cf97d8620dfed9a 100755 (executable)
@@ -48,13 +48,13 @@ fi
 # Finally, sanity-check the generated C and C++ bindings with demo apps:
 
 # Naively run the C demo app:
-gcc -Wall -g -pthread demo.c ../target/debug/liblightning.a -ldl
+gcc -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
 ./a.out
 
 # And run the C++ demo app in valgrind to test memory model correctness and lack of leaks.
-g++ -std=c++11 -Wall -g -pthread demo.cpp -L../target/debug/ -llightning -ldl
+g++ -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -llightning -ldl
 if [ -x "`which valgrind`" ]; then
-       LD_LIBRARY_PATH=../target/debug/ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
+       LD_LIBRARY_PATH=target/debug/ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
        echo
 else
        echo "WARNING: Please install valgrind for more testing"
@@ -62,7 +62,7 @@ fi
 
 # Test a statically-linked C++ version, tracking the resulting binary size and runtime
 # across debug, LTO, and cross-language LTO builds (using the same compiler each time).
-clang++ -std=c++11 -Wall -pthread demo.cpp ../target/debug/liblightning.a -ldl
+clang++ -std=c++11 -Wall -pthread demo.cpp target/debug/liblightning.a -ldl
 ./a.out >/dev/null
 echo " C++ Bin size and runtime w/o optimization:"
 ls -lha a.out
@@ -75,7 +75,7 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then
                if [ -x "$(which clang-$LLVM_V)" ]; then
                        cargo +nightly clean
                        cargo +nightly rustc -Zbuild-std --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes
-                       mv ../target/x86_64-unknown-linux-gnu/debug/liblightning.* ../target/debug/
+                       mv target/x86_64-unknown-linux-gnu/debug/liblightning.* target/debug/
 
                        # Sadly, std doesn't seem to compile into something that is memsan-safe as of Aug 2020,
                        # so we'll always fail, not to mention we may be linking against git rustc LLVM which
@@ -83,11 +83,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then
                        set +e
 
                        # First the C demo app...
-                       clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c ../target/debug/liblightning.a -ldl
+                       clang-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
                        ./a.out
 
                        # ...then the C++ demo app
-                       clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp ../target/debug/liblightning.a -ldl
+                       clang++-$LLVM_V -std=c++11 -fsanitize=memory -fsanitize-memory-track-origins -Wall -g -pthread demo.cpp target/debug/liblightning.a -ldl
                        ./a.out >/dev/null
 
                        # restore exit-on-failure
@@ -153,11 +153,11 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" -o "$HOST_PLATFORM" = "
                mv Cargo.toml.bk Cargo.toml
 
                # First the C demo app...
-               $CLANG -fsanitize=address -Wall -g -pthread demo.c ../target/debug/liblightning.a -ldl
+               $CLANG -fsanitize=address -Wall -g -pthread demo.c target/debug/liblightning.a -ldl
                ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out
 
                # ...then the C++ demo app
-               $CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp ../target/debug/liblightning.a -ldl
+               $CLANGPP -std=c++11 -fsanitize=address -Wall -g -pthread demo.cpp target/debug/liblightning.a -ldl
                ASAN_OPTIONS='detect_leaks=1 detect_invalid_pointer_pairs=1 detect_stack_use_after_return=1' ./a.out >/dev/null
        else
                echo "WARNING: Please install clang-$RUSTC_LLVM_V and clang++-$RUSTC_LLVM_V to build with address sanitizer"
@@ -168,7 +168,7 @@ fi
 
 # Now build with LTO on on both C++ and rust, but without cross-language LTO:
 cargo rustc -v --release -- -C lto
-clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp ../target/release/liblightning.a -ldl
+clang++ -std=c++11 -Wall -flto -O2 -pthread demo.cpp target/release/liblightning.a -ldl
 echo "C++ Bin size and runtime with only RL (LTO) optimized:"
 ls -lha a.out
 time ./a.out > /dev/null
@@ -180,7 +180,7 @@ if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then
        # packaging than simply shipping the rustup binaries (eg Debian should Just Work
        # here).
        cargo rustc -v --release -- -C linker-plugin-lto -C lto -C link-arg=-fuse-ld=lld
-       $CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp ../target/release/liblightning.a -ldl
+       $CLANGPP -Wall -std=c++11 -flto -fuse-ld=lld -O2 -pthread demo.cpp target/release/liblightning.a -ldl
        echo "C++ Bin size and runtime with cross-language LTO:"
        ls -lha a.out
        time ./a.out > /dev/null
index 8280f35685c80116db18b32b0374bbbcba2611b6..7e4a403e23f9ed9fa3d81b5d7d6f1e2e741f13bc 100644 (file)
@@ -17,3 +17,8 @@ crate-type = ["staticlib"
 [dependencies]
 bitcoin = "0.24"
 lightning = { version = "0.0.11", path = "../lightning" }
+
+# We eventually want to join the root workspace, but for now, the bindings generation is
+# a bit brittle and we don't want to hold up other developers from making changes just
+# because they break the bindings
+[workspace]