Skip to content

Commit

Permalink
Fix CLI on address20/address32 features (diem#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
macalinao committed Apr 24, 2022
1 parent a8d6aa9 commit aab456f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions language/move-stdlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ license = "Apache-2.0"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
move-errmapgen = { path = "../move-prover/move-errmapgen" }
move-docgen = { path = "../move-prover/move-docgen" }
Expand All @@ -21,7 +20,6 @@ move-binary-format = { path = "../move-binary-format" }
move-core-types = { path = "../move-core/types" }
move-vm-runtime = { path = "../move-vm/runtime" }
move-compiler = { path = "../move-compiler" }

log = "0.4.14"
walkdir = "2.3.1"
smallvec = "1.6.1"
Expand All @@ -38,3 +36,5 @@ move-package = { path = "../tools/move-package" }

[features]
testing = []
address20 = ["move-core-types/address20"]
address32 = ["move-core-types/address32"]
Binary file not shown.
Binary file not shown.
16 changes: 14 additions & 2 deletions language/move-stdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use log::LevelFilter;
use move_command_line_common::files::{extension_equals, find_filenames, MOVE_EXTENSION};
use move_compiler::shared::NumericalAddress;
use move_core_types::account_address::AccountAddress;
use std::{collections::BTreeMap, path::PathBuf};

#[cfg(test)]
Expand Down Expand Up @@ -50,7 +51,12 @@ pub fn move_nursery_docs_full_path() -> String {
}

pub fn move_stdlib_errmap_full_path() -> String {
format!("{}/{}", env!("CARGO_MANIFEST_DIR"), ERRMAP_FILE)
let prefix = if AccountAddress::LENGTH == 16 {
"".to_string()
} else {
format!("address{}-", AccountAddress::LENGTH)
};
format!("{}/{}{}", env!("CARGO_MANIFEST_DIR"), &prefix, ERRMAP_FILE)
}

pub fn move_stdlib_files() -> Vec<String> {
Expand Down Expand Up @@ -153,7 +159,13 @@ pub fn build_error_code_map(output_path: &str) {
move_prover::run_move_prover_errors_to_stderr(options).unwrap();
}

const ERROR_DESCRIPTIONS: &[u8] = include_bytes!("../error_description.errmap");
const ERROR_DESCRIPTIONS: &[u8] = if cfg!(feature = "address20") {
include_bytes!("../address20-error_description.errmap")
} else if cfg!(feature = "address32") {
include_bytes!("../address32-error_description.errmap")
} else {
include_bytes!("../error_description.errmap")
};

pub fn error_descriptions() -> &'static [u8] {
ERROR_DESCRIPTIONS
Expand Down
10 changes: 3 additions & 7 deletions language/tools/move-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ tempfile = "3.2.0"
walkdir = "2.3.1"
codespan-reporting = "0.11.1"
itertools = "0.10.0"

bcs = "0.1.2"
move-bytecode-verifier = { path = "../../move-bytecode-verifier" }

move-disassembler = { path = "../move-disassembler" }
move-command-line-common = { path = "../../move-command-line-common" }
move-bytecode-utils = { path = "../move-bytecode-utils" }
Expand Down Expand Up @@ -79,8 +77,6 @@ required-features = ["evm-backend"]

[features]
evm-backend = ["move-unit-test/evm-backend", "move-package/evm-backend"]

table-extension = [
"move-table-extension",
"move-unit-test/table-extension"
]
address20 = ["move-stdlib/address20"]
address32 = ["move-stdlib/address32"]
table-extension = ["move-table-extension", "move-unit-test/table-extension"]

0 comments on commit aab456f

Please sign in to comment.