Skip to content

Commit

Permalink
Only run frozen-abi build script when needed (#2443)
Browse files Browse the repository at this point in the history
* add cfg(feature = "frozen-abi") to build.rs

* only depend on rustc_version when frozen-abi feature is activated

* remove extraneous dirs that snuck in from another branch

* update perf/build.rs as it's different from the standard build script

* use symlink for svm/build.rs

* remove unused build dep rustc_version from wen-restart

* fmt Cargo.toml
  • Loading branch information
kevinheavey authored Aug 8, 2024
1 parent c99095d commit 77ea09a
Show file tree
Hide file tree
Showing 33 changed files with 67 additions and 78 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test-case = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
dev-context-only-utils = [
Expand All @@ -89,6 +89,7 @@ dev-context-only-utils = [
"dep:solana-vote-program",
]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-sdk/frozen-abi",
Expand Down
3 changes: 2 additions & 1 deletion bloom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ name = "solana_bloom"
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-sdk/frozen-abi",
Expand Down
3 changes: 2 additions & 1 deletion builtins-default-costs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ rand = "0.8.5"
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"solana-vote-program/frozen-abi",
]
2 changes: 1 addition & 1 deletion cargo-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ toml = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
dev-context-only-utils = []
3 changes: 2 additions & 1 deletion compute-budget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ solana-frozen-abi = { workspace = true, optional = true }
solana-sdk = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"solana-sdk/frozen-abi",
]
3 changes: 2 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ test-case = { workspace = true }
sysctl = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
dev-context-only-utils = []
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-accounts-db/frozen-abi",
Expand Down
3 changes: 2 additions & 1 deletion cost-model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ test-case = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-compute-budget/frozen-abi",
Expand Down
4 changes: 2 additions & 2 deletions curves/secp256k1-recover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ borsh = { workspace = true }
libsecp256k1 = { workspace = true, features = ["hmac"] }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
borsh = ["dep:borsh"]
frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"]
frozen-abi = ["dep:rustc_version", "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
5 changes: 5 additions & 0 deletions frozen-abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ solana-logger = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }

[features]
default = ["frozen-abi"]
# no reason to deactivate this. It's needed because the build.rs is reused elsewhere
frozen-abi = []
3 changes: 3 additions & 0 deletions frozen-abi/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#[cfg(feature = "frozen-abi")]
extern crate rustc_version;
#[cfg(feature = "frozen-abi")]
use rustc_version::{version_meta, Channel};

fn main() {
#[cfg(feature = "frozen-abi")]
// Copied and adapted from
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example
// Licensed under Apache-2.0 + MIT
Expand Down
5 changes: 5 additions & 0 deletions frozen-abi/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ syn = { workspace = true, features = ["full", "extra-traits"] }

[build-dependencies]
rustc_version = { workspace = true }

[features]
default = ["frozen-abi"]
# no reason to deactivate this. It's needed because the build.rs is reused elsewhere
frozen-abi = []
3 changes: 2 additions & 1 deletion gossip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
test-case = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-bloom/frozen-abi",
Expand Down
3 changes: 2 additions & 1 deletion ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ spl-pod = { workspace = true }
test-case = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
dev-context-only-utils = []
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-runtime/frozen-abi",
Expand Down
3 changes: 2 additions & 1 deletion perf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ solana-logger = { workspace = true }
test-case = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-sdk/frozen-abi",
Expand Down
3 changes: 3 additions & 0 deletions perf/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#[cfg(feature = "frozen-abi")]
extern crate rustc_version;
#[cfg(feature = "frozen-abi")]
use rustc_version::{version_meta, Channel};

fn main() {
Expand All @@ -15,6 +17,7 @@ fn main() {
// Copied and adapted from
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example
// Licensed under Apache-2.0 + MIT
#[cfg(feature = "frozen-abi")]
match version_meta().unwrap().channel {
Channel::Stable => {
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
Expand Down
3 changes: 2 additions & 1 deletion program-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ name = "solana_program_runtime"
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
"dep:solana-frozen-abi-macro",
"solana-compute-budget/frozen-abi",
Expand Down
2 changes: 1 addition & 1 deletion programs/address-lookup-table/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ solana-program-runtime = { workspace = true }
solana-sdk = { workspace = true }

[build-dependencies]
rustc_version = { workspace = true }
rustc_version = { workspace = true, optional = true }

[lib]
crate-type = ["lib"]
Expand Down
Loading

0 comments on commit 77ea09a

Please sign in to comment.