Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 0a47a31

Browse files
committed
Move c header generation out of build.rs
1 parent 73e2455 commit 0a47a31

File tree

11 files changed

+129
-407
lines changed

11 files changed

+129
-407
lines changed

Cargo.lock

+7-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[workspace]
22
members = [
3+
"utils/cgen",
34
"utils/test-client",
45
"memo/program",
56
"token-swap/program",

cbindgen.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
cd "$(dirname "$0")"
4+
set -x
5+
6+
# Cargo.lock can cause older spl-token bindings to be generated? Move it out of
7+
# the way...
8+
mv -f Cargo.lock Cargo.lock.org
9+
10+
cargo run --manifest-path=utils/cgen/Cargo.toml
11+
exitcode=$?
12+
13+
mv -f Cargo.lock.org Cargo.lock
14+
15+
exit $exitcode

ci/script.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ _ cargo run --manifest-path=utils/test-client/Cargo.toml
3232

3333

3434
# Check generated C headers
35-
#_ git diff --exit-code token/program/inc/token.h
36-
#_ cc token/program/inc/token.h -o target/token.gch
37-
#
38-
#_ git diff --exit-code token-swap/program/inc/token-swap.h
39-
#_ cc token-swap/program/inc/token-swap.h -o target/token-swap.gch
35+
_ cargo run --manifest-path=utils/cgen/Cargo.toml
36+
37+
_ git diff --exit-code token/program/inc/token.h
38+
_ cc token/program/inc/token.h -o target/token.gch
39+
_ git diff --exit-code token-swap/program/inc/token-swap.h
40+
_ cc token-swap/program/inc/token-swap.h -o target/token-swap.gch
4041

4142

4243
# Run clippy for all program crates, with the `program` feature enabled

token-swap/program/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ thiserror = "1.0"
2828
[dev-dependencies]
2929
rand = { version = "0.7.0"}
3030

31-
[build-dependencies]
32-
cbindgen = "=0.14.2"
33-
3431
[lib]
3532
name = "spl_token_swap"
3633
crate-type = ["cdylib", "lib"]

token-swap/program/build.rs

-17
This file was deleted.

token/program/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,5 @@ num_enum = "0.5.1"
2929
[dev-dependencies]
3030
rand = { version = "0.7.0"}
3131

32-
[build-dependencies]
33-
cbindgen = "=0.14.2"
34-
3532
[lib]
3633
crate-type = ["cdylib", "lib"]

0 commit comments

Comments
 (0)