FAZ 1 Complete: Workspace compile fixes, warning cleanup, version bumps
- Fixed is_using_frame_crate() macro to check for pezframe/pezkuwi_sdk - Removed disable_pezframe_system_supertrait_check temporary bypasses - Feature-gated storage-benchmark and teyrchain-benchmarks code - Fixed dead_code warnings with underscore prefix (_Header) - Removed unused imports and shadowing use statements - Version bumps: procedural-tools 10.0.1, benchmarking-cli 32.0.1, docs 0.0.2, minimal-runtime 0.0.1, yet-another-teyrchain 0.6.1, umbrella 0.1.2 - Updated MAINNET_ROADMAP.md with FAZ 1 completion status
This commit is contained in:
@@ -296,8 +296,8 @@ fn check_event_type(
|
||||
}
|
||||
|
||||
/// Check that the path to `pezframe_system::Config` is valid, this is that the path is just
|
||||
/// `pezframe_system::Config` or when using the `frame` crate it is
|
||||
/// `pezkuwi_sdk_frame::xyz::pezframe_system::Config`.
|
||||
/// `pezframe_system::Config` or when using the `pezframe` crate it is
|
||||
/// `pezframe::xyz::pezframe_system::Config`.
|
||||
fn has_expected_system_config(path: syn::Path, pezframe_system: &syn::Path) -> bool {
|
||||
// Check if `pezframe_system` is actually 'pezframe_system'.
|
||||
if path.segments.iter().all(|s| s.ident != "pezframe_system") {
|
||||
@@ -307,21 +307,21 @@ fn has_expected_system_config(path: syn::Path, pezframe_system: &syn::Path) -> b
|
||||
let mut expected_system_config =
|
||||
match (is_using_frame_crate(&path), is_using_frame_crate(&pezframe_system)) {
|
||||
(true, false) =>
|
||||
// We can't use the path to `pezframe_system` from `frame` if `pezframe_system` is not
|
||||
// being in scope through `frame`.
|
||||
// We can't use the path to `pezframe_system` from `pezframe` if `pezframe_system` is not
|
||||
// being in scope through `pezframe`.
|
||||
{
|
||||
return false
|
||||
},
|
||||
(false, true) =>
|
||||
// We know that the only valid pezframe_system path is one that is `pezframe_system`, as
|
||||
// `frame` re-exports it as such.
|
||||
// `pezframe` re-exports it as such.
|
||||
{
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe_system))
|
||||
.expect("is a valid path; qed")
|
||||
},
|
||||
(_, _) =>
|
||||
// They are either both `pezframe_system` or both
|
||||
// `pezkuwi_sdk_frame::xyz::pezframe_system`.
|
||||
// `pezframe::xyz::pezframe_system`.
|
||||
{
|
||||
pezframe_system.clone()
|
||||
},
|
||||
@@ -646,58 +646,58 @@ mod tests {
|
||||
let path = syn::parse2::<syn::Path>(quote::quote!(pezframe_system::Config)).unwrap();
|
||||
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezkuwi_sdk_frame::deps::pezframe_system))
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::deps::pezframe_system))
|
||||
.unwrap();
|
||||
assert!(has_expected_system_config(path.clone(), &pezframe_system));
|
||||
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(frame::deps::pezframe_system)).unwrap();
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::deps::pezframe_system)).unwrap();
|
||||
assert!(has_expected_system_config(path, &pezframe_system));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn has_expected_system_config_works_with_frame_full_path() {
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezkuwi_sdk_frame::deps::pezframe_system))
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::deps::pezframe_system))
|
||||
.unwrap();
|
||||
let path = syn::parse2::<syn::Path>(quote::quote!(
|
||||
pezkuwi_sdk_frame::deps::pezframe_system::Config
|
||||
pezframe::deps::pezframe_system::Config
|
||||
))
|
||||
.unwrap();
|
||||
assert!(has_expected_system_config(path, &pezframe_system));
|
||||
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(frame::deps::pezframe_system)).unwrap();
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::deps::pezframe_system)).unwrap();
|
||||
let path =
|
||||
syn::parse2::<syn::Path>(quote::quote!(frame::deps::pezframe_system::Config)).unwrap();
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::deps::pezframe_system::Config)).unwrap();
|
||||
assert!(has_expected_system_config(path, &pezframe_system));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn has_expected_system_config_works_with_other_frame_full_path() {
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezkuwi_sdk_frame::xyz::pezframe_system))
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::xyz::pezframe_system))
|
||||
.unwrap();
|
||||
let path = syn::parse2::<syn::Path>(quote::quote!(
|
||||
pezkuwi_sdk_frame::xyz::pezframe_system::Config
|
||||
pezframe::xyz::pezframe_system::Config
|
||||
))
|
||||
.unwrap();
|
||||
assert!(has_expected_system_config(path, &pezframe_system));
|
||||
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(frame::xyz::pezframe_system)).unwrap();
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::xyz::pezframe_system)).unwrap();
|
||||
let path =
|
||||
syn::parse2::<syn::Path>(quote::quote!(frame::xyz::pezframe_system::Config)).unwrap();
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::xyz::pezframe_system::Config)).unwrap();
|
||||
assert!(has_expected_system_config(path, &pezframe_system));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn has_expected_system_config_does_not_works_with_mixed_frame_full_path() {
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezkuwi_sdk_frame::xyz::pezframe_system))
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::xyz::pezframe_system))
|
||||
.unwrap();
|
||||
let path = syn::parse2::<syn::Path>(quote::quote!(
|
||||
pezkuwi_sdk_frame::deps::pezframe_system::Config
|
||||
pezframe::deps::pezframe_system::Config
|
||||
))
|
||||
.unwrap();
|
||||
assert!(!has_expected_system_config(path, &pezframe_system));
|
||||
@@ -706,10 +706,10 @@ mod tests {
|
||||
#[test]
|
||||
fn has_expected_system_config_does_not_works_with_other_mixed_frame_full_path() {
|
||||
let pezframe_system =
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezkuwi_sdk_frame::deps::pezframe_system))
|
||||
syn::parse2::<syn::Path>(quote::quote!(pezframe::deps::pezframe_system))
|
||||
.unwrap();
|
||||
let path = syn::parse2::<syn::Path>(quote::quote!(
|
||||
pezkuwi_sdk_frame::xyz::pezframe_system::Config
|
||||
pezframe::xyz::pezframe_system::Config
|
||||
))
|
||||
.unwrap();
|
||||
assert!(!has_expected_system_config(path, &pezframe_system));
|
||||
@@ -719,7 +719,7 @@ mod tests {
|
||||
fn has_expected_system_config_does_not_work_with_frame_full_path_if_not_frame_crate() {
|
||||
let pezframe_system = syn::parse2::<syn::Path>(quote::quote!(pezframe_system)).unwrap();
|
||||
let path = syn::parse2::<syn::Path>(quote::quote!(
|
||||
pezkuwi_sdk_frame::deps::pezframe_system::Config
|
||||
pezframe::deps::pezframe_system::Config
|
||||
))
|
||||
.unwrap();
|
||||
assert!(!has_expected_system_config(path, &pezframe_system));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pezframe-support-procedural-tools"
|
||||
version = "10.0.0"
|
||||
version = "10.0.1"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -54,18 +54,18 @@ pub fn generate_crate_access(unique_id: &str, def_crate: &str) -> TokenStream {
|
||||
///
|
||||
/// This will usually check the output of [`generate_access_from_frame_or_crate`].
|
||||
/// We want to know if whatever the `path` takes us to, is exported from `frame` or not. In that
|
||||
/// case `path` would start with `frame`, something like `pezkuwi_sdk_frame::x::y:z` or
|
||||
/// frame::x::y:z.
|
||||
/// case `path` would start with `pezframe`, something like `pezframe::x::y:z` or
|
||||
/// `pezkuwi_sdk::pezframe::x::y:z`.
|
||||
pub fn is_using_frame_crate(path: &syn::Path) -> bool {
|
||||
path.segments
|
||||
.first()
|
||||
.map(|s| s.ident == "pezkuwi_sdk_frame" || s.ident == "frame")
|
||||
.map(|s| s.ident == "pezframe" || s.ident == "pezkuwi_sdk")
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Generate the crate access for the crate using 2018 syntax.
|
||||
///
|
||||
/// If `frame` is in scope, it will use `pezkuwi_sdk_frame::deps::<def_crate>`. Else, it will try
|
||||
/// If `pezframe` is in scope, it will use `pezframe::deps::<def_crate>`. Else, it will try
|
||||
/// and find `<def_crate>` directly.
|
||||
pub fn generate_access_from_frame_or_crate(def_crate: &str) -> Result<syn::Path, Error> {
|
||||
if let Some(path) = get_frame_crate_path(def_crate) {
|
||||
@@ -127,9 +127,7 @@ pub fn generate_hidden_includes(unique_id: &str, def_crate: &str) -> TokenStream
|
||||
/// Generates the path to the frame crate deps.
|
||||
fn get_frame_crate_path(def_crate: &str) -> Option<syn::Path> {
|
||||
// This does not work if the frame crate is renamed.
|
||||
if let Ok(FoundCrate::Name(name)) =
|
||||
crate_name(&"pezkuwi-sdk-frame").or_else(|_| crate_name(&"frame"))
|
||||
{
|
||||
if let Ok(FoundCrate::Name(name)) = crate_name(&"pezframe") {
|
||||
let path = format!("{}::deps::{}", name, def_crate.to_string().replace("-", "_"));
|
||||
Some(syn::parse_str::<syn::Path>(&path).expect("is a valid path; qed"))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user