Skip to content

Commit 706cbf7

Browse files
committed
add move-1 flag
1 parent 0318475 commit 706cbf7

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

crates/aptos/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ All notable changes to the Aptos CLI will be captured in this file. This project
55
# Unreleased
66
- Add flag `--benchmark` to `aptos move prove`, which allows to benchmark verification times of individual functions in a package.
77
- Add flag `--only <name>` to `aptos move prove`, which allows to scope verification to a function.
8-
98
- Fix `aptos init` to show the explorer link for accounts when account is already created on chain instead of prompting to fund the account.
9+
- Set Compiler v2 as the default compiler and Move 2 as the default language version except for `aptos governance`.
10+
- Add new `--move-1` flag to use Compiler v1 and Move 1.
1011

1112
## [5.1.0] - 2024/12/13
1213
- More optimizations are now default for compiler v2.

crates/aptos/src/common/types.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use aptos_types::{
4848
};
4949
use aptos_vm_types::output::VMOutput;
5050
use async_trait::async_trait;
51-
use clap::{Parser, ValueEnum};
51+
use clap::{ArgGroup, Parser, ValueEnum};
5252
use hex::FromHexError;
5353
use indoc::indoc;
5454
use move_core_types::{
@@ -1110,6 +1110,7 @@ impl FromStr for OptimizationLevel {
11101110

11111111
/// Options for compiling a move package dir
11121112
#[derive(Debug, Clone, Parser)]
1113+
#[clap(group = ArgGroup::new("move-version").args(&["move_1", "move_2"]).required(false))]
11131114
pub struct MovePackageDir {
11141115
/// Path to a move package (the folder with a Move.toml file). Defaults to current directory.
11151116
#[clap(long, value_parser)]
@@ -1179,25 +1180,33 @@ pub struct MovePackageDir {
11791180

11801181
/// ...or --compiler COMPILER_VERSION
11811182
/// Specify the version of the compiler.
1182-
/// Defaults to `1`, unless `--move-2` is selected.
1183+
/// Defaults to the latest stable compiler version (at least 2)
11831184
#[clap(long, value_parser = clap::value_parser!(CompilerVersion),
11841185
alias = "compiler",
1186+
default_value = LATEST_STABLE_COMPILER_VERSION,
11851187
default_value_if("move_2", "true", LATEST_STABLE_COMPILER_VERSION),
1188+
default_value_if("move_1", "true", "1"),
11861189
verbatim_doc_comment)]
11871190
pub compiler_version: Option<CompilerVersion>,
11881191

11891192
/// ...or --language LANGUAGE_VERSION
11901193
/// Specify the language version to be supported.
1191-
/// Defaults to `1`, unless `--move-2` is selected.
1194+
/// Defaults to the latest stable language version (at least 2)
11921195
#[clap(long, value_parser = clap::value_parser!(LanguageVersion),
11931196
alias = "language",
1197+
default_value = LATEST_STABLE_LANGUAGE_VERSION,
11941198
default_value_if("move_2", "true", LATEST_STABLE_LANGUAGE_VERSION),
1199+
default_value_if("move_1", "true", "1"),
11951200
verbatim_doc_comment)]
11961201
pub language_version: Option<LanguageVersion>,
11971202

11981203
/// Select bytecode, language, and compiler versions to support the latest Move 2.
11991204
#[clap(long, verbatim_doc_comment)]
12001205
pub move_2: bool,
1206+
1207+
/// Select bytecode, language, and compiler versions for Move 1.
1208+
#[clap(long, verbatim_doc_comment)]
1209+
pub move_1: bool,
12011210
}
12021211

12031212
impl Default for MovePackageDir {
@@ -1216,11 +1225,12 @@ impl MovePackageDir {
12161225
override_std: None,
12171226
skip_fetch_latest_git_deps: true,
12181227
bytecode_version: None,
1219-
compiler_version: None,
1220-
language_version: None,
1228+
compiler_version: Some(CompilerVersion::latest_stable()),
1229+
language_version: Some(LanguageVersion::latest_stable()),
12211230
skip_attribute_checks: false,
12221231
check_test_code: false,
1223-
move_2: false,
1232+
move_2: true,
1233+
move_1: false,
12241234
optimize: None,
12251235
experiments: vec![],
12261236
}

crates/aptos/src/move_tool/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,6 @@ impl IncludedArtifacts {
909909
experiments.append(&mut move_options.experiments.clone());
910910
experiments.append(&mut more_experiments);
911911

912-
// TODO(#14441): Remove `None |` here when we update default CompilerVersion
913912
if matches!(
914913
move_options.compiler_version,
915914
Option::None | Some(CompilerVersion::V1)

0 commit comments

Comments
 (0)