Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docsrs builds final #2235

Merged
merged 4 commits into from Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -38,6 +38,7 @@ default-members = [

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
DaniPopes marked this conversation as resolved.
Show resolved Hide resolved
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
Expand Down
1 change: 1 addition & 0 deletions ethers-contract/Cargo.toml
Expand Up @@ -57,4 +57,5 @@ openssl = ["ethers-contract-abigen/openssl"]

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions ethers-contract/ethers-contract-abigen/Cargo.toml
Expand Up @@ -43,6 +43,7 @@ getrandom = { version = "0.2", features = ["js"] }

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[features]
Expand Down
1 change: 1 addition & 0 deletions ethers-contract/ethers-contract-derive/Cargo.toml
Expand Up @@ -30,4 +30,5 @@ eyre = "0.6"

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
19 changes: 6 additions & 13 deletions ethers-contract/src/lib.rs
Expand Up @@ -69,31 +69,24 @@ pub use once_cell::sync::Lazy;
#[cfg(feature = "eip712")]
pub use ethers_derive_eip712::*;

// For Abigen expansions in docs.rs builds.
// For macro expansions only, not public API.
// See: [#2235](https://github.com/gakonst/ethers-rs/pull/2235)

#[doc(hidden)]
#[allow(unused_extern_crates)]
extern crate self as ethers_contract;

#[doc(hidden)]
#[allow(unused_extern_crates)]
#[cfg(docsrs)]
extern crate self as ethers;

#[doc(hidden)]
#[cfg(docsrs)]
pub mod core {
pub use ethers_core::*;
}

#[doc(hidden)]
#[cfg(docsrs)]
pub mod contract {
pub use crate::*;
}

#[doc(hidden)]
#[cfg(docsrs)]
pub mod providers {
pub use ethers_providers::*;
}
pub use ethers_core as core;

#[doc(hidden)]
pub use ethers_providers as providers;
1 change: 1 addition & 0 deletions ethers-core/Cargo.toml
Expand Up @@ -66,4 +66,5 @@ macros = ["syn", "cargo_metadata", "once_cell"]

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions ethers-etherscan/Cargo.toml
Expand Up @@ -42,6 +42,7 @@ tracing-subscriber = { version = "0.3", default-features = false, features = ["e

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[features]
Expand Down
1 change: 1 addition & 0 deletions ethers-middleware/Cargo.toml
Expand Up @@ -12,6 +12,7 @@ keywords = ["ethereum", "web3", "celo", "ethers"]

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
Expand Down
16 changes: 16 additions & 0 deletions ethers-middleware/src/lib.rs
Expand Up @@ -40,3 +40,19 @@ pub use timelag::TimeLag;
/// [`Middleware`](ethers_providers::Middleware) in a concise way
pub mod builder;
pub use builder::MiddlewareBuilder;

// For macro expansions only, not public API.
// See: [#2235](https://github.com/gakonst/ethers-rs/pull/2235)

#[doc(hidden)]
#[allow(unused_extern_crates)]
extern crate self as ethers;

#[doc(hidden)]
pub use ethers_contract as contract;

#[doc(hidden)]
pub use ethers_core as core;

#[doc(hidden)]
pub use ethers_providers as providers;
Comment on lines +47 to +58
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I'm not sure I like that these are now always there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have a better way to find ethers crate names then go ahead, this is a patch for builds when that is not possible, and only for our internal crates

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a better solution for this, and seems like this is a proper fix.
But let's document why we're doing this

1 change: 1 addition & 0 deletions ethers-providers/Cargo.toml
Expand Up @@ -12,6 +12,7 @@ keywords = ["ethereum", "web3", "celo", "ethers"]

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions ethers-signers/Cargo.toml
Expand Up @@ -12,6 +12,7 @@ keywords = ["ethereum", "web3", "celo", "ethers"]

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Expand Up @@ -83,11 +83,6 @@
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms), allow(dead_code, unused_variables))))]

// For macro expansion
#[doc(hidden)]
#[allow(unused_extern_crates)]
extern crate self as ethers;

#[doc(inline)]
pub use ethers_addressbook as addressbook;
#[doc(inline)]
Expand Down Expand Up @@ -129,3 +124,8 @@ pub mod prelude {
#[cfg(feature = "ethers-solc")]
pub use super::solc::*;
}

// For macro expansions only, not public API.
#[doc(hidden)]
#[allow(unused_extern_crates)]
extern crate self as ethers;