-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stdlib] Refactor stdlib release tool and release stdlib v1 (#1681)
* [stdlib] Refactor stdlib release tool and release stdlib v1 * update framework version
- Loading branch information
Showing
45 changed files
with
663 additions
and
518 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,2 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::path::{Path, PathBuf}; | ||
|
||
use anyhow::Result; | ||
use framework_builder::{Stdlib, StdlibBuildConfig}; | ||
use move_package::BuildConfig; | ||
use once_cell::sync::Lazy; | ||
|
||
static STDLIB_BUILD_CONFIGS: Lazy<Vec<StdlibBuildConfig>> = Lazy::new(|| { | ||
let move_stdlib_path = path_in_crate("../../frameworks/move-stdlib") | ||
.canonicalize() | ||
.expect("canonicalize path failed"); | ||
let moveos_stdlib_path = path_in_crate("../../frameworks/moveos-stdlib") | ||
.canonicalize() | ||
.expect("canonicalize path failed"); | ||
let rooch_framework_path = path_in_crate("../../frameworks/rooch-framework") | ||
.canonicalize() | ||
.expect("canonicalize path failed"); | ||
|
||
let bitcoin_move_path = path_in_crate("../../frameworks/bitcoin-move") | ||
.canonicalize() | ||
.expect("canonicalize path failed"); | ||
|
||
let rooch_nursery_path = path_in_crate("../../frameworks/rooch-nursery") | ||
.canonicalize() | ||
.expect("canonicalize path failed"); | ||
|
||
let generated_dir = generated_dir(); | ||
|
||
vec![ | ||
StdlibBuildConfig { | ||
path: move_stdlib_path.clone(), | ||
error_prefix: "E".to_string(), | ||
error_code_map_output_file: generated_dir.join("move_std_error_description.errmap"), | ||
document_template: move_stdlib_path.join("doc_template/README.md"), | ||
document_output_directory: move_stdlib_path.join("doc"), | ||
build_config: BuildConfig::default(), | ||
}, | ||
StdlibBuildConfig { | ||
path: moveos_stdlib_path.clone(), | ||
error_prefix: "Error".to_string(), | ||
error_code_map_output_file: generated_dir.join("moveos_std_error_description.errmap"), | ||
document_template: moveos_stdlib_path.join("doc_template/README.md"), | ||
document_output_directory: moveos_stdlib_path.join("doc"), | ||
build_config: BuildConfig::default(), | ||
}, | ||
StdlibBuildConfig { | ||
path: rooch_framework_path.clone(), | ||
error_prefix: "Error".to_string(), | ||
error_code_map_output_file: generated_dir | ||
.join("rooch_framework_error_description.errmap"), | ||
document_template: rooch_framework_path.join("doc_template/README.md"), | ||
document_output_directory: rooch_framework_path.join("doc"), | ||
build_config: BuildConfig::default(), | ||
}, | ||
StdlibBuildConfig { | ||
path: bitcoin_move_path.clone(), | ||
error_prefix: "Error".to_string(), | ||
error_code_map_output_file: generated_dir.join("bitcoin_move_error_description.errmap"), | ||
document_template: bitcoin_move_path.join("doc_template/README.md"), | ||
document_output_directory: bitcoin_move_path.join("doc"), | ||
build_config: BuildConfig::default(), | ||
}, | ||
StdlibBuildConfig { | ||
path: rooch_nursery_path.clone(), | ||
error_prefix: "Error".to_string(), | ||
error_code_map_output_file: generated_dir | ||
.join("rooch_nursery_error_description.errmap"), | ||
document_template: rooch_nursery_path.join("doc_template/README.md"), | ||
document_output_directory: rooch_nursery_path.join("doc"), | ||
build_config: BuildConfig::default(), | ||
}, | ||
] | ||
}); | ||
|
||
pub fn build_stdlib() -> Result<Stdlib> { | ||
framework_builder::Stdlib::build(STDLIB_BUILD_CONFIGS.clone()) | ||
} | ||
|
||
pub fn build_and_save_stdlib() -> Result<()> { | ||
std::fs::create_dir_all(generated_dir())?; | ||
let stdlib = build_stdlib()?; | ||
stdlib.save_to_file(stdlib_output_file()) | ||
} | ||
|
||
pub fn stdlib_output_file() -> PathBuf { | ||
generated_dir().join("stdlib") | ||
} | ||
|
||
fn generated_dir() -> PathBuf { | ||
path_in_crate("../rooch-genesis/generated") | ||
} | ||
|
||
fn path_in_crate<S>(relative: S) -> PathBuf | ||
where | ||
S: AsRef<Path>, | ||
{ | ||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
path.push(relative); | ||
path | ||
} |
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.