-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
move lock: derive toolchain edition and flavor from manifest #16885
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ pub mod package_hooks; | |
pub mod resolution; | ||
pub mod source_package; | ||
|
||
use anyhow::Result; | ||
use anyhow::{anyhow, Result}; | ||
use clap::*; | ||
use lock_file::LockFile; | ||
use move_compiler::{ | ||
|
@@ -22,7 +22,11 @@ use move_core_types::account_address::AccountAddress; | |
use move_model::model::GlobalEnv; | ||
use resolution::{dependency_graph::DependencyGraphBuilder, resolution_graph::ResolvedGraph}; | ||
use serde::{Deserialize, Serialize}; | ||
use source_package::{layout::SourcePackageLayout, parsed_manifest::DependencyKind}; | ||
use source_package::{ | ||
layout::SourcePackageLayout, | ||
manifest_parser::{parse_move_manifest_string, parse_source_manifest}, | ||
parsed_manifest::DependencyKind, | ||
}; | ||
use std::{ | ||
collections::BTreeMap, | ||
io::{BufRead, Write}, | ||
|
@@ -326,20 +330,34 @@ impl BuildConfig { | |
|
||
pub fn update_lock_file_toolchain_version( | ||
&self, | ||
path: &PathBuf, | ||
path: &Path, | ||
compiler_version: String, | ||
) -> Result<()> { | ||
let Some(lock_file) = self.lock_file.as_ref() else { | ||
return Ok(()); | ||
}; | ||
let path = &SourcePackageLayout::try_find_root(path) | ||
.map_err(|e| anyhow!("Unable to find package root for {}: {e}", path.display()))?; | ||
|
||
// Resolve edition and flavor from `Move.toml` or assign defaults. | ||
let manifest_string = | ||
std::fs::read_to_string(path.join(SourcePackageLayout::Manifest.path()))?; | ||
let toml_manifest = parse_move_manifest_string(manifest_string.clone())?; | ||
let root_manifest = parse_source_manifest(toml_manifest)?; | ||
let edition = root_manifest | ||
.package | ||
.edition | ||
.or(self.default_edition) | ||
.unwrap_or_default(); | ||
let flavor = root_manifest | ||
.package | ||
.flavor | ||
.or(self.default_flavor) | ||
.unwrap_or_default(); | ||
|
||
Comment on lines
+339
to
+357
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. main change: look at |
||
let install_dir = self.install_dir.as_ref().unwrap_or(path).to_owned(); | ||
let mut lock = LockFile::from(install_dir, lock_file)?; | ||
update_compiler_toolchain( | ||
&mut lock, | ||
compiler_version, | ||
self.default_edition.unwrap_or_default(), | ||
self.default_flavor.unwrap_or_default(), | ||
)?; | ||
update_compiler_toolchain(&mut lock, compiler_version, edition, flavor)?; | ||
let _mutx = PackageLock::lock(); | ||
lock.commit(lock_file)?; | ||
Ok(()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Also updated in this PR: the toolchain update is lifted into
sui-move/src/build.rs
andsui/src/client_commands
respectively. This ensures thatMove.lock
is updated for asui client publish
command even whensui move build
has never been called before (indeed, thisbuild
function doesn't get called onsui client publish
).