1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#![forbid(unsafe_code)]
use move_deps::{
move_binary_format::file_format::CompiledModule,
move_compiler::{
compiled_unit::{CompiledUnit, NamedCompiledModule},
shared::NumericalAddress,
},
move_package::compilation::compiled_package::CompiledPackage,
};
use once_cell::sync::Lazy;
use std::collections::BTreeMap;
const APTOS_FRAMEWORK_DIR: &str = "aptos-framework/sources";
const APTOS_STDLIB_DIR: &str = "aptos-stdlib/sources";
const MOVE_STDLIB_DIR: &str = "move-stdlib/sources";
static APTOS_PKG: Lazy<CompiledPackage> = Lazy::new(|| super::package("aptos-framework"));
pub fn files() -> Vec<String> {
let mut files = super::move_files_in_path(MOVE_STDLIB_DIR);
files.extend(super::move_files_in_path(APTOS_STDLIB_DIR));
files.extend(super::move_files_in_path(APTOS_FRAMEWORK_DIR));
files
}
pub fn module_blobs() -> Vec<Vec<u8>> {
super::module_blobs(&*APTOS_PKG)
}
pub fn named_addresses() -> BTreeMap<String, NumericalAddress> {
super::named_addresses(&*APTOS_PKG)
}
pub fn modules() -> Vec<CompiledModule> {
APTOS_PKG
.all_compiled_units()
.filter_map(|unit| match unit {
CompiledUnit::Module(NamedCompiledModule { module, .. }) => Some(module.clone()),
CompiledUnit::Script(_) => None,
})
.collect()
}