Skip to content

Commit d6db699

Browse files
karlwuesthalfprice
authored andcommitted
chore: package management debugging (#2824)
debugging
1 parent f92ddc6 commit d6db699

1 file changed

Lines changed: 41 additions & 11 deletions

File tree

crates/walrus-sui/src/system_setup.rs

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{
1111
};
1212

1313
use anyhow::{Context, Result, anyhow, bail};
14-
use move_package_alt::package::RootPackage;
14+
use move_package_alt::package::{RootPackage, package_loader::PackageLoader};
1515
use move_package_alt_compilation::build_config::BuildConfig as MoveBuildConfig;
1616
use sui_move_build::{CompiledPackage, PackageDependencies};
1717
use sui_package_alt::{SuiFlavor, find_environment};
@@ -83,26 +83,44 @@ pub async fn compile_package(
8383
chain_id: Option<String>,
8484
wallet: &Wallet,
8585
) -> Result<(CompiledPackage, MoveBuildConfig)> {
86-
let env = find_environment(
87-
&package_path,
88-
build_config.environment.clone(),
89-
wallet.wallet_context(),
86+
// TODO: branch here depending on the environment or pass a flag for testing
87+
88+
// let env = find_environment(
89+
// &package_path,
90+
// build_config.environment.clone(),
91+
// wallet.wallet_context(),
92+
// )
93+
// .await?;
94+
95+
// let root_pkg: RootPackage<SuiFlavor> = build_config
96+
// .package_loader(&package_path, &env)
97+
// .load()
98+
// .await?;
99+
100+
let pubfile_path = PathBuf::from(package_path.join("Pub.localnet.toml"));
101+
102+
// TODO: make this clean, only for testing
103+
let root_pkg = PackageLoader::new_ephemeral(
104+
package_path.clone(),
105+
Some(String::from("localnet")),
106+
chain_id.clone().unwrap(),
107+
pubfile_path,
90108
)
109+
.modes(build_config.mode_set())
110+
.load()
91111
.await?;
92112

93-
let root_pkg: RootPackage<SuiFlavor> = build_config
94-
.package_loader(&package_path, &env)
95-
.load()
96-
.await?;
97-
tokio::task::spawn_blocking(|| {
113+
let result = tokio::task::spawn_blocking(|| {
98114
sui_macros::nondeterministic!(compile_package_inner_blocking(
99115
package_path,
100116
build_config,
101117
chain_id,
102118
root_pkg
103119
))
104120
})
105-
.await?
121+
.await?;
122+
123+
result
106124
}
107125

108126
/// Synchronous method to compile the package. Should only be called from an async context
@@ -218,6 +236,18 @@ pub(crate) async fn publish_package(
218236
.execute_transaction_may_fail(wallet.sign_transaction(&tx_data).await)
219237
.await?;
220238

239+
// TODO: duplicate update_publication, and return root_package from compile_package
240+
// (or construct it above and pass it to compile_package)
241+
// let publish_data = update_publication(
242+
// &chain_id,
243+
// LockCommand::Publish,
244+
// response,
245+
// &build_config,
246+
// None,
247+
// )?;
248+
249+
// root_package.write_publish_data(publish_data)?;
250+
221251
Ok(response)
222252
}
223253

0 commit comments

Comments
 (0)