-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Framework] Gate V2 Features in Framework until V2 Features Allowed o…
…n Mainnet (#15146) * add tests to gate v2 features in framework * remove change in framework code * linter --------- Co-authored-by: Zekun Wang <[email protected]>
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//! This file contains tests for compiling framework code with the v1 compiler, to make sure no V2 feature is used before it's ready for mainnet. | ||
use aptos_framework::{extended_checks, path_in_crate}; | ||
use move_model::metadata::{CompilerVersion, LanguageVersion}; | ||
use move_package::CompilerConfig; | ||
use tempfile::tempdir; | ||
|
||
fn compile_pkg_with_v1(path_to_pkg: impl Into<String>) { | ||
let pkg_path = path_in_crate(path_to_pkg); | ||
let compiler_config = CompilerConfig { | ||
known_attributes: extended_checks::get_all_attribute_names().clone(), | ||
bytecode_version: Some(6), | ||
language_version: Some(LanguageVersion::V1), | ||
compiler_version: Some(CompilerVersion::V1), | ||
..Default::default() | ||
}; | ||
let build_config = move_package::BuildConfig { | ||
install_dir: Some(tempdir().unwrap().path().to_path_buf()), | ||
compiler_config: compiler_config.clone(), | ||
..Default::default() | ||
}; | ||
build_config | ||
.compile_package(pkg_path.as_path(), &mut std::io::stdout()) | ||
.unwrap(); | ||
} | ||
|
||
#[test] | ||
fn compile_aptos_framework_with_v1() { | ||
compile_pkg_with_v1("aptos-framework"); | ||
} | ||
|
||
#[test] | ||
fn compile_aptos_stdlib_with_v1() { | ||
compile_pkg_with_v1("aptos-stdlib"); | ||
} | ||
|
||
#[test] | ||
fn compile_move_stdlib_with_v1() { | ||
compile_pkg_with_v1("move-stdlib"); | ||
} | ||
|
||
#[test] | ||
fn compile_aptos_token_with_v1() { | ||
compile_pkg_with_v1("aptos-token"); | ||
} | ||
|
||
#[test] | ||
fn compile_aptos_token_objects_with_v1() { | ||
compile_pkg_with_v1("aptos-token-objects"); | ||
} |