Skip to content

Commit

Permalink
Move c header generation out of build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Aug 28, 2020
1 parent 73e2455 commit 0a47a31
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 407 deletions.
9 changes: 7 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"utils/cgen",
"utils/test-client",
"memo/program",
"token-swap/program",
Expand Down
15 changes: 15 additions & 0 deletions cbindgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

cd "$(dirname "$0")"
set -x

# Cargo.lock can cause older spl-token bindings to be generated? Move it out of
# the way...
mv -f Cargo.lock Cargo.lock.org

cargo run --manifest-path=utils/cgen/Cargo.toml
exitcode=$?

mv -f Cargo.lock.org Cargo.lock

exit $exitcode
11 changes: 6 additions & 5 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ _ cargo run --manifest-path=utils/test-client/Cargo.toml


# Check generated C headers
#_ git diff --exit-code token/program/inc/token.h
#_ cc token/program/inc/token.h -o target/token.gch
#
#_ git diff --exit-code token-swap/program/inc/token-swap.h
#_ cc token-swap/program/inc/token-swap.h -o target/token-swap.gch
_ cargo run --manifest-path=utils/cgen/Cargo.toml

_ git diff --exit-code token/program/inc/token.h
_ cc token/program/inc/token.h -o target/token.gch
_ git diff --exit-code token-swap/program/inc/token-swap.h
_ cc token-swap/program/inc/token-swap.h -o target/token-swap.gch


# Run clippy for all program crates, with the `program` feature enabled
Expand Down
3 changes: 0 additions & 3 deletions token-swap/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ thiserror = "1.0"
[dev-dependencies]
rand = { version = "0.7.0"}

[build-dependencies]
cbindgen = "=0.14.2"

[lib]
name = "spl_token_swap"
crate-type = ["cdylib", "lib"]
17 changes: 0 additions & 17 deletions token-swap/program/build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions token/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@ num_enum = "0.5.1"
[dev-dependencies]
rand = { version = "0.7.0"}

[build-dependencies]
cbindgen = "=0.14.2"

[lib]
crate-type = ["cdylib", "lib"]
Loading

0 comments on commit 0a47a31

Please sign in to comment.