-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
5,225 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
## Version: 0.2.120 | ||
|
||
### New | ||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[workspace] | ||
members = [ 'ton_api', 'ton_tl_codegen' ] |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
bf52d9045a566cd9cb089582081385c81d435072 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ton-block":"da0becab48cc99a1518e08c386ca58b18a82e54a","ton-types":"12ddd04a55d73be85f44ac44b579cea3172ab32b"} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
authors = [ 'Aaron Gallagher <[email protected]>', 'Connie Hilarides <[email protected]>', 'Denis K. <[email protected]>', 'Alexey Vavilin <[email protected]' ] | ||
description = 'Minimal wrappers for TON serialization using TL-schema' | ||
edition = '2018' | ||
name = 'ton_api' | ||
version = '0.2.120' | ||
|
||
[build-dependencies] | ||
failure = '0.1.7' | ||
serde_json = '1.0.52' | ||
ton_tl_codegen = { path = '../ton_tl_codegen' } | ||
|
||
[dependencies] | ||
byteorder = '1.4' | ||
extfmt = '0.1' | ||
failure = '0.1' | ||
hex = '0.4' | ||
lazy_static = '1.4' | ||
ordered-float = '2.8' | ||
secstr = '0.4' | ||
serde = '1.0' | ||
serde_derive = '1.0' | ||
ton_block = { git = 'https://github.com/tonlabs/ton-labs-block', tag = '1.7.41' } | ||
ton_types = { git = 'https://github.com/tonlabs/ton-labs-types', tag = '1.10.13' } | ||
|
||
[dev-dependencies] | ||
base64 = '0.13' |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2019-2021 TON Labs. All Rights Reserved. | ||
* | ||
* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use | ||
* this file except in compliance with the License. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific TON DEV software governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
use std::{fs, path}; | ||
use std::io::Read; | ||
use std::path::Path; | ||
use ton_tl_codegen::Config; | ||
|
||
const OUTPUT_DIR: &str = "src/ton"; | ||
const TL_DIR: &str = "tl"; | ||
|
||
fn main() { | ||
// TODO: This line was commented because of different behavior of cargo in rust ver 1.50. | ||
// We can revert it, when this behavior is fixed. | ||
// println!("cargo:rerun-if-changed={}", OUTPUT_DIR); | ||
println!("cargo:rerun-if-changed={}", TL_DIR); | ||
println!("cargo:rerun-if-changed=../ton_tl_codegen"); | ||
|
||
let mut files = fs::read_dir(TL_DIR) | ||
.expect(format!("Unable to read directory contents: {}", TL_DIR).as_str()) | ||
.filter_map(Result::ok) | ||
.map(|d| d.path()) | ||
.filter(|path| path.to_str().unwrap().ends_with(".tl")) | ||
.collect::<Vec<path::PathBuf>>(); | ||
|
||
assert!(files.len() > 0); | ||
files.sort(); | ||
|
||
let mut input = String::new(); | ||
for file in files { | ||
if input.len() > 0 { | ||
input += "---types---\n"; | ||
} | ||
fs::File::open(&file) | ||
.expect(format!("Unable to open file for reading: {}", file.to_string_lossy()).as_str()) | ||
.read_to_string(&mut input) | ||
.expect(format!("Unable to read file contents: {}", file.to_string_lossy()).as_str()); | ||
println!("cargo:rerun-if-changed={}", file.to_string_lossy()); | ||
} | ||
|
||
let config_path = Path::new(TL_DIR).join("codegen.json"); | ||
let config: Option<Config> = if config_path.exists() && config_path.is_file() { | ||
let mut config_string = String::new(); | ||
fs::File::open(&config_path) | ||
.expect(format!("Unable to open file for reading: {}", config_path.to_string_lossy()).as_str()) | ||
.read_to_string(&mut config_string) | ||
.expect(format!("Unable to read file contents: {}", config_path.to_string_lossy()).as_str()); | ||
Some(serde_json::from_str(config_string.as_str()) | ||
.expect(format!("Unable to parse file as JSON: {}", config_path.to_string_lossy()).as_str())) | ||
} else { | ||
None | ||
}; | ||
|
||
ton_tl_codegen::generate_code_for(config, &input, Path::new(OUTPUT_DIR)); | ||
} | ||
|
Oops, something went wrong.