From 8753b3cecb3999425b30568a59be26a340459467 Mon Sep 17 00:00:00 2001 From: Fusee Date: Tue, 7 Nov 2023 18:54:53 +0100 Subject: [PATCH] setup CI --- .github/workflows/publish-crates.yml | 6 +++--- abi-build/Cargo.toml | 3 +++ abi-build/src/generator/impl_abi_mod.rs | 12 ++++++------ abi-build/src/generator/impl_contract.rs | 6 ------ core/Cargo.toml | 3 +++ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish-crates.yml b/.github/workflows/publish-crates.yml index 0c72d32..dc6b71c 100644 --- a/.github/workflows/publish-crates.yml +++ b/.github/workflows/publish-crates.yml @@ -17,11 +17,11 @@ jobs: - name: Switch to Rust nightly run: rustup default nightly - name: Build - run: cargo build + run: cargo build --features ci - name: Run tests - run: cargo test + run: cargo test --features ci - name: Install cargo-release - run: cargo install cargo-release + run: cargo install cargo-release --no-verify - name: Publish crate env: CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} diff --git a/abi-build/Cargo.toml b/abi-build/Cargo.toml index 7611ab9..f7f3f4a 100644 --- a/abi-build/Cargo.toml +++ b/abi-build/Cargo.toml @@ -6,6 +6,9 @@ description = "A build-dependency crate for 'nova' which hosts macros and utilit license = "GPL-3.0-only" repository = "https://github.com/gfusee/novax" +[features] +no-fmt-output = [] + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/abi-build/src/generator/impl_abi_mod.rs b/abi-build/src/generator/impl_abi_mod.rs index fb1f298..3b5bcf5 100644 --- a/abi-build/src/generator/impl_abi_mod.rs +++ b/abi-build/src/generator/impl_abi_mod.rs @@ -1,24 +1,24 @@ use proc_macro2::TokenStream; use quote::{format_ident, quote}; -use rust_format::{Formatter, RustFmt}; use crate::abi::result::Abi; use crate::errors::build_error::BuildError; use crate::generator::generated_file::GeneratedFile; -use crate::generator::generator_error::GeneratorError; use crate::generator::impl_abi_types::impl_abi_types_mod; use crate::generator::impl_contract::impl_contract; pub fn generate_from_abi(abi: &Abi) -> Result { - let Ok(formatted_content) = RustFmt::default().format_str(impl_mod(abi)?.to_string()) else { - println!("{:?}", RustFmt::default().format_str(impl_mod(abi)?.to_string()).unwrap_err()); - return Err(GeneratorError::UnableToFormatRustCode.into()) + let content = impl_mod(abi)?.to_string(); + + #[cfg(not(feature = "no-fmt-output"))] + let Ok(content) = rust_format::Formatter::format_str(&rust_format::RustFmt::default(), content) else { + return Err(crate::generator::generator_error::GeneratorError::UnableToFormatRustCode.into()) }; Ok( GeneratedFile { file_name: abi.get_mod_name() + ".rs", mod_name: abi.get_mod_name(), - file_content: formatted_content + file_content: content } ) } diff --git a/abi-build/src/generator/impl_contract.rs b/abi-build/src/generator/impl_contract.rs index bd22783..716469c 100644 --- a/abi-build/src/generator/impl_contract.rs +++ b/abi-build/src/generator/impl_contract.rs @@ -672,12 +672,6 @@ fn get_managed_type_for_abi_type(abi_type_name: &str, abi_types: &AbiTypes, api_ quote! {#managed_type_ident} ) } else { - let test = parse_abi_type_name_to_managed_ident( - abi_type_name, - abi_types, - api_generic - )?; - if abi_type_name.starts_with("multi") { panic!("bouhhh"); } diff --git a/core/Cargo.toml b/core/Cargo.toml index 2b83f9a..07549ca 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -9,6 +9,9 @@ repository = "https://github.com/gfusee/novax" categories = ["cryptography::cryptocurrencies", "api-bindings"] keywords = ["multiversx", "blockchain", "sdk", "api"] +[features] +ci = ["novax-abi-build/no-fmt-output"] + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies]