diff --git a/crates/aptos/CHANGELOG.md b/crates/aptos/CHANGELOG.md index 3bff5c8b2bc12b..d6f993ba6fd46a 100644 --- a/crates/aptos/CHANGELOG.md +++ b/crates/aptos/CHANGELOG.md @@ -11,6 +11,8 @@ All notable changes to the Aptos CLI will be captured in this file. This project ## [5.1.0] - 2024/12/13 - More optimizations are now default for compiler v2. - Downgrade bytecode version to v6 before calling the Revela decompiler, if possible, i.e. no enum types are used. This allows to continue to use Revela until the new decompiler is ready. +- Set Compiler v2 as the default compiler and Move 2 as the default language version except for `aptos governance`. +- Add new `--move-1` flag to use Compiler v1 and Move 1. ## [5.0.0] - 2024/12/11 - [**Breaking Change**] `aptos init` and `aptos account fund-with-faucet` no longer work directly with testnet, you must now use the minting page at the [Aptos dev docs](https://aptos.dev/network/faucet). diff --git a/crates/aptos/src/common/types.rs b/crates/aptos/src/common/types.rs index 3feec4ebcb12d8..a09d3318e44c9d 100644 --- a/crates/aptos/src/common/types.rs +++ b/crates/aptos/src/common/types.rs @@ -48,7 +48,7 @@ use aptos_types::{ }; use aptos_vm_types::output::VMOutput; use async_trait::async_trait; -use clap::{Parser, ValueEnum}; +use clap::{ArgGroup, Parser, ValueEnum}; use hex::FromHexError; use move_core_types::{ account_address::AccountAddress, language_storage::TypeTag, vm_status::VMStatus, @@ -1097,6 +1097,7 @@ impl FromStr for OptimizationLevel { /// Options for compiling a move package dir #[derive(Debug, Clone, Parser)] +#[clap(group = ArgGroup::new("move-version").args(&["move_1", "move_2"]).required(false))] pub struct MovePackageDir { /// Path to a move package (the folder with a Move.toml file). Defaults to current directory. #[clap(long, value_parser)] @@ -1166,25 +1167,33 @@ pub struct MovePackageDir { /// ...or --compiler COMPILER_VERSION /// Specify the version of the compiler. - /// Defaults to `1`, unless `--move-2` is selected. + /// Defaults to the latest stable compiler version #[clap(long, value_parser = clap::value_parser!(CompilerVersion), alias = "compiler", + default_value = LATEST_STABLE_COMPILER_VERSION, default_value_if("move_2", "true", LATEST_STABLE_COMPILER_VERSION), + default_value_if("move_1", "true", "1"), verbatim_doc_comment)] pub compiler_version: Option, /// ...or --language LANGUAGE_VERSION /// Specify the language version to be supported. - /// Defaults to `1`, unless `--move-2` is selected. + /// Defaults to the latest stable language version #[clap(long, value_parser = clap::value_parser!(LanguageVersion), alias = "language", + default_value = LATEST_STABLE_LANGUAGE_VERSION, default_value_if("move_2", "true", LATEST_STABLE_LANGUAGE_VERSION), + default_value_if("move_1", "true", "1"), verbatim_doc_comment)] pub language_version: Option, /// Select bytecode, language, and compiler versions to support the latest Move 2. #[clap(long, verbatim_doc_comment)] pub move_2: bool, + + /// Select bytecode, language, and compiler versions for Move 1. + #[clap(long, verbatim_doc_comment)] + pub move_1: bool, } impl Default for MovePackageDir { @@ -1203,11 +1212,12 @@ impl MovePackageDir { override_std: None, skip_fetch_latest_git_deps: true, bytecode_version: None, - compiler_version: None, - language_version: None, + compiler_version: Some(CompilerVersion::latest_stable()), + language_version: Some(LanguageVersion::latest_stable()), skip_attribute_checks: false, check_test_code: false, - move_2: false, + move_2: true, + move_1: false, optimize: None, experiments: vec![], }