Skip to content

Commit

Permalink
Move cli to node (#253)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe what change this PR is implementing -->

Move CLI & RPC crates to the `node` directory to clean up the root
directory.

### Types of Changes
<!--- What types of changes does your code introduce? -->
- [x] Tech Debt (Code improvements)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Dependency upgrade (A change in substrate or any 3rd party crate
version)

### Migrations and Hooks
<!--- Check the following box with an x if the following applies: -->
- [ ] This change requires a runtime migration.
- [ ] Modifies `on_initialize`
- [ ] Modifies `on_finalize`

### Checklist
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [x] Change has been tested locally.
- [ ] Change adds / updates tests.
- [ ] Changelog doc updated.
  • Loading branch information
rakanalh authored Jan 31, 2024
1 parent 3dfb1c6 commit 5c21d10
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 44 deletions.
9 changes: 0 additions & 9 deletions Cargo.lock

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

24 changes: 4 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
[[bin]]
name = "cere"
path = "src/main.rs"

[package]
name = "cere"
[workspace.package]
version = "4.8.8"
build = "build.rs"
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
cere-cli = { path = "cli", features = ["cere-dev-native"] }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.40" }

[workspace]
members = [
"cli",
"node/cli",
"node/client",
"node/service",
"rpc",
"node/rpc",
"runtime/cere",
"runtime/cere-dev",
"pallets/chainbridge",
Expand All @@ -33,10 +20,7 @@ members = [
"pallets/ddc-clusters",
"primitives",
]
resolver = "2"

[profile.release]
panic = "unwind"

[features]
runtime-benchmarks = ["cere-cli/runtime-benchmarks"]
try-runtime = ["cere-cli/try-runtime"]
7 changes: 0 additions & 7 deletions build.rs

This file was deleted.

10 changes: 7 additions & 3 deletions cli/Cargo.toml → node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ wasm-opt = false
[lib]
crate-type = ["cdylib", "rlib"]

[[bin]]
name = "cere"
path = "src/main.rs"

[dependencies]
clap = { version = "4.0.15", features = ["derive"], optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.40" }
Expand All @@ -20,14 +24,14 @@ try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional =
url = "2.4.1"

# Local
cere-client = { path = "../node/client", optional = true }
cere-service = { path = "../node/service", default-features = false, optional = true }
cere-client = { path = "../client", optional = true }
cere-service = { path = "../service", default-features = false, optional = true }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }

[features]
default = ["cli", "cere-native"]
default = ["cli", "cere-dev-native"]
cli = [
"clap",
"sc-cli",
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cli/src/command.rs → node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ pub fn run() -> sc_cli::Result<()> {

#[cfg(not(feature = "cere-native"))]
#[allow(unreachable_code)]
Error::Service(ServiceError::Other(
Err(Error::Service(ServiceError::Other(
"No runtime feature (cere-native, cere-dev-native) is enabled".to_string(),
))
)))
},
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
let (client, _, _, _) = cere_service::new_chain_ops(&config)?;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-

# Local
cere-client = { path = "../client", default-features = false, optional = true }
cere-rpc = { path = "../../rpc" }
cere-rpc = { path = "../rpc" }
cere-runtime-common = { path = "../../runtime/common", optional = true }

cere-dev-runtime = { path = "../../runtime/cere-dev", optional = true }
Expand Down
11 changes: 9 additions & 2 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
use std::sync::Arc;

#[cfg(not(any(feature = "cere-native", feature = "cere-dev-native",)))]
compile_error!("at least one runtime feature must be enabled");

#[cfg(feature = "cere-dev-native")]
pub use cere_dev_runtime;
#[cfg(feature = "cere-native")]
Expand All @@ -18,9 +21,13 @@ use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
use sp_trie::PrefixedMemoryDB;
pub mod chain_spec;
#[cfg(feature = "cere-dev-native")]
pub use cere_client::CereDevExecutorDispatch;
#[cfg(feature = "cere-native")]
pub use cere_client::CereExecutorDispatch;
pub use cere_client::{
AbstractClient, CereDevExecutorDispatch, CereExecutorDispatch, Client, ClientHandle,
ExecuteWithClient, FullBackend, FullClient, RuntimeApiCollection,
AbstractClient, Client, ClientHandle, ExecuteWithClient, FullBackend, FullClient,
RuntimeApiCollection,
};
pub use chain_spec::{CereChainSpec, CereDevChainSpec};
pub use node_primitives::{Block, BlockNumber};
Expand Down

0 comments on commit 5c21d10

Please sign in to comment.