Skip to content

Commit

Permalink
sdk: Add wasm target for docs
Browse files Browse the repository at this point in the history
#### Problem

As pointed out in [this PR
comment](anza-xyz#3634 (comment))
it's good to specify that docs build for wasm32 where needed.

Also, solana-sdk and solana-program don't configure docs builds with all
features enabled.

#### Summary of changes

In most places, add "wasm32-unknown-unknown" as a build target. For sdk
and program, also configure the features to be enabled.
  • Loading branch information
joncinque committed Dec 3, 2024
1 parent f833179 commit e323c15
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ static_assertions = { workspace = true }
tiny-bip39 = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
2 changes: 1 addition & 1 deletion sdk/hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

Expand Down
2 changes: 1 addition & 1 deletion sdk/instruction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ serde = [
std = []

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

Expand Down
2 changes: 1 addition & 1 deletion sdk/keypair/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ tiny-bip39 = { workspace = true }
seed-derivable = ["dep:solana-derivation-path", "dep:solana-seed-derivable", "dep:ed25519-dalek-bip32"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]
2 changes: 1 addition & 1 deletion sdk/message/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ serde = [
]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

Expand Down
4 changes: 3 additions & 1 deletion sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ static_assertions = { workspace = true }
test-case = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
1 change: 1 addition & 0 deletions sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
#![allow(incomplete_features)]
#![cfg_attr(feature = "frozen-abi", feature(specialization))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

// Allows macro expansion of `use ::solana_program::*` to work within this crate
extern crate self as solana_program;
Expand Down
2 changes: 1 addition & 1 deletion sdk/pubkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sha2 = ["dep:solana-sha256-hasher", "solana-sha256-hasher/sha2"]
std = []

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

Expand Down
1 change: 1 addition & 0 deletions sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#![allow(incomplete_features)]
#![cfg_attr(feature = "frozen-abi", feature(specialization))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

// Allows macro expansion of `use ::solana_sdk::*` to work within this crate
extern crate self as solana_sdk;
Expand Down

0 comments on commit e323c15

Please sign in to comment.