-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use scale-typegen
as a backend for the codegen
#1260
Merged
tadeohepperle
merged 39 commits into
master
from
tadeohepperle/implement-scale-typegen-for-type-generation
Jan 11, 2024
Merged
Changes from 18 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
e163e57
integrate scale-typegen, remove types mod
tadeohepperle 1760792
reintroduce default substitutes and derives
tadeohepperle b297fc8
support runtime_types only again
tadeohepperle 7a2678a
generating polkadot.rs ok
tadeohepperle 60c1e62
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle 297d2c6
update scale-typegen to discrete error types
tadeohepperle f47fd4e
scale-typegen-api-changes
tadeohepperle 03591a6
add note about UncheckedExtrinsic in default substitutes
tadeohepperle 9e56546
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle 50ed54e
add resursive attributes and derives
tadeohepperle dabc88c
adjust example where Clone bound recursive
tadeohepperle cd73d31
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle fd718bf
move scale-typegen dependency to workspace
tadeohepperle 985a46c
expose default typegen settings
tadeohepperle a6b580f
lightclient: Fix wasm socket closure called after being dropped (#1289)
lexnv 44c42c3
workflows: Install rustup component for building substrate (#1295)
lexnv 0724735
cli: Command to fetch chainSpec and optimise its size (#1278)
lexnv ee1e096
conflicts
tadeohepperle 58b8fee
remove comments and unused args
tadeohepperle 0c7d373
Update substrate- and signer-related dependencies (#1297)
tadeohepperle 42643d8
fix lock file
tadeohepperle 8196b63
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle bbda16a
fix lock file again :|
tadeohepperle 4259572
adjust to new interface in scale-typegen
tadeohepperle 14775ab
use released scale typegen
tadeohepperle 69af6d1
reintroduce type aliases
tadeohepperle f125b2b
introduce type aliases again using scale-typegen
tadeohepperle 602d459
cargo fmt and clippy
tadeohepperle b18d472
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle aaf9ded
reconcile changes with master branch
tadeohepperle 05dbe3f
update polkadot.rs
tadeohepperle e54cb73
bump scale-typgen to fix substitution
tadeohepperle 24cb3d7
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle 3d1fdec
implemented Alex suggestions, regenerated polkadot.rs (did not change)
tadeohepperle f0ef2a9
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle 72fee7d
Merge branch 'master' into tadeohepperle/implement-scale-typegen-for-…
tadeohepperle a96c90f
resolve conflicts in Cargo.lock
tadeohepperle 70d3de0
make expect messages more clear
tadeohepperle 00aee3d
correct typos
tadeohepperle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,9 @@ | |
|
||
use proc_macro2::TokenStream as TokenStream2; | ||
use quote::quote; | ||
use scale_typegen::TypeGenerator; | ||
use subxt_metadata::PalletMetadata; | ||
|
||
use crate::types::TypeGenerator; | ||
|
||
use super::CodegenError; | ||
|
||
/// Generate error type alias from the provided pallet metadata. | ||
|
@@ -20,8 +19,8 @@ pub fn generate_error_type_alias( | |
return Ok(quote!()); | ||
}; | ||
|
||
let error_type = type_gen.resolve_type_path(error_ty); | ||
let error_ty = type_gen.resolve_type(error_ty); | ||
let error_type = type_gen.resolve_type_path(error_ty)?; | ||
let error_ty = type_gen.resolve_type(error_ty)?; | ||
let docs = &error_ty.docs; | ||
let docs = should_gen_docs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be infered from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, totally! Good catch! |
||
.then_some(quote! { #( #[doc = #docs ] )* }) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want to support recursive derives in the CLI? Might be worth a separate issue to remind us of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe. Or maybe we just make everything recursive by default in the CLI, I think it is already quite hard to specify derives in the CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great if you could open an issue for it :)