mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
The crate rename (#4223)
* Adding script for rename, could be applicable for nodes on top of it, too * add stderr and gitlab ci features * apply script * fix now minor details in expected stderr * Update the Cargo.lock * fix name: sc-transaction -> sc-tracing * fix rename in script, too
This commit is contained in:
committed by
GitHub
parent
40f6d05a4c
commit
927e13c13a
@@ -44,9 +44,9 @@ mod utils;
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use sr_version::create_runtime_str;
|
||||
/// use sp_version::create_runtime_str;
|
||||
/// #
|
||||
/// # use sr_primitives::traits::GetNodeBlockType;
|
||||
/// # use sp_runtime::traits::GetNodeBlockType;
|
||||
/// # use test_client::runtime::{Block, Header};
|
||||
/// #
|
||||
/// # /// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
|
||||
@@ -56,7 +56,7 @@ mod utils;
|
||||
/// # type NodeBlock = Block;
|
||||
/// # }
|
||||
/// #
|
||||
/// # sr_api::decl_runtime_apis! {
|
||||
/// # sp_api::decl_runtime_apis! {
|
||||
/// # /// Declare the api trait.
|
||||
/// # pub trait Balance {
|
||||
/// # /// Get the balance.
|
||||
@@ -70,9 +70,9 @@ mod utils;
|
||||
/// # }
|
||||
///
|
||||
/// /// All runtime api implementations need to be done in one call of the macro!
|
||||
/// sr_api::impl_runtime_apis! {
|
||||
/// # impl sr_api::Core<Block> for Runtime {
|
||||
/// # fn version() -> sr_version::RuntimeVersion {
|
||||
/// sp_api::impl_runtime_apis! {
|
||||
/// # impl sp_api::Core<Block> for Runtime {
|
||||
/// # fn version() -> sp_version::RuntimeVersion {
|
||||
/// # unimplemented!()
|
||||
/// # }
|
||||
/// # fn execute_block(_block: Block) {}
|
||||
@@ -96,7 +96,7 @@ mod utils;
|
||||
/// }
|
||||
///
|
||||
/// /// Runtime version. This needs to be declared for each runtime.
|
||||
/// pub const VERSION: sr_version::RuntimeVersion = sr_version::RuntimeVersion {
|
||||
/// pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
|
||||
/// spec_name: create_runtime_str!("node"),
|
||||
/// impl_name: create_runtime_str!("test-node"),
|
||||
/// authoring_version: 1,
|
||||
@@ -127,7 +127,7 @@ pub fn impl_runtime_apis(input: TokenStream) -> TokenStream {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// sr_api::decl_runtime_apis! {
|
||||
/// sp_api::decl_runtime_apis! {
|
||||
/// /// Declare the api trait.
|
||||
/// pub trait Balance {
|
||||
/// /// Get the balance.
|
||||
@@ -159,7 +159,7 @@ pub fn impl_runtime_apis(input: TokenStream) -> TokenStream {
|
||||
/// spec version!). Such a method also does not need to be implemented in the runtime.
|
||||
///
|
||||
/// ```rust
|
||||
/// sr_api::decl_runtime_apis! {
|
||||
/// sp_api::decl_runtime_apis! {
|
||||
/// /// Declare the api trait.
|
||||
/// #[api_version(2)]
|
||||
/// pub trait Balance {
|
||||
|
||||
@@ -32,22 +32,22 @@ pub fn unwrap_or_error(res: Result<TokenStream>) -> TokenStream {
|
||||
}
|
||||
|
||||
fn generate_hidden_includes_mod_name(unique_id: &'static str) -> Ident {
|
||||
Ident::new(&format!("sr_api_hidden_includes_{}", unique_id), Span::call_site())
|
||||
Ident::new(&format!("sp_api_hidden_includes_{}", unique_id), Span::call_site())
|
||||
}
|
||||
|
||||
/// Generates the hidden includes that are required to make the macro independent from its scope.
|
||||
pub fn generate_hidden_includes(unique_id: &'static str) -> TokenStream {
|
||||
if env::var("CARGO_PKG_NAME").unwrap() == "sr-api" {
|
||||
if env::var("CARGO_PKG_NAME").unwrap() == "sp-api" {
|
||||
TokenStream::new()
|
||||
} else {
|
||||
let mod_name = generate_hidden_includes_mod_name(unique_id);
|
||||
match crate_name("sr-api") {
|
||||
match crate_name("sp-api") {
|
||||
Ok(client_name) => {
|
||||
let client_name = Ident::new(&client_name, Span::call_site());
|
||||
quote!(
|
||||
#[doc(hidden)]
|
||||
mod #mod_name {
|
||||
pub extern crate #client_name as sr_api;
|
||||
pub extern crate #client_name as sp_api;
|
||||
}
|
||||
)
|
||||
},
|
||||
@@ -60,13 +60,13 @@ pub fn generate_hidden_includes(unique_id: &'static str) -> TokenStream {
|
||||
}.into()
|
||||
}
|
||||
|
||||
/// Generates the access to the `substrate_client` crate.
|
||||
/// Generates the access to the `sc_client` crate.
|
||||
pub fn generate_crate_access(unique_id: &'static str) -> TokenStream {
|
||||
if env::var("CARGO_PKG_NAME").unwrap() == "sr-api" {
|
||||
if env::var("CARGO_PKG_NAME").unwrap() == "sp-api" {
|
||||
quote!( crate )
|
||||
} else {
|
||||
let mod_name = generate_hidden_includes_mod_name(unique_id);
|
||||
quote!( self::#mod_name::sr_api )
|
||||
quote!( self::#mod_name::sp_api )
|
||||
}.into()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user