Skip to content

Commit

Permalink
chore: make ethers-solc optional (#1463)
Browse files Browse the repository at this point in the history
* chore: make ethers-solc optional

* chore: update CHANGELOG

* add missing requirement

* add abigen req
  • Loading branch information
mattsse committed Jul 6, 2022
1 parent 0b88e42 commit fb3fb16
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@

### Unreleased

- Make `ethers-solc` optional dependency of `ethers`, needs `ethers-solc` feature to activate
[#1463](https://github.com/gakonst/ethers-rs/pull/1463)
- Add `rawMetadata:String` field to configurable contract output
[#1365](https://github.com/gakonst/ethers-rs/pull/1365)
- Use relative source paths and `solc --base-path`
Expand Down
19 changes: 13 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ abigen = ["ethers-contract/abigen"]
### abigen without reqwest
abigen-offline = ["ethers-contract/abigen-offline"]
## solc
solc-async = ["ethers-solc/async"]
solc-full = ["ethers-solc/full"]
solc-tests = ["ethers-solc/tests"]
solc-sha2-asm = ["ethers-solc/asm"]
solc-full = ["ethers-solc", "ethers-solc/full"]
solc-tests = ["ethers-solc", "ethers-solc/tests"]
solc-sha2-asm = ["ethers-solc", "ethers-solc/asm"]

[dependencies]
ethers-addressbook = { version = "^0.13.0", default-features = false, path = "./ethers-addressbook" }
Expand All @@ -88,7 +87,7 @@ ethers-core = { version = "^0.13.0", default-features = false, path = "./ethers-
ethers-providers = { version = "^0.13.0", default-features = false, path = "./ethers-providers" }
ethers-signers = { version = "^0.13.0", default-features = false, path = "./ethers-signers" }
ethers-middleware = { version = "^0.13.0", default-features = false, path = "./ethers-middleware" }
ethers-solc = { version = "^0.13.0", default-features = false, path = "./ethers-solc" }
ethers-solc = { version = "^0.13.0", default-features = false, path = "./ethers-solc", optional = true }
ethers-etherscan = { version = "^0.13.0", default-features = false, path = "./ethers-etherscan" }

[dev-dependencies]
Expand All @@ -112,17 +111,25 @@ bytes = "1.1.0"
opt-level = "s"


[[example]]
name = "abigen"
path = "examples/abigen.rs"
required-features = ["ethers-solc"]

[[example]]
name = "contract_human_readable"
path = "examples/contract_human_readable.rs"
required-features = ["ethers-solc"]

[[example]]
name = "contract_with_abi"
path = "examples/contract_with_abi.rs"
required-features = ["ethers-solc"]

[[example]]
name = "contract_with_abi_and_bytecode"
path = "examples/contract_with_abi_and_bytecode.rs"
required-features = ["ethers-solc"]

[[example]]
name = "ipc"
Expand All @@ -137,7 +144,7 @@ required-features = ["ledger"]
[[example]]
name = "moonbeam_with_abi"
path = "examples/moonbeam_with_abi.rs"
required-features = ["legacy"]
required-features = ["legacy", "ethers-solc"]

[[example]]
name = "trezor"
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ for file in examples/*.rs; do
continue
fi
echo "running: $file"
cargo r -p ethers --example "$(basename "$name")"
cargo r -p ethers --example "$(basename "$name")" --features "ethers-solc"
done
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ pub mod signers {
pub use ethers_signers::*;
}

#[cfg(feature = "ethers-solc")]
#[doc = include_str!("../assets/SOLC_README.md")]
pub mod solc {
pub use ethers_solc::*;
Expand Down Expand Up @@ -141,6 +142,7 @@ pub mod prelude {

pub use super::signers::*;

#[cfg(feature = "ethers-solc")]
pub use super::solc::*;

pub use super::etherscan::*;
Expand Down

0 comments on commit fb3fb16

Please sign in to comment.