Skip to content

Commit

Permalink
move: canonicalize path before all uses of package path (#18531)
Browse files Browse the repository at this point in the history
## Description 

In #18470 I made a change that
uses the `package_path` before canonicalizing, causing relative paths to
the package to not work on `publish`.

This PR reorders the statements to canonicalize the path before any
uses.

## Test plan 

Tested locally, will follow up immediately with a CLI test for relative
paths in a separate PR--want to plug this first.

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
rvantonder authored Jul 6, 2024
1 parent b2bac36 commit 488a9b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/sui/src/client_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,13 +863,13 @@ impl SuiClientCommands {
let client = context.get_client().await?;
let chain_id = client.read_api().get_chain_identifier().await.ok();

let build_config = resolve_lock_file_path(build_config, Some(&package_path))?;
let package_path =
package_path
.canonicalize()
.map_err(|e| SuiError::ModulePublishFailure {
error: format!("Failed to canonicalize package path: {}", e),
})?;
let build_config = resolve_lock_file_path(build_config, Some(&package_path))?;
let previous_id = if let Some(ref chain_id) = chain_id {
sui_package_management::set_package_id(
&package_path,
Expand Down Expand Up @@ -971,6 +971,12 @@ impl SuiClientCommands {
let client = context.get_client().await?;
let chain_id = client.read_api().get_chain_identifier().await.ok();

let package_path =
package_path
.canonicalize()
.map_err(|e| SuiError::ModulePublishFailure {
error: format!("Failed to canonicalize package path: {}", e),
})?;
let build_config = resolve_lock_file_path(build_config, Some(&package_path))?;
let previous_id = if let Some(ref chain_id) = chain_id {
sui_package_management::set_package_id(
Expand All @@ -982,12 +988,6 @@ impl SuiClientCommands {
} else {
None
};
let package_path =
package_path
.canonicalize()
.map_err(|e| SuiError::ModulePublishFailure {
error: format!("Failed to canonicalize package path: {}", e),
})?;
let compile_result = compile_package(
client.read_api(),
build_config.clone(),
Expand Down

0 comments on commit 488a9b1

Please sign in to comment.