Skip to content

Commit

Permalink
[stdlib] Refactor stdlib release tool and release stdlib v1 (#1681)
Browse files Browse the repository at this point in the history
* [stdlib] Refactor stdlib release tool and release stdlib v1

* update framework version
  • Loading branch information
jolestar authored May 15, 2024
1 parent f12031e commit 3abd787
Show file tree
Hide file tree
Showing 45 changed files with 663 additions and 518 deletions.
94 changes: 48 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ members = [
"moveos/moveos-config",
"moveos/moveos-wasm",
"moveos/moveos-object-runtime",
"moveos/moveos-compiler",
"crates/rooch-key",
"crates/rooch-types",
"crates/rooch-framework-tests",
"crates/rooch-genesis",
"crates/rooch-genesis-builder",
"crates/rooch-integration-test-runner",
"crates/rooch-relayer",
"crates/rooch-rpc-server",
Expand All @@ -45,7 +45,8 @@ members = [
"frameworks/framework-release",
"frameworks/moveos-stdlib",
"frameworks/rooch-framework",
"frameworks/bitcoin-move"
"frameworks/bitcoin-move",
"frameworks/framework-types"
]

default-members = [
Expand Down Expand Up @@ -81,6 +82,7 @@ metrics = { path = "moveos/metrics" }
moveos-config = { path = "moveos/moveos-config" }
moveos-wasm = { path = "moveos/moveos-wasm" }
moveos-object-runtime = { path = "moveos/moveos-object-runtime" }
moveos-compiler = { path = "moveos/moveos-compiler" }

# crates for Rooch
rooch = { path = "crates/rooch" }
Expand All @@ -89,7 +91,6 @@ rooch-types = { path = "crates/rooch-types" }
rooch-framework-tests = { path = "crates/rooch-framework-tests" }
rooch-integration-test-runner = { path = "crates/rooch-integration-test-runner" }
rooch-genesis = { path = "crates/rooch-genesis" }
rooch-genesis-builder = { path = "crates/rooch-genesis-builder" }
rooch-relayer = { path = "crates/rooch-relayer" }
rooch-rpc-server = { path = "crates/rooch-rpc-server" }
rooch-rpc-client = { path = "crates/rooch-rpc-client" }
Expand All @@ -112,6 +113,7 @@ rooch-test-transaction-builder = { path = "crates/rooch-test-transaction-builder
data-verify = { path = "crates/data_verify" }

# frameworks
framework-types = { path = "frameworks/framework-types" }
framework-builder = { path = "frameworks/framework-builder" }
framework-release = { path = "frameworks/framework-release" }
moveos-stdlib = { path = "frameworks/moveos-stdlib" }
Expand Down Expand Up @@ -213,6 +215,7 @@ hyper = { version = "0.14.12", features = ["full"] }
http = "0.2.6"
num_enum = "0.5.7"
libc = "^0.2"
include_dir = { version = "0.6.2" }
nostr = "0.22"
serde-reflection = "0.3.6"
serde-generate = "0.25.1"
Expand Down
101 changes: 0 additions & 101 deletions crates/rooch-genesis-builder/src/lib.rs
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
}
7 changes: 1 addition & 6 deletions crates/rooch-genesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,4 @@ moveos-store = { workspace = true }

rooch-framework = { workspace = true }
rooch-types = { workspace = true }
rooch-genesis-builder = { workspace = true }
bitcoin-move = { workspace = true }

[build-dependencies]
rooch-genesis-builder = { workspace = true }
framework-builder = { workspace = true }
bitcoin-move = { workspace = true }
Loading

0 comments on commit 3abd787

Please sign in to comment.