From e323c158bcffd1d9f9693cfb9db230b8e7ab0d82 Mon Sep 17 00:00:00 2001 From: Jon C Date: Wed, 4 Dec 2024 00:54:10 +0100 Subject: [PATCH] sdk: Add wasm target for docs #### Problem As pointed out in [this PR comment](https://github.com/anza-xyz/agave/pull/3634#discussion_r1867791497) 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. --- sdk/Cargo.toml | 4 +++- sdk/hash/Cargo.toml | 2 +- sdk/instruction/Cargo.toml | 2 +- sdk/keypair/Cargo.toml | 2 +- sdk/message/Cargo.toml | 2 +- sdk/program/Cargo.toml | 4 +++- sdk/program/src/lib.rs | 1 + sdk/pubkey/Cargo.toml | 2 +- sdk/src/lib.rs | 1 + 9 files changed, 13 insertions(+), 7 deletions(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 91a828853f51fe..6c2917297bd77b 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -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"] diff --git a/sdk/hash/Cargo.toml b/sdk/hash/Cargo.toml index 7db31fdf5929da..d05ac7edc7a491 100644 --- a/sdk/hash/Cargo.toml +++ b/sdk/hash/Cargo.toml @@ -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"] diff --git a/sdk/instruction/Cargo.toml b/sdk/instruction/Cargo.toml index 5826fca227ff20..6c21e3959784ea 100644 --- a/sdk/instruction/Cargo.toml +++ b/sdk/instruction/Cargo.toml @@ -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"] diff --git a/sdk/keypair/Cargo.toml b/sdk/keypair/Cargo.toml index dee76f0555a226..43a004ebb40c12 100644 --- a/sdk/keypair/Cargo.toml +++ b/sdk/keypair/Cargo.toml @@ -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"] diff --git a/sdk/message/Cargo.toml b/sdk/message/Cargo.toml index 20d8ab43dcef3a..0a88276d6943dd 100644 --- a/sdk/message/Cargo.toml +++ b/sdk/message/Cargo.toml @@ -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"] diff --git a/sdk/program/Cargo.toml b/sdk/program/Cargo.toml index 0478e559597754..f13f704c22a022 100644 --- a/sdk/program/Cargo.toml +++ b/sdk/program/Cargo.toml @@ -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"] diff --git a/sdk/program/src/lib.rs b/sdk/program/src/lib.rs index e36ff37750604c..ee1561f2dfdf65 100644 --- a/sdk/program/src/lib.rs +++ b/sdk/program/src/lib.rs @@ -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; diff --git a/sdk/pubkey/Cargo.toml b/sdk/pubkey/Cargo.toml index 08a80bbe243c42..1648f3ad8cb692 100644 --- a/sdk/pubkey/Cargo.toml +++ b/sdk/pubkey/Cargo.toml @@ -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"] diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index b51f88e7c6ef56..9efc5c3c6793b3 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -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;