Skip to content

Commit

Permalink
[sdk] remove dependency on binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
davidiw authored and aptos-bot committed Apr 1, 2022
1 parent 9f5b2c9 commit 37cc8f4
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ default-members = [
"aptos-move/transaction-builder-generator",
"execution/db-bootstrapper",
"execution/execution-correctness",
"sdk",
"storage/backup/backup-cli",
"storage/aptossum",
"storage/inspector",
Expand Down
8 changes: 4 additions & 4 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ description = "The Official Aptos SDK"
repository = "https://github.com/aptos-labs/aptos-core"
homepage = "https://aptoslabs.com"
license = "Apache-2.0"
publish = ["crates-io"]
publish = false
edition = "2018"

[dependencies]
bcs = "0.1"
rand_core = "0.6.2"
serde = { version = "1.0.124", features = ["derive"] }

aptos-crypto = { path = "../crates/aptos-crypto", version = "0.0.3" }
aptos-types = { path = "../types", version = "0.0.3"}
aptos-crypto = { path = "../crates/aptos-crypto" }
aptos-types = { path = "../types" }
move-core-types = { git = "https://github.com/diem/move", rev = "3fe033b112eae7df2d15ab3467624165ae510caa", version = "0.0.3", features=["address32"] }
aptos-transaction-builder = { path = "./transaction-builder", version = "0.0.3" }
aptos-transaction-builder = { path = "./transaction-builder" }
aptos-workspace-hack = { version = "0.1", path = "../crates/aptos-workspace-hack" }
9 changes: 7 additions & 2 deletions sdk/transaction-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Generated transaction builders"
repository = "https://github.com/aptos-labs/aptos-core"
homepage = "https://aptoslabs.com"
license = "Apache-2.0"
publish = ["crates-io"]
publish = false
edition = "2018"

[dependencies]
Expand All @@ -16,12 +16,17 @@ once_cell = "1.7.2"
serde = { version = "1.0.124", features = ["derive"] }

move-core-types = { git = "https://github.com/diem/move", rev = "3fe033b112eae7df2d15ab3467624165ae510caa", version = "0.0.3", features=["address32"] }
aptos-types = { path = "../../types", version = "0.0.3" }
aptos-types = { path = "../../types" }

proptest = { version = "1.0.0", optional = true }
proptest-derive = { version = "0.3.0", optional = true }
aptos-workspace-hack = { version = "0.1", path = "../../crates/aptos-workspace-hack" }

[build-dependencies]
aptos-temppath = { path = "../../crates/aptos-temppath" }
framework = {path = "../../aptos-move/framework" }
move-command-line-common = { git = "https://github.com/diem/move", rev = "3fe033b112eae7df2d15ab3467624165ae510caa" }

[dev-dependencies]
proptest = "1.0.0"
proptest-derive = "0.3.0"
Expand Down
41 changes: 41 additions & 0 deletions sdk/transaction-builder/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use move_command_line_common::files::MOVE_ERROR_DESC_EXTENSION;
use std::path::{Path, PathBuf};

fn main() {
let temppath = aptos_temppath::TempPath::new();

let release = framework::release::ReleaseOptions {
check_layout_compatibility: false,
build_docs: false,
with_diagram: false,
script_builder: false,
script_abis: false,
errmap: false,
package: PathBuf::from("aptos-framework"),
output: temppath.path().to_path_buf(),
};
release.create_release();

let base_path = temppath.path(); //.join("aptos-framework").join("releases").join("artifacts").join("current");
let mut errmap = base_path
.join("error_description")
.join("error_description");
errmap.set_extension(MOVE_ERROR_DESC_EXTENSION);

std::fs::create_dir_all("errmap").unwrap_or_else(|_| panic!("Unable to create path: errmap"));
let mut errmap_out = PathBuf::from("errmap").join("error_description");
errmap_out.set_extension(MOVE_ERROR_DESC_EXTENSION);
read_and_write(&errmap, &errmap_out);

let transaction_script_builder = base_path.join("transaction_script_builder.rs");
let transaction_script_builder_out = PathBuf::from("src").join("aptos_stdlib.rs");
read_and_write(&transaction_script_builder, &transaction_script_builder_out);
}

fn read_and_write(inpath: &Path, outpath: &Path) {
let data = std::fs::read(inpath).unwrap_or_else(|_| panic!("Unable to read: {:?}", inpath));
std::fs::write(outpath, data).unwrap_or_else(|_| panic!("Unable to write: {:?}", outpath));
}

This file was deleted.

1 change: 0 additions & 1 deletion sdk/transaction-builder/src/aptos_stdlib.rs

This file was deleted.

8 changes: 2 additions & 6 deletions sdk/transaction-builder/src/error_explain.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

//! A module for looking up the human-readable explanation of a Diem Move
//! A module for looking up the human-readable explanation of a Aptos Move
//! transaction abort code.
//!
//! This module mostly exists as a temporary hack until we figure out a more
//! sustainable approach towards publishing the Diem move framework release to
//! crates.io.
//!
//! Note that the ~13 KiB error descriptions will be inlined into the final binary.
use move_core_types::{
Expand All @@ -16,7 +12,7 @@ use move_core_types::{
};
use once_cell::sync::Lazy;

static RELEASE_ERRMAP_BYTES: &[u8] = include_bytes!("../release_errmap/error_description.errmap");
static RELEASE_ERRMAP_BYTES: &[u8] = include_bytes!("../errmap/error_description.errmap");

static RELEASE_ERRMAP: Lazy<ErrorMapping> = Lazy::new(|| {
bcs::from_bytes(&*RELEASE_ERRMAP_BYTES)
Expand Down
6 changes: 3 additions & 3 deletions types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Aptos core types"
repository = "https://github.com/aptos-labs/aptos-core"
homepage = "https://aptoslabs.com"
license = "Apache-2.0"
publish = ["crates-io"]
publish = false
edition = "2018"

[dependencies]
Expand All @@ -28,8 +28,8 @@ thiserror = "1.0.24"
tiny-keccak = { version = "2.0.2", default-features = false, features = ["sha3"] }

bcs = "0.1.2"
aptos-crypto = { path = "../crates/aptos-crypto", version = "0.0.3" }
aptos-crypto-derive = { path = "../crates/aptos-crypto-derive", version = "0.0.3" }
aptos-crypto = { path = "../crates/aptos-crypto" }
aptos-crypto-derive = { path = "../crates/aptos-crypto-derive" }
move-core-types = { git = "https://github.com/diem/move", rev = "3fe033b112eae7df2d15ab3467624165ae510caa", version = "0.0.3", features=["address32"] }
move-read-write-set-types = { git = "https://github.com/diem/move", rev = "3fe033b112eae7df2d15ab3467624165ae510caa" }
aptos-workspace-hack = { version = "0.1", path = "../crates/aptos-workspace-hack" }
Expand Down

0 comments on commit 37cc8f4

Please sign in to comment.