Unverified Commit 7b5486af authored by Hero Bird's avatar Hero Bird Committed by GitHub

Reintroduce old ABI format generation (#174)

* [lang] reintroduce the old ABI generation

We keep this in ink! until the new ABI format support is stable enough.

* [examples] update examples to be able to use the old ABI generation

* [cli] update template for old ABI generation
parent ecd609d5
......@@ -43,6 +43,7 @@ ink-generate-abi = [
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
[profile.release]
......
......@@ -43,6 +43,7 @@ ink-generate-abi = [
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
[profile.release]
......
......@@ -43,6 +43,7 @@ ink-generate-abi = [
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
[profile.release]
......
......@@ -43,7 +43,9 @@ ink-generate-abi = [
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
ink-as-dependency = []
[profile.release]
panic = "abort"
......
......@@ -44,6 +44,7 @@ ink-generate-abi = [
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
[profile.release]
......
......@@ -43,6 +43,7 @@ ink-generate-abi = [
"ink_abi",
"type-metadata",
"ink_core/ink-generate-abi",
"ink_lang/ink-generate-abi",
]
[profile.release]
......
......@@ -52,3 +52,6 @@ test-env = [
"std",
"ink_model/test-env",
]
ink-generate-abi = [
"std",
]
......@@ -17,6 +17,8 @@
use proc_macro2::TokenStream as TokenStream2;
use syn::Result;
#[cfg(feature = "ink-generate-abi")]
use crate::old_abi;
use crate::{
gen,
hir,
......@@ -33,6 +35,8 @@ pub fn generate(input: TokenStream2) -> TokenStream2 {
pub fn generate_or_err(input: TokenStream2) -> Result<TokenStream2> {
let ast_contract = parser::parse_contract(input.clone())?;
let hir_contract = hir::Contract::from_ast(&ast_contract)?;
#[cfg(feature = "ink-generate-abi")]
old_abi::generate_old_abi(&hir_contract)?;
let tokens = gen::generate_code(&hir_contract);
Ok(tokens)
}
......@@ -27,6 +27,9 @@ mod hir;
mod ident_ext;
mod parser;
#[cfg(feature = "ink-generate-abi")]
mod old_abi;
#[cfg(test)]
mod tests;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment