diff --git a/nextgraph/Cargo.toml b/nextgraph/Cargo.toml index 9ad8aa7..b13bb6a 100644 --- a/nextgraph/Cargo.toml +++ b/nextgraph/Cargo.toml @@ -9,7 +9,7 @@ authors.workspace = true repository.workspace = true homepage.workspace = true keywords = [ "crdt","e2ee","local-first","p2p","semantic-web" ] -documentation.workspace = true +documentation = "https://docs.rs/nextgraph" rust-version.workspace = true [badges] diff --git a/ng-verifier/Cargo.toml b/ng-verifier/Cargo.toml index 3e806fc..c37267c 100644 --- a/ng-verifier/Cargo.toml +++ b/ng-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ng-verifier" -version = "0.1.0-preview.5" +version = "0.1.0-preview.6" description = "Verifier library of NextGraph" edition.workspace = true license.workspace = true @@ -10,6 +10,7 @@ homepage.workspace = true keywords = ["crdt","e2ee","local-first","p2p","eventual-consistency"] documentation.workspace = true rust-version.workspace = true +build = "build.rs" [badges] maintenance = { status = "actively-developed" } @@ -34,10 +35,10 @@ ng-repo = { path = "../ng-repo", version = "0.1.0-preview.1" } ng-net = { path = "../ng-net", version = "0.1.0-preview.1" } ng-oxigraph = { path = "../ng-oxigraph", version = "0.4.0-alpha.7-ngpreview6" } -[target.'cfg(target_arch = "wasm32")'.dependencies] +[target.'cfg(target_family = "wasm")'.dependencies] ng-oxigraph = { path = "../ng-oxigraph", version = "0.4.0-alpha.7-ngpreview6", features = ["js"] } -[target.'cfg(all(not(target_arch = "wasm32")))'.dependencies] +[target.'cfg(all(not(target_family = "wasm"),not(docsrs)))'.dependencies] ng-storage-rocksdb = { path = "../ng-storage-rocksdb", version = "0.1.0-preview.6" } getrandom = "0.2.7" diff --git a/ng-verifier/build.rs b/ng-verifier/build.rs new file mode 100644 index 0000000..02716ec --- /dev/null +++ b/ng-verifier/build.rs @@ -0,0 +1,7 @@ +fn main() { + + if std::env::var("DOCS_RS").is_ok() { + println!("cargo:rustc-cfg=docsrs"); + } + +} \ No newline at end of file diff --git a/ng-verifier/src/lib.rs b/ng-verifier/src/lib.rs index b4567a7..8c2c26e 100644 --- a/ng-verifier/src/lib.rs +++ b/ng-verifier/src/lib.rs @@ -12,5 +12,5 @@ mod commits; mod request_processor; -#[cfg(all(not(target_family = "wasm")))] +#[cfg(all(not(target_family = "wasm"),not(docsrs)))] mod rocksdb_user_storage; diff --git a/ng-verifier/src/verifier.rs b/ng-verifier/src/verifier.rs index c025c97..6777ea4 100644 --- a/ng-verifier/src/verifier.rs +++ b/ng-verifier/src/verifier.rs @@ -13,11 +13,11 @@ use core::fmt; use std::cmp::max; use std::collections::BTreeMap; use std::collections::HashSet; -#[cfg(all(not(target_family = "wasm")))] +#[cfg(all(not(target_family = "wasm"),not(docsrs)))] use std::fs::create_dir_all; -#[cfg(all(not(target_family = "wasm")))] +#[cfg(all(not(target_family = "wasm"),not(docsrs)))] use std::fs::{read, File, OpenOptions}; -#[cfg(all(not(target_family = "wasm")))] +#[cfg(all(not(target_family = "wasm"),not(docsrs)))] use std::io::Write; use std::{collections::HashMap, sync::Arc}; @@ -58,7 +58,7 @@ use ng_net::{ }; use crate::commits::*; -#[cfg(all(not(target_family = "wasm")))] +#[cfg(all(not(target_family = "wasm"),not(docsrs)))] use crate::rocksdb_user_storage::RocksDbUserStorage; use crate::types::*; use crate::user_storage::InMemoryUserStorage; @@ -714,7 +714,7 @@ impl Verifier { } Ok(res) } - #[cfg(all(not(target_family = "wasm")))] + #[cfg(all(not(target_family = "wasm"),not(docsrs)))] VerifierConfigType::RocksDb(path) => { let mut path = path.clone(); path.push(format!("outbox{}", self.peer_id.to_hash_string())); @@ -794,7 +794,7 @@ impl Verifier { serde_bare::to_vec(&e)?, )?; } - #[cfg(all(not(target_family = "wasm")))] + #[cfg(all(not(target_family = "wasm"),not(docsrs)))] VerifierConfigType::RocksDb(path) => { let mut path = path.clone(); std::fs::create_dir_all(path.clone()).unwrap(); @@ -1968,7 +1968,7 @@ impl Verifier { let res = (js.last_seq_function)(self.peer_id, qty)?; self.max_reserved_seq_num = res + qty as u64; } - #[cfg(all(not(target_family = "wasm")))] + #[cfg(all(not(target_family = "wasm"),not(docsrs)))] VerifierConfigType::RocksDb(path) => { let mut path = path.clone(); std::fs::create_dir_all(path.clone()).unwrap(); @@ -2028,7 +2028,7 @@ impl Verifier { Some(Box::new(InMemoryUserStorage::new()) as Box), Some(block_storage), ), - #[cfg(all(not(target_family = "wasm")))] + #[cfg(all(not(target_family = "wasm"),not(docsrs)))] VerifierConfigType::RocksDb(path) => { let mut path_oxi = path.clone(); path_oxi.push("graph");