-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLI] Set Move 2 as default in Aptos CLI and add move-1
flag
#15431
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -1094,6 +1094,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)] | ||
|
@@ -1163,25 +1164,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"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we also (at least manually) test: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
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 { | ||
|
@@ -1200,11 +1209,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![], | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is removed because |
||
if matches!( | ||
move_options.compiler_version, | ||
Option::None | Some(CompilerVersion::V1) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to address #14441 and close it with this PR.