Skip to content

Commit

Permalink
move ckb-rpc-gen to devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Oct 11, 2023
1 parent 2209d45 commit deb0d06
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 10 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ members = [
"util/launcher/migration-template",
"util/light-client-protocol-server",
"util/launcher",
"devtools/doc/rpc-gen",
"ckb-bin"
]

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ doc-deps: ## Build the documentation for the local package and all dependencies.

.PHONY: gen-rpc-doc
gen-rpc-doc: ## Generate rpc documentation
cd rpc && cargo build
./target/debug/ckb-rpc-gen-doc rpc/README.md
cd devtools/doc/rpc-gen && cargo build
./target/debug/ckb-rpc-gen rpc/README.md

.PHONY: gen-hashes
gen-hashes: ## Generate docs/hashes.toml
Expand Down
10 changes: 10 additions & 0 deletions devtools/doc/rpc-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "ckb-rpc-gen"
version = "0.1.0"
edition = "2021"

[dependencies]
ckb-rpc ={ path = "../../../rpc", version = "= 0.112.0-pre" }
schemars = { git = "https://github.com/chenyukang/schemars", branch = "fix-derive" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "~1.0"
2 changes: 1 addition & 1 deletion rpc/src/gen_doc/gen.rs → devtools/doc/rpc-gen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ fn gen_errors_content(res: &mut String) {
/// generate subscription module, which is handled specially here
/// since jsonrpc-utils ignore the `SubscriptionRpc`
fn gen_subscription_rpc_doc(res: &mut String) {
let pubsub_module_source = include_str!("../module/subscription.rs");
let pubsub_module_source = include_str!("../../../../rpc/src/module/subscription.rs");
// read comments before `pub trait SubscriptionRpc` and treat it as module summary
let summary = pubsub_module_source
.lines()
Expand Down
3 changes: 2 additions & 1 deletion rpc/src/gen_doc/main.rs → devtools/doc/rpc-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ fn dump_openrpc_json() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

fn gen_rpc_readme(readme_path: &str) -> Result<(), Box<dyn std::error::Error>> {
/// Generate rpc readme
pub fn gen_rpc_readme(readme_path: &str) -> Result<(), Box<dyn std::error::Error>> {
let all_rpc = vec![
alert_rpc_doc(),
net_rpc_doc(),
Expand Down
6 changes: 1 addition & 5 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ description = "CKB RPC server."
homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"

[[bin]]
name = "ckb-rpc-gen-doc"
path = "src/gen_doc/main.rs"

[dependencies]
ckb-chain-spec = { path = "../spec", version = "= 0.112.0-pre" }
ckb-types = { path = "../util/types", version = "= 0.112.0-pre" }
Expand Down Expand Up @@ -53,7 +49,7 @@ futures-util = { version = "0.3.21" }
tower-http = { version = "0.3.5", features = ["timeout"] }
async-stream = "0.3.3"
ckb-async-runtime = { path = "../util/runtime", version = "= 0.112.0-pre" }
schemars = { git = "https://github.com/chenyukang/schemars", branch = "fix-derive"}
schemars = { git = "https://github.com/chenyukang/schemars", branch = "fix-derive" }
#schemars = "0.8.15"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/module/alert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub trait AlertRpc {
///
/// Response
///
/// ```json
/// ```json
/// {
/// "error": {
/// "code": -1000,
Expand Down

0 comments on commit deb0d06

Please sign in to comment.