diff --git a/crates/sui-move/src/lib.rs b/crates/sui-move/src/lib.rs index 24831d1577b249..18f9f8444fdc7a 100644 --- a/crates/sui-move/src/lib.rs +++ b/crates/sui-move/src/lib.rs @@ -15,6 +15,7 @@ pub mod coverage; #[cfg(feature = "disassemble")] pub mod disassemble; pub mod manage_package; +pub mod migrate; pub mod new; #[cfg(feature = "unit_test")] pub mod unit_test; @@ -28,6 +29,7 @@ pub enum Command { #[cfg(feature = "disassemble")] Disassemble(disassemble::Disassemble), ManagePackage(manage_package::ManagePackage), + Migrate(migrate::Migrate), New(new::New), #[cfg(feature = "unit_test")] Test(unit_test::Test), @@ -56,6 +58,7 @@ pub fn execute_move_command( #[cfg(feature = "disassemble")] Command::Disassemble(c) => c.execute(package_path, build_config), Command::ManagePackage(c) => c.execute(package_path, build_config), + Command::Migrate(c) => c.execute(package_path, build_config), Command::New(c) => c.execute(package_path), #[cfg(feature = "unit_test")] diff --git a/crates/sui-move/src/migrate.rs b/crates/sui-move/src/migrate.rs new file mode 100644 index 00000000000000..63e88e07d96167 --- /dev/null +++ b/crates/sui-move/src/migrate.rs @@ -0,0 +1,20 @@ +// Copyright (c) Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +use clap::Parser; +use move_cli::base::migrate; +use move_package::BuildConfig as MoveBuildConfig; +use std::path::PathBuf; + +#[derive(Parser)] +#[group(id = "sui-move-migrate")] +pub struct Migrate { + #[clap(flatten)] + pub migrate: migrate::Migrate, +} + +impl Migrate { + pub fn execute(self, path: Option, config: MoveBuildConfig) -> anyhow::Result<()> { + self.migrate.execute(path, config) + } +} diff --git a/external-crates/move/crates/move-cli/src/base/migrate.rs b/external-crates/move/crates/move-cli/src/base/migrate.rs index 2975de2f9842ea..911b67b88ae915 100644 --- a/external-crates/move/crates/move-cli/src/base/migrate.rs +++ b/external-crates/move/crates/move-cli/src/base/migrate.rs @@ -14,15 +14,6 @@ pub struct Migrate; impl Migrate { pub fn execute(self, path: Option, config: BuildConfig) -> anyhow::Result<()> { let rerooted_path = reroot_path(path)?; - if config.fetch_deps_only { - let mut config = config; - if config.test_mode { - config.dev_mode = true; - } - config.download_deps_for_package(&rerooted_path, &mut std::io::stdout())?; - return Ok(()); - } - config.migrate_package( &rerooted_path, &mut std::io::stdout(),