Skip to content

Commit

Permalink
add move-1 flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 committed Jan 7, 2025
1 parent 0318475 commit 706cbf7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion crates/aptos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ All notable changes to the Aptos CLI will be captured in this file. This project
# Unreleased
- Add flag `--benchmark` to `aptos move prove`, which allows to benchmark verification times of individual functions in a package.
- Add flag `--only <name>` to `aptos move prove`, which allows to scope verification to a function.

- Fix `aptos init` to show the explorer link for accounts when account is already created on chain instead of prompting to fund the account.
- 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.1.0] - 2024/12/13
- More optimizations are now default for compiler v2.
Expand Down
22 changes: 16 additions & 6 deletions crates/aptos/src/common/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 indoc::indoc;
use move_core_types::{
Expand Down Expand Up @@ -1110,6 +1110,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)]
Expand Down Expand Up @@ -1179,25 +1180,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 (at least 2)
#[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<CompilerVersion>,

/// ...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 (at least 2)
#[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<LanguageVersion>,

/// 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 {
Expand All @@ -1216,11 +1225,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![],
}
Expand Down
1 change: 0 additions & 1 deletion crates/aptos/src/move_tool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,6 @@ impl IncludedArtifacts {
experiments.append(&mut move_options.experiments.clone());
experiments.append(&mut more_experiments);

// TODO(#14441): Remove `None |` here when we update default CompilerVersion
if matches!(
move_options.compiler_version,
Option::None | Some(CompilerVersion::V1)
Expand Down

0 comments on commit 706cbf7

Please sign in to comment.