Skip to content

Commit 072f8a1

Browse files
committed
add move-1 flag
1 parent 1e926ed commit 072f8a1

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

crates/aptos/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
All notable changes to the Aptos CLI will be captured in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and the format set out by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44

55
# Unreleased
6+
- Set Compiler v2 as the default compiler and Move 2 as the default language version except for `aptos governance`.
7+
- Add new `--move-1` flag to use Compiler v1 and Move 1.
68

79
## [4.6.0] - 2024/11/29
810
- Add `--node-api-key` flag to `aptos move replay` to allow for querying the fullnode with an API key.

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 move_core_types::{
5454
account_address::AccountAddress, language_storage::TypeTag, vm_status::VMStatus,
@@ -1094,6 +1094,7 @@ impl FromStr for OptimizationLevel {
10941094

10951095
/// Options for compiling a move package dir
10961096
#[derive(Debug, Clone, Parser)]
1097+
#[clap(group = ArgGroup::new("move-version").args(&["move_1", "move_2"]).required(false))]
10971098
pub struct MovePackageDir {
10981099
/// Path to a move package (the folder with a Move.toml file). Defaults to current directory.
10991100
#[clap(long, value_parser)]
@@ -1163,25 +1164,33 @@ pub struct MovePackageDir {
11631164

11641165
/// ...or --compiler COMPILER_VERSION
11651166
/// Specify the version of the compiler.
1166-
/// Defaults to `1`, unless `--move-2` is selected.
1167+
/// Defaults to the latest stable compiler version
11671168
#[clap(long, value_parser = clap::value_parser!(CompilerVersion),
11681169
alias = "compiler",
1170+
default_value = LATEST_STABLE_COMPILER_VERSION,
11691171
default_value_if("move_2", "true", LATEST_STABLE_COMPILER_VERSION),
1172+
default_value_if("move_1", "true", "1"),
11701173
verbatim_doc_comment)]
11711174
pub compiler_version: Option<CompilerVersion>,
11721175

11731176
/// ...or --language LANGUAGE_VERSION
11741177
/// Specify the language version to be supported.
1175-
/// Defaults to `1`, unless `--move-2` is selected.
1178+
/// Defaults to the latest stable language version
11761179
#[clap(long, value_parser = clap::value_parser!(LanguageVersion),
11771180
alias = "language",
1181+
default_value = LATEST_STABLE_LANGUAGE_VERSION,
11781182
default_value_if("move_2", "true", LATEST_STABLE_LANGUAGE_VERSION),
1183+
default_value_if("move_1", "true", "1"),
11791184
verbatim_doc_comment)]
11801185
pub language_version: Option<LanguageVersion>,
11811186

11821187
/// Select bytecode, language, and compiler versions to support the latest Move 2.
11831188
#[clap(long, verbatim_doc_comment)]
11841189
pub move_2: bool,
1190+
1191+
/// Select bytecode, language, and compiler versions for Move 1.
1192+
#[clap(long, verbatim_doc_comment)]
1193+
pub move_1: bool,
11851194
}
11861195

11871196
impl Default for MovePackageDir {
@@ -1200,11 +1209,12 @@ impl MovePackageDir {
12001209
override_std: None,
12011210
skip_fetch_latest_git_deps: true,
12021211
bytecode_version: None,
1203-
compiler_version: None,
1204-
language_version: None,
1212+
compiler_version: Some(CompilerVersion::latest_stable()),
1213+
language_version: Some(LanguageVersion::latest_stable()),
12051214
skip_attribute_checks: false,
12061215
check_test_code: false,
1207-
move_2: false,
1216+
move_2: true,
1217+
move_1: false,
12081218
optimize: None,
12091219
experiments: vec![],
12101220
}

0 commit comments

Comments
 (0)