Skip to content

Commit

Permalink
remove dependency on near-sdk entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
miraclx committed Aug 23, 2022
1 parent 5202fc5 commit 725656a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cargo-near/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ serde_json = "1.0"
symbolic-debuginfo = "8.8"
syn = "1.0"
quote = "1.0"
schemars = "0.8"

[dependencies.near-abi]
git = "https://github.com/near/near-abi-rs"
Expand All @@ -32,4 +33,3 @@ features = ["__chunked-entries"]
[dev-dependencies]
function_name = "0.3"
proc-macro2 = "1.0"
schemars = "0.8"
10 changes: 4 additions & 6 deletions cargo-near/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ fn strip_docs(abi_root: &mut near_abi::AbiRoot) {
function.doc = None;
}
for schema in &mut abi_root.abi.root_schema.definitions.values_mut() {
if let near_abi::__private::schemars::schema::Schema::Object(
near_abi::__private::schemars::schema::SchemaObject {
metadata: Some(metadata),
..
},
) = schema
if let schemars::schema::Schema::Object(schemars::schema::SchemaObject {
metadata: Some(metadata),
..
}) = schema
{
metadata.description = None;
}
Expand Down
1 change: 1 addition & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ publish = false

[dev-dependencies]
anyhow = "1.0"
borsh = "0.9"
cargo-near = { path = "../cargo-near" }
function_name = "0.3"
git2 = "0.14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ serde = { version = "1", features = ["derive"] }
schemars = "0.8"

[patch.crates-io]
near-sdk = { git = "https://github.com/near/near-sdk-rs.git", rev = "2b3a8a0a68208c5cf3fa88fd566daa107f782e26" }
near-sdk = { git = "https://github.com/near/near-sdk-rs.git", rev = "49d521c01033757b01bacf40d8713fe738bbe1cf" }

[workspace]
members = []
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/cargo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn clone_git_repo(version: &str) -> anyhow::Result<TempDir> {
#[test]
#[named]
fn test_dependency_local_path() -> anyhow::Result<()> {
let near_sdk_dir = clone_git_repo("2b3a8a0a68208c5cf3fa88fd566daa107f782e26")?;
let near_sdk_dir = clone_git_repo("49d521c01033757b01bacf40d8713fe738bbe1cf")?;
let near_sdk_dep_path = near_sdk_dir.path().join("near-sdk");

// near-sdk = { path = "::path::", features = ["abi"] }
Expand All @@ -40,7 +40,7 @@ fn test_dependency_local_path() -> anyhow::Result<()> {
#[test]
#[named]
fn test_dependency_local_path_with_version() -> anyhow::Result<()> {
let near_sdk_dir = clone_git_repo("2b3a8a0a68208c5cf3fa88fd566daa107f782e26")?;
let near_sdk_dir = clone_git_repo("49d521c01033757b01bacf40d8713fe738bbe1cf")?;
let near_sdk_dep_path = near_sdk_dir.path().join("near-sdk");

// near-sdk = { path = "::path::", version = "4.1.0-pre.1", features = ["abi"] }
Expand Down Expand Up @@ -172,7 +172,7 @@ fn test_dependency_patch() -> anyhow::Result<()> {
// near-sdk = { version = "4.1.0-pre.1", features = ["abi"] }
//
// [patch.crates-io]
// near-sdk = { git = "https://github.com/near/near-sdk-rs.git", rev = "2b3a8a0a68208c5cf3fa88fd566daa107f782e26" }
// near-sdk = { git = "https://github.com/near/near-sdk-rs.git", rev = "49d521c01033757b01bacf40d8713fe738bbe1cf" }
let abi_root = generate_abi_fn! {
with Cargo "/templates/sdk-dependency/_Cargo_patch.toml";

Expand Down
6 changes: 2 additions & 4 deletions integration-tests/tests/tests/borsh_schema.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use borsh::schema::{BorshSchemaContainer, Definition, Fields};
use cargo_near_integration_tests::{generate_abi, generate_abi_fn};
use function_name::named;
use near_sdk::{
__private::{AbiParameter, AbiType},
borsh::schema::{BorshSchemaContainer, Definition, Fields},
};
use near_abi::{AbiParameter, AbiType};
use std::{collections::HashMap, fs};

trait AsBorshSchema {
Expand Down

0 comments on commit 725656a

Please sign in to comment.