diff --git a/Cargo.lock b/Cargo.lock index 7a26fda371759..56a214c01d3d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6908,6 +6908,7 @@ dependencies = [ "anyhow", "clap", "colored", + "derivative", "itertools 0.10.5", "move-binary-format", "move-bytecode-source-map", diff --git a/crates/sui-core/src/authority/authority_test_utils.rs b/crates/sui-core/src/authority/authority_test_utils.rs index 9d305323924c5..5f1aabcfe05cc 100644 --- a/crates/sui-core/src/authority/authority_test_utils.rs +++ b/crates/sui-core/src/authority/authority_test_utils.rs @@ -415,6 +415,7 @@ pub fn build_test_modules_with_dep_addr( for (addr_name, obj_id) in dep_original_addresses { build_config .config + .build_info .additional_named_addresses .insert(addr_name.to_string(), AccountAddress::from(obj_id)); } @@ -461,6 +462,7 @@ pub async fn publish_package_on_single_authority( for (addr_name, obj_id) in dep_original_addresses { build_config .config + .build_info .additional_named_addresses .insert(addr_name.to_string(), AccountAddress::from(obj_id)); } diff --git a/crates/sui-core/src/unit_tests/authority_tests.rs b/crates/sui-core/src/unit_tests/authority_tests.rs index 8ca92e7bad2f8..17b0633444323 100644 --- a/crates/sui-core/src/unit_tests/authority_tests.rs +++ b/crates/sui-core/src/unit_tests/authority_tests.rs @@ -5375,6 +5375,7 @@ async fn test_publish_transitive_dependencies_ok() { let mut build_config = BuildConfig::new_for_testing(); build_config .config + .build_info .additional_named_addresses .insert("c".to_string(), AccountAddress::ZERO); @@ -5407,10 +5408,14 @@ async fn test_publish_transitive_dependencies_ok() { package_b_path.extend(["src", "unit_tests", "data", "transitive_dependencies", "b"]); let mut build_config = BuildConfig::new_for_testing(); - build_config.config.additional_named_addresses.extend([ - ("b".to_string(), AccountAddress::ZERO), - ("c".to_string(), (package_c_id).into()), - ]); + build_config + .config + .build_info + .additional_named_addresses + .extend([ + ("b".to_string(), AccountAddress::ZERO), + ("c".to_string(), (package_c_id).into()), + ]); let modules = build_config .build(package_b_path) @@ -5443,11 +5448,15 @@ async fn test_publish_transitive_dependencies_ok() { package_a_path.extend(["src", "unit_tests", "data", "transitive_dependencies", "a"]); let mut build_config = BuildConfig::new_for_testing(); - build_config.config.additional_named_addresses.extend([ - ("a".to_string(), AccountAddress::ZERO), - ("b".to_string(), (package_b_id).into()), - ("c".to_string(), (package_c_id).into()), - ]); + build_config + .config + .build_info + .additional_named_addresses + .extend([ + ("a".to_string(), AccountAddress::ZERO), + ("b".to_string(), (package_b_id).into()), + ("c".to_string(), (package_c_id).into()), + ]); let modules = build_config .build(package_a_path) @@ -5486,12 +5495,16 @@ async fn test_publish_transitive_dependencies_ok() { ]); let mut build_config = BuildConfig::new_for_testing(); - build_config.config.additional_named_addresses.extend([ - ("examples".to_string(), AccountAddress::ZERO), - ("a".to_string(), (package_a_id).into()), - ("b".to_string(), (package_b_id).into()), - ("c".to_string(), (package_c_id).into()), - ]); + build_config + .config + .build_info + .additional_named_addresses + .extend([ + ("examples".to_string(), AccountAddress::ZERO), + ("a".to_string(), (package_a_id).into()), + ("b".to_string(), (package_b_id).into()), + ("c".to_string(), (package_c_id).into()), + ]); let modules = build_config .build(package_root_path) diff --git a/crates/sui-core/src/unit_tests/move_integration_tests.rs b/crates/sui-core/src/unit_tests/move_integration_tests.rs index cc82e63a8578f..e7660fafb86e8 100644 --- a/crates/sui-core/src/unit_tests/move_integration_tests.rs +++ b/crates/sui-core/src/unit_tests/move_integration_tests.rs @@ -2774,7 +2774,7 @@ fn ascii_tag() -> TypeTag { #[cfg_attr(msim, ignore)] async fn test_object_no_id_error() { let mut build_config = BuildConfig::new_for_testing(); - build_config.config.test_mode = true; + build_config.config.build_info.test_mode = true; let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); // in this package object struct (NotObject) is defined incorrectly and publishing should // fail (it's defined in test-only code hence cannot be checked by transactional testing diff --git a/crates/sui-core/src/unit_tests/move_package_publish_tests.rs b/crates/sui-core/src/unit_tests/move_package_publish_tests.rs index 2e12ea4cbc573..20d66a5758da1 100644 --- a/crates/sui-core/src/unit_tests/move_package_publish_tests.rs +++ b/crates/sui-core/src/unit_tests/move_package_publish_tests.rs @@ -197,7 +197,7 @@ async fn test_generate_lock_file() { let lock_file_path = tmp.path().join("Move.lock"); let mut build_config = BuildConfig::new_for_testing(); - build_config.config.lock_file = Some(lock_file_path.clone()); + build_config.config.build_info.lock_file = Some(lock_file_path.clone()); build_config .clone() .build(path.clone()) @@ -205,6 +205,7 @@ async fn test_generate_lock_file() { // Update the lock file with placeholder compiler version so this isn't bumped every release. build_config .config + .build_info .update_lock_file_toolchain_version(&path, "0.0.1".into()) .expect("Could not update lock file"); @@ -288,7 +289,7 @@ async fn test_custom_property_parse_published_at() { #[tokio::test] #[cfg_attr(msim, ignore)] async fn test_custom_property_check_unpublished_dependencies() { - let build_config = BuildConfig::new_for_testing(); + let mut build_config = BuildConfig::new_for_testing(); let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); path.extend([ "src", diff --git a/crates/sui-framework-tests/src/metered_verifier.rs b/crates/sui-framework-tests/src/metered_verifier.rs index 80b1db4b1cc53..a59a064f1f3a1 100644 --- a/crates/sui-framework-tests/src/metered_verifier.rs +++ b/crates/sui-framework-tests/src/metered_verifier.rs @@ -16,7 +16,7 @@ use sui_verifier::{default_verifier_config, meter::SuiVerifierMeter}; fn build(path: PathBuf) -> SuiResult { let mut config = sui_move_build::BuildConfig::new_for_testing(); - config.config.warnings_are_errors = true; + config.config.build_info.warnings_are_errors = true; config.build(path) } diff --git a/crates/sui-framework-tests/src/unit_tests.rs b/crates/sui-framework-tests/src/unit_tests.rs index 125045cdb3fdb..df8f28bee60bd 100644 --- a/crates/sui-framework-tests/src/unit_tests.rs +++ b/crates/sui-framework-tests/src/unit_tests.rs @@ -87,12 +87,12 @@ fn run_docs_examples_move_unit_tests() -> io::Result<()> { /// Ensure packages build outside of test mode. fn check_package_builds(path: PathBuf) { let mut config = BuildConfig::new_for_testing(); - config.config.dev_mode = true; + config.config.build_info.dev_mode = true; config.run_bytecode_verifier = true; config.print_diags_to_stderr = true; - config.config.warnings_are_errors = true; - config.config.silence_warnings = false; - config.config.no_lint = false; + config.config.build_info.warnings_are_errors = true; + config.config.build_info.silence_warnings = false; + config.config.build_info.no_lint = false; config .build(path.clone()) .unwrap_or_else(|e| panic!("Building package {}.\nWith error {e}", path.display())); @@ -101,13 +101,13 @@ fn check_package_builds(path: PathBuf) { fn check_move_unit_tests(path: PathBuf) { let mut config = BuildConfig::new_for_testing(); // Make sure to verify tests - config.config.dev_mode = true; - config.config.test_mode = true; + config.config.build_info.dev_mode = true; + config.config.build_info.test_mode = true; config.run_bytecode_verifier = true; config.print_diags_to_stderr = true; - config.config.warnings_are_errors = true; - config.config.silence_warnings = false; - config.config.no_lint = false; + config.config.build_info.warnings_are_errors = true; + config.config.build_info.silence_warnings = false; + config.config.build_info.no_lint = false; let move_config = config.config.clone(); let mut testing_config = UnitTestingConfig::default_with_bound(Some(3_000_000)); testing_config.filter = std::env::var(FILTER_ENV).ok().map(|s| s.to_string()); diff --git a/crates/sui-framework/build.rs b/crates/sui-framework/build.rs index 878b8dc1efee8..ffd74140dc3db 100644 --- a/crates/sui-framework/build.rs +++ b/crates/sui-framework/build.rs @@ -3,7 +3,7 @@ use anyhow::Result; use move_binary_format::CompiledModule; -use move_package::BuildConfig as MoveBuildConfig; +use move_package::{BuildConfig as MoveBuildConfig, BuildInfo}; use std::{ env, fs, path::{Path, PathBuf}, @@ -88,13 +88,16 @@ fn build_packages( out_dir: PathBuf, ) { let config = MoveBuildConfig { - generate_docs: true, - warnings_are_errors: true, - install_dir: Some(PathBuf::from(".")), - no_lint: true, - ..Default::default() + build_info: BuildInfo { + generate_docs: true, + warnings_are_errors: true, + install_dir: Some(PathBuf::from(".")), + no_lint: true, + ..Default::default() + }, + file_reader: None, }; - debug_assert!(!config.test_mode); + debug_assert!(!config.build_info.test_mode); build_packages_with_move_config( bridge_path.clone(), deepbook_path.clone(), @@ -110,12 +113,15 @@ fn build_packages( true, ); let config = MoveBuildConfig { - generate_docs: true, - test_mode: true, - warnings_are_errors: true, - install_dir: Some(PathBuf::from(".")), - no_lint: true, - ..Default::default() + build_info: BuildInfo { + generate_docs: true, + test_mode: true, + warnings_are_errors: true, + install_dir: Some(PathBuf::from(".")), + no_lint: true, + ..Default::default() + }, + file_reader: None, }; build_packages_with_move_config( bridge_path, diff --git a/crates/sui-move-build/src/lib.rs b/crates/sui-move-build/src/lib.rs index 7179f4be31ef8..178f9d9dfc8ee 100644 --- a/crates/sui-move-build/src/lib.rs +++ b/crates/sui-move-build/src/lib.rs @@ -34,7 +34,7 @@ use move_package::{ }, package_hooks::{PackageHooks, PackageIdentifier}, resolution::resolution_graph::ResolvedGraph, - BuildConfig as MoveBuildConfig, + BuildConfig as MoveBuildConfig, BuildInfo, }; use move_package::{ resolution::resolution_graph::Package, source_package::parsed_manifest::CustomDepInfo, @@ -85,9 +85,9 @@ impl BuildConfig { let mut build_config: Self = Default::default(); let install_dir = tempfile::tempdir().unwrap().into_path(); let lock_file = install_dir.join("Move.lock"); - build_config.config.install_dir = Some(install_dir); - build_config.config.lock_file = Some(lock_file); - build_config.config.no_lint = true; + build_config.config.build_info.install_dir = Some(install_dir); + build_config.config.build_info.lock_file = Some(lock_file); + build_config.config.build_info.no_lint = true; build_config } @@ -100,6 +100,7 @@ impl BuildConfig { for (addr_name, obj_id) in dep_original_addresses { build_config .config + .build_info .additional_named_addresses .insert(addr_name.into(), AccountAddress::from(obj_id)); } @@ -125,7 +126,7 @@ impl BuildConfig { resolution_graph: ResolvedGraph, writer: &mut W, ) -> anyhow::Result<(MoveCompiledPackage, FnInfoMap)> { - let build_plan = BuildPlan::create(resolution_graph)?; + let mut build_plan = BuildPlan::create(resolution_graph, None)?; let mut fn_info = None; let compiled_pkg = build_plan.compile_with_driver(writer, |compiler| { let (files, units_res) = compiler.build()?; @@ -215,7 +216,10 @@ pub fn decorate_warnings(warning_diags: Diagnostics, files: Option<&FilesSourceT pub fn set_sui_flavor(build_config: &mut MoveBuildConfig) -> Option { use move_compiler::editions::Flavor; - let flavor = build_config.default_flavor.get_or_insert(Flavor::Sui); + let flavor = build_config + .build_info + .default_flavor + .get_or_insert(Flavor::Sui); if flavor != &Flavor::Sui { return Some(format!( "The flavor of the Move compiler cannot be overridden with anything but \ @@ -578,8 +582,11 @@ impl CompiledPackage { impl Default for BuildConfig { fn default() -> Self { let config = MoveBuildConfig { - default_flavor: Some(move_compiler::editions::Flavor::Sui), - ..MoveBuildConfig::default() + build_info: BuildInfo { + default_flavor: Some(move_compiler::editions::Flavor::Sui), + ..BuildInfo::default() + }, + file_reader: None, }; BuildConfig { config, diff --git a/crates/sui-move/src/build.rs b/crates/sui-move/src/build.rs index 66e50f2b83f7f..535227b346038 100644 --- a/crates/sui-move/src/build.rs +++ b/crates/sui-move/src/build.rs @@ -98,10 +98,10 @@ pub fn resolve_lock_file_path( mut build_config: MoveBuildConfig, package_path: Option, ) -> Result { - if build_config.lock_file.is_none() { + if build_config.build_info.lock_file.is_none() { let package_root = base::reroot_path(package_path)?; let lock_file_path = package_root.join(SourcePackageLayout::Lock.path()); - build_config.lock_file = Some(lock_file_path); + build_config.build_info.lock_file = Some(lock_file_path); } Ok(build_config) } diff --git a/crates/sui-source-validation-service/src/lib.rs b/crates/sui-source-validation-service/src/lib.rs index c9378395c49c1..ada7c724dcbfd 100644 --- a/crates/sui-source-validation-service/src/lib.rs +++ b/crates/sui-source-validation-service/src/lib.rs @@ -158,8 +158,8 @@ pub async fn verify_package( MoveBuildConfig::default(), Some(package_path.as_ref().to_path_buf()), )?; - config.no_lint = true; - config.silence_warnings = true; + config.build_info.no_lint = true; + config.build_info.silence_warnings = true; let build_config = BuildConfig { config, run_bytecode_verifier: false, /* no need to run verifier if code is on-chain */ diff --git a/crates/sui-source-validation-service/tests/tests.rs b/crates/sui-source-validation-service/tests/tests.rs index 75df17af8582d..d58448edda91f 100644 --- a/crates/sui-source-validation-service/tests/tests.rs +++ b/crates/sui-source-validation-service/tests/tests.rs @@ -178,7 +178,7 @@ async fn run_publish( let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path: package_path.clone(), - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -208,7 +208,7 @@ async fn run_upgrade( let resp = SuiClientCommands::Upgrade { package_path: upgrade_pkg_path, upgrade_capability: cap.reference.object_id, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, diff --git a/crates/sui/src/client_commands.rs b/crates/sui/src/client_commands.rs index a41d591ec745b..8738c8e82b85b 100644 --- a/crates/sui/src/client_commands.rs +++ b/crates/sui/src/client_commands.rs @@ -18,7 +18,7 @@ use fastcrypto::{ use json_to_table::json_to_table; use move_core_types::language_storage::TypeTag; -use move_package::BuildConfig as MoveBuildConfig; +use move_package::{BuildConfig as MoveBuildConfig, BuildInfo}; use prometheus::Registry; use serde::Serialize; use serde_json::{json, Value}; @@ -426,7 +426,7 @@ pub enum SuiClientCommands { /// Package build options #[clap(flatten)] - build_config: MoveBuildConfig, + build_info: BuildInfo, /// ID of the gas object for gas payment, in 20 bytes Hex string /// If not provided, a gas object with at least gas_budget value will be selected @@ -597,7 +597,7 @@ pub enum SuiClientCommands { /// Package build options #[clap(flatten)] - build_config: MoveBuildConfig, + build_info: BuildInfo, /// ID of the gas object for gas payment, in 20 bytes Hex string /// If not provided, a gas object with at least gas_budget value will be selected @@ -640,7 +640,7 @@ pub enum SuiClientCommands { /// Package build options #[clap(flatten)] - build_config: MoveBuildConfig, + build_info: BuildInfo, }, /// Verify local Move packages against on-chain packages, and optionally their dependencies. @@ -652,7 +652,7 @@ pub enum SuiClientCommands { /// Package build options #[clap(flatten)] - build_config: MoveBuildConfig, + build_info: BuildInfo, /// Verify on-chain dependencies. #[clap(long)] @@ -852,7 +852,7 @@ impl SuiClientCommands { SuiClientCommands::Upgrade { package_path, upgrade_capability, - build_config, + build_info, gas, gas_budget, skip_dependency_verification, @@ -867,7 +867,7 @@ impl SuiClientCommands { let (dependencies, compiled_modules, compiled_package, package_id) = compile_package( &client, - build_config, + build_info, package_path, with_unpublished_dependencies, skip_dependency_verification, @@ -940,14 +940,14 @@ impl SuiClientCommands { SuiClientCommands::Publish { package_path, gas, - build_config, + build_info, gas_budget, skip_dependency_verification, with_unpublished_dependencies, serialize_unsigned_transaction, serialize_signed_transaction, } => { - if build_config.test_mode { + if build_info.test_mode { return Err(SuiError::ModulePublishFailure { error: "The `publish` subcommand should not be used with the `--test` flag\n\ @@ -968,7 +968,7 @@ impl SuiClientCommands { let client = context.get_client().await?; let (dependencies, compiled_modules, _, _) = compile_package( &client, - build_config, + build_info, package_path, with_unpublished_dependencies, skip_dependency_verification, @@ -996,12 +996,16 @@ impl SuiClientCommands { SuiClientCommands::VerifyBytecodeMeter { package_path, - build_config, + build_info, } => { let protocol_config = ProtocolConfig::get_for_max_version_UNSAFE(); let registry = &Registry::new(); let bytecode_verifier_metrics = Arc::new(BytecodeVerifierMetrics::new(registry)); + let build_config = MoveBuildConfig { + build_info, + file_reader: None, + }; let package = compile_package_simple(build_config, package_path)?; let modules: Vec<_> = package.get_modules().cloned().collect(); @@ -1500,7 +1504,7 @@ impl SuiClientCommands { ), SuiClientCommands::VerifySource { package_path, - build_config, + build_info, verify_deps, skip_source, address_override, @@ -1511,6 +1515,10 @@ impl SuiClientCommands { )); } + let build_config = MoveBuildConfig { + build_info, + file_reader: None, + }; let build_config = resolve_lock_file_path(build_config, Some(package_path.clone()))?; let compiled_package = BuildConfig { @@ -1569,7 +1577,7 @@ fn compile_package_simple( async fn compile_package( client: &SuiClient, - build_config: MoveBuildConfig, + build_info: BuildInfo, package_path: PathBuf, with_unpublished_dependencies: bool, skip_dependency_verification: bool, @@ -1582,6 +1590,10 @@ async fn compile_package( ), anyhow::Error, > { + let build_config = MoveBuildConfig { + build_info, + file_reader: None, + }; let config = resolve_lock_file_path(build_config, Some(package_path.clone()))?; let run_bytecode_verifier = true; let print_diags_to_stderr = true; diff --git a/crates/sui/tests/cli_tests.rs b/crates/sui/tests/cli_tests.rs index 341ca29c2609b..2abe9eb344f2a 100644 --- a/crates/sui/tests/cli_tests.rs +++ b/crates/sui/tests/cli_tests.rs @@ -396,7 +396,7 @@ async fn test_move_call_args_linter_command() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: TEST_ONLY_GAS_UNIT_FOR_PUBLISH * rgp, skip_dependency_verification: false, @@ -617,7 +617,7 @@ async fn test_package_publish_command() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -684,7 +684,7 @@ async fn test_delete_shared_object() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -791,7 +791,7 @@ async fn test_receive_argument() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -917,7 +917,7 @@ async fn test_receive_argument_by_immut_ref() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1043,7 +1043,7 @@ async fn test_receive_argument_by_mut_ref() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1171,7 +1171,7 @@ async fn test_package_publish_command_with_unpublished_dependency_succeeds( let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1239,7 +1239,7 @@ async fn test_package_publish_command_with_unpublished_dependency_fails( let build_config = BuildConfig::new_for_testing().config; let result = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1285,7 +1285,7 @@ async fn test_package_publish_command_non_zero_unpublished_dep_fails() -> Result let build_config = BuildConfig::new_for_testing().config; let result = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1340,7 +1340,7 @@ async fn test_package_publish_command_failure_invalid() -> Result<(), anyhow::Er let build_config = BuildConfig::new_for_testing().config; let result = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1382,7 +1382,7 @@ async fn test_package_publish_nonexistent_dependency() -> Result<(), anyhow::Err let build_config = BuildConfig::new_for_testing().config; let result = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1421,11 +1421,11 @@ async fn test_package_publish_test_flag() -> Result<(), anyhow::Error> { package_path.push("module_publish_with_nonexistent_dependency"); let mut build_config: MoveBuildConfig = BuildConfig::new_for_testing().config; // this would have been the result of calling `sui client publish --test` - build_config.test_mode = true; + build_config.build_info.test_mode = true; let result = SuiClientCommands::Publish { package_path, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1480,7 +1480,7 @@ async fn test_package_upgrade_command() -> Result<(), anyhow::Error> { let build_config = BuildConfig::new_for_testing().config; let resp = SuiClientCommands::Publish { package_path: package_path.clone(), - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, @@ -1552,7 +1552,7 @@ async fn test_package_upgrade_command() -> Result<(), anyhow::Error> { let resp = SuiClientCommands::Upgrade { package_path: upgrade_pkg_path, upgrade_capability: cap.reference.object_id, - build_config, + build_info: build_config.build_info, gas: Some(gas_obj_id), gas_budget: rgp * TEST_ONLY_GAS_UNIT_FOR_PUBLISH, skip_dependency_verification: false, diff --git a/external-crates/move/Cargo.lock b/external-crates/move/Cargo.lock index cf4fc81cb4107..bb232c679d467 100644 --- a/external-crates/move/Cargo.lock +++ b/external-crates/move/Cargo.lock @@ -375,6 +375,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chashmap" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff41a3c2c1e39921b9003de14bf0439c7b63a9039637c291e1a64925d8ddfa45" +dependencies = [ + "owning_ref", + "parking_lot 0.4.8", +] + [[package]] name = "chrono" version = "0.4.24" @@ -1055,6 +1065,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "funty" version = "1.1.0" @@ -1463,6 +1479,12 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "memchr" version = "2.5.0" @@ -1544,6 +1566,7 @@ name = "move-analyzer" version = "1.0.0" dependencies = [ "anyhow", + "chashmap", "clap 4.4.1", "codespan-reporting", "crossbeam", @@ -1931,6 +1954,7 @@ dependencies = [ "clap 4.4.1", "colored", "datatest-stable", + "derivative", "expect-test", "itertools", "move-binary-format", @@ -2077,7 +2101,7 @@ dependencies = [ "move-vm-types", "sha2", "sha3", - "smallvec", + "smallvec 1.10.0", "tempfile", "walkdir", ] @@ -2213,7 +2237,7 @@ dependencies = [ "parking_lot 0.11.2", "proptest", "sha3", - "smallvec", + "smallvec 1.10.0", "tracing", ] @@ -2248,7 +2272,7 @@ dependencies = [ "move-vm-profiler", "proptest", "serde", - "smallvec", + "smallvec 1.10.0", ] [[package]] @@ -2425,6 +2449,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "parity-scale-codec" version = "2.3.1" @@ -2451,6 +2484,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "parking_lot" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" +dependencies = [ + "owning_ref", + "parking_lot_core 0.2.14", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -2472,6 +2515,18 @@ dependencies = [ "parking_lot_core 0.9.7", ] +[[package]] +name = "parking_lot_core" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +dependencies = [ + "libc", + "rand 0.4.6", + "smallvec 0.6.14", + "winapi", +] + [[package]] name = "parking_lot_core" version = "0.8.6" @@ -2482,7 +2537,7 @@ dependencies = [ "instant", "libc", "redox_syscall 0.2.16", - "smallvec", + "smallvec 1.10.0", "winapi", ] @@ -2495,7 +2550,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall 0.2.16", - "smallvec", + "smallvec 1.10.0", "windows-sys 0.45.0", ] @@ -2769,6 +2824,19 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +dependencies = [ + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi", +] + [[package]] name = "rand" version = "0.7.3" @@ -2813,6 +2881,21 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.5.1" @@ -2880,6 +2963,15 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "redox_syscall" version = "0.1.57" @@ -3239,6 +3331,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.10.0" @@ -3255,6 +3356,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "stacker" version = "0.1.15" @@ -3624,7 +3731,7 @@ dependencies = [ "once_cell", "regex", "sharded-slab", - "smallvec", + "smallvec 1.10.0", "thread_local", "tracing", "tracing-core", diff --git a/external-crates/move/Cargo.toml b/external-crates/move/Cargo.toml index 55a39c32d6327..fe7bd69344690 100644 --- a/external-crates/move/Cargo.toml +++ b/external-crates/move/Cargo.toml @@ -16,6 +16,7 @@ better_any = "0.1.1" bitvec = "0.19.4" byteorder = "1.4.3" bytes = "1.0.1" +chashmap = "2.2.2" chrono = "0.4.19" clap = { version = "4", features = ["derive"] } codespan = "0.11.1" diff --git a/external-crates/move/crates/move-analyzer/Cargo.toml b/external-crates/move/crates/move-analyzer/Cargo.toml index 7c0e6279d1e63..63c70492afff2 100644 --- a/external-crates/move/crates/move-analyzer/Cargo.toml +++ b/external-crates/move/crates/move-analyzer/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] anyhow.workspace = true +chashmap.workspace = true codespan-reporting.workspace = true derivative.workspace = true dunce.workspace = true diff --git a/external-crates/move/crates/move-analyzer/src/bin/move-analyzer.rs b/external-crates/move/crates/move-analyzer/src/bin/move-analyzer.rs index 1a3b0e51b5047..fa369b6e5cefd 100644 --- a/external-crates/move/crates/move-analyzer/src/bin/move-analyzer.rs +++ b/external-crates/move/crates/move-analyzer/src/bin/move-analyzer.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; +use chashmap::CHashMap; use clap::Parser; use crossbeam::channel::{bounded, select}; use lsp_server::{Connection, Message, Notification, Request, Response}; @@ -18,10 +19,8 @@ use std::{ }; use move_analyzer::{ - completion::on_completion_request, - context::Context, - symbols, - vfs::{on_text_document_sync_notification, VirtualFileSystem}, + completion::on_completion_request, context::Context, symbols, + vfs::on_text_document_sync_notification, }; use url::Url; @@ -48,9 +47,9 @@ fn main() { let (connection, io_threads) = Connection::stdio(); let symbols = Arc::new(Mutex::new(symbols::empty_symbols())); - let mut context = Context { + let files = Arc::new(CHashMap::new()); + let context = Context { connection, - files: VirtualFileSystem::default(), symbols: symbols.clone(), }; @@ -125,7 +124,8 @@ fn main() { .unwrap_or(false); } - symbolicator_runner = symbols::SymbolicatorRunner::new(symbols.clone(), diag_sender, lint); + symbolicator_runner = + symbols::SymbolicatorRunner::new(files.clone(), symbols.clone(), diag_sender, lint); // If initialization information from the client contains a path to the directory being // opened, try to initialize symbols before sending response to the client. Do not bother @@ -134,7 +134,9 @@ fn main() { // to be available right after the client is initialized. if let Some(uri) = initialize_params.root_uri { if let Some(p) = symbols::SymbolicatorRunner::root_dir(&uri.to_file_path().unwrap()) { - if let Ok((Some(new_symbols), _)) = symbols::get_symbols(p.as_path(), lint) { + if let Ok((Some(new_symbols), _)) = + symbols::get_symbols(files.clone(), p.as_path(), lint) + { let mut old_symbols = symbols.lock().unwrap(); (*old_symbols).merge(new_symbols); } @@ -189,7 +191,10 @@ fn main() { }, } }, - Err(error) => eprintln!("symbolicator message error: {:?}", error), + Err(error) => { + assert!(false); + eprintln!("symbolicator message error: {:?}", error); + }, } }, recv(context.connection.receiver) -> message => { @@ -199,7 +204,7 @@ fn main() { // a chance of completing pending requests (but should not accept new requests // either which is handled inside on_requst) - instead it quits after receiving // the exit notification from the client, which is handled below - shutdown_req_received = on_request(&context, &request, shutdown_req_received); + shutdown_req_received = on_request(&context, files.clone(), &request, shutdown_req_received); } Ok(Message::Response(response)) => on_response(&context, &response), Ok(Message::Notification(notification)) => { @@ -210,7 +215,7 @@ fn main() { // It ought to, especially once it begins processing requests that may // take a long time to respond to. } - _ => on_notification(&mut context, &symbolicator_runner, ¬ification), + _ => on_notification(files.clone(), &symbolicator_runner, ¬ification), } } Err(error) => eprintln!("IDE message error: {:?}", error), @@ -228,7 +233,12 @@ fn main() { /// The reason why this information is also passed as an argument is that according to the LSP /// spec, if any additional requests are received after shutdownd then the LSP implementation /// should respond with a particular type of error. -fn on_request(context: &Context, request: &Request, shutdown_request_received: bool) -> bool { +fn on_request( + context: &Context, + files: Arc>, + request: &Request, + shutdown_request_received: bool, +) -> bool { if shutdown_request_received { let response = lsp_server::Response::new_err( request.id.clone(), @@ -246,7 +256,12 @@ fn on_request(context: &Context, request: &Request, shutdown_request_received: b } match request.method.as_str() { lsp_types::request::Completion::METHOD => { - on_completion_request(context, request, &context.symbols.lock().unwrap()) + on_completion_request( + context, + request, + files.clone(), + &context.symbols.lock().unwrap(), + ); } lsp_types::request::GotoDefinition::METHOD => { symbols::on_go_to_def_request(context, request, &context.symbols.lock().unwrap()); @@ -286,7 +301,7 @@ fn on_response(_context: &Context, _response: &Response) { } fn on_notification( - context: &mut Context, + files: Arc>, symbolicator_runner: &symbols::SymbolicatorRunner, notification: &Notification, ) { @@ -295,12 +310,10 @@ fn on_notification( | lsp_types::notification::DidChangeTextDocument::METHOD | lsp_types::notification::DidSaveTextDocument::METHOD | lsp_types::notification::DidCloseTextDocument::METHOD => { - on_text_document_sync_notification( - &mut context.files, - symbolicator_runner, - notification, - ) + on_text_document_sync_notification(files, symbolicator_runner, notification) + } + _ => { + eprintln!("handle notification '{}' from client", notification.method); } - _ => eprintln!("handle notification '{}' from client", notification.method), } } diff --git a/external-crates/move/crates/move-analyzer/src/completion.rs b/external-crates/move/crates/move-analyzer/src/completion.rs index d762d46fbef4e..efb55c0ed6080 100644 --- a/external-crates/move/crates/move-analyzer/src/completion.rs +++ b/external-crates/move/crates/move-analyzer/src/completion.rs @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{context::Context, symbols::Symbols}; +use chashmap::CHashMap; use lsp_server::Request; use lsp_types::{CompletionItem, CompletionItemKind, CompletionParams, Position}; use move_command_line_common::files::FileHash; @@ -14,7 +15,7 @@ use move_compiler::{ }, }; use move_symbol_pool::Symbol; -use std::{collections::HashSet, path::PathBuf}; +use std::{collections::HashSet, path::PathBuf, sync::Arc}; /// Constructs an `lsp_types::CompletionItem` with the given `label` and `kind`. fn completion_item(label: &str, kind: CompletionItemKind) -> CompletionItem { @@ -149,7 +150,12 @@ fn get_cursor_token(buffer: &str, position: &Position) -> Option { /// Sends the given connection a response to a completion request. /// /// The completions returned depend upon where the user's cursor is positioned. -pub fn on_completion_request(context: &Context, request: &Request, symbols: &Symbols) { +pub fn on_completion_request( + context: &Context, + request: &Request, + files: Arc>, + symbols: &Symbols, +) { eprintln!("handling completion request"); let parameters = serde_json::from_value::(request.params.clone()) .expect("could not deserialize completion request"); @@ -160,40 +166,42 @@ pub fn on_completion_request(context: &Context, request: &Request, symbols: &Sym .uri .to_file_path() .unwrap(); - let buffer = context.files.get(&path); - if buffer.is_none() { - eprintln!( - "Could not read '{:?}' when handling completion request", - path - ); - } - - // The completion items we provide depend upon where the user's cursor is positioned. - let cursor = - buffer.and_then(|buf| get_cursor_token(buf, ¶meters.text_document_position.position)); let mut items = vec![]; - match cursor { - Some(Tok::Colon) => { - items.extend_from_slice(&primitive_types()); - } - Some(Tok::Period) | Some(Tok::ColonColon) => { - // `.` or `::` must be followed by identifiers, which are added to the completion items - // below. + match files.get(&path) { + Some(buffer) => { + let buf = buffer.as_str(); + let cursor = get_cursor_token(buf, ¶meters.text_document_position.position); + match cursor { + Some(Tok::Colon) => { + items.extend_from_slice(&primitive_types()); + } + Some(Tok::Period) | Some(Tok::ColonColon) => { + // `.` or `::` must be followed by identifiers, which are added to the completion items + // below. + } + _ => { + // If the user's cursor is positioned anywhere other than following a `.`, `:`, or `::`, + // offer them Move's keywords, operators, and builtins as completion items. + items.extend_from_slice(&keywords()); + items.extend_from_slice(&builtins()); + } + } + + let identifiers = identifiers(buf, symbols, &path); + items.extend_from_slice(&identifiers); } - _ => { - // If the user's cursor is positioned anywhere other than following a `.`, `:`, or `::`, - // offer them Move's keywords, operators, and builtins as completion items. + None => { + eprintln!( + "Could not read '{:?}' when handling completion request", + path + ); + // no file found so jus add keywords and builtins items.extend_from_slice(&keywords()); items.extend_from_slice(&builtins()); } } - if let Some(buffer) = &buffer { - let identifiers = identifiers(buffer, symbols, &path); - items.extend_from_slice(&identifiers); - } - let result = serde_json::to_value(items).expect("could not serialize completion response"); eprintln!("about to send completion response"); let response = lsp_server::Response::new_ok(request.id.clone(), result); diff --git a/external-crates/move/crates/move-analyzer/src/context.rs b/external-crates/move/crates/move-analyzer/src/context.rs index 36b3eaf0abe8a..edd17efb21f7d 100644 --- a/external-crates/move/crates/move-analyzer/src/context.rs +++ b/external-crates/move/crates/move-analyzer/src/context.rs @@ -2,7 +2,7 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use crate::{symbols::Symbols, vfs::VirtualFileSystem}; +use crate::symbols::Symbols; use lsp_server::Connection; use std::sync::{Arc, Mutex}; @@ -10,8 +10,6 @@ use std::sync::{Arc, Mutex}; pub struct Context { /// The connection with the language server's client. pub connection: Connection, - /// The files that the language server is providing information about. - pub files: VirtualFileSystem, /// Symbolication information pub symbols: Arc>, } diff --git a/external-crates/move/crates/move-analyzer/src/symbols.rs b/external-crates/move/crates/move-analyzer/src/symbols.rs index baa580a3b5529..a0f776dd81137 100644 --- a/external-crates/move/crates/move-analyzer/src/symbols.rs +++ b/external-crates/move/crates/move-analyzer/src/symbols.rs @@ -58,8 +58,10 @@ use crate::{ context::Context, diagnostics::{lsp_diagnostics, lsp_empty_diagnostics}, utils::get_loc, + vfs::VirtualFileSystem, }; use anyhow::{anyhow, Result}; +use chashmap::CHashMap; use codespan_reporting::files::SimpleFiles; use crossbeam::channel::Sender; use derivative::*; @@ -88,7 +90,7 @@ use move_compiler::{ expansion::ast::{self as E, Fields, ModuleIdent, ModuleIdent_, Value, Value_, Visibility}, naming::ast::{StructDefinition, StructFields, TParam, Type, TypeName_, Type_, UseFuns}, parser::ast::{self as P, StructName}, - shared::{Identifier, Name}, + shared::{FileReader, FileSystemFileReader, Identifier, Name}, typing::ast::{ BuiltinFunction_, Exp, ExpListItem, Function, FunctionBody_, LValue, LValueList, LValue_, ModuleCall, ModuleDefinition, SequenceItem, SequenceItem_, UnannotatedExp_, @@ -96,7 +98,10 @@ use move_compiler::{ PASS_PARSER, PASS_TYPING, }; use move_ir_types::location::*; -use move_package::compilation::build_plan::BuildPlan; +use move_package::{ + compilation::build_plan::BuildPlan, resolution::resolution_graph::ResolvedGraph, + source_package::parsed_manifest::FileName, +}; use move_symbol_pool::Symbol; /// Enabling/disabling the language server reporting readiness to support go-to-def and @@ -652,6 +657,7 @@ impl SymbolicatorRunner { /// Create a new runner pub fn new( + files: Arc>, symbols: Arc>, sender: Sender>>>, lint: bool, @@ -711,7 +717,7 @@ impl SymbolicatorRunner { continue; } eprintln!("symbolication started"); - match get_symbols(root_dir.unwrap().as_path(), lint) { + match get_symbols(files.clone(), root_dir.unwrap().as_path(), lint) { Ok((symbols_opt, lsp_diagnostics)) => { eprintln!("symbolication finished"); if let Some(new_symbols) = symbols_opt { @@ -949,15 +955,24 @@ impl Symbols { /// actually (re)computed and the diagnostics are returned, the old symbolic information should /// be retained even if it's getting out-of-date. pub fn get_symbols( + virtual_files: Arc>, pkg_path: &Path, lint: bool, ) -> Result<(Option, BTreeMap>)> { - let build_config = move_package::BuildConfig { - test_mode: true, - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - default_flavor: Some(Flavor::Sui), - no_lint: !lint, - ..Default::default() + let vfs = VirtualFileSystem { + ide_files: virtual_files, + all_files: HashMap::new(), + }; + + let mut build_config = move_package::BuildConfig { + build_info: move_package::BuildInfo { + test_mode: true, + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + default_flavor: Some(Flavor::Sui), + no_lint: !lint, + ..Default::default() + }, + file_reader: Some(Box::new(vfs.clone())), }; eprintln!("symbolicating {:?}", pkg_path); @@ -966,14 +981,15 @@ pub fn get_symbols( // vector as the writer let resolution_graph = build_config.resolution_graph_for_package(pkg_path, &mut Vec::new())?; + let file_reader = std::mem::take(&mut build_config.file_reader); // get source files to be able to correlate positions (in terms of byte offsets) with actual // file locations (in terms of line/column numbers) - let source_files = &resolution_graph.file_sources(); - let mut files = SimpleFiles::new(); + let (source_files, file_reader) = file_sources(&resolution_graph, file_reader); + let mut files: SimpleFiles = SimpleFiles::new(); let mut file_id_mapping = HashMap::new(); let mut file_id_to_lines = HashMap::new(); let mut file_name_mapping = BTreeMap::new(); - for (fhash, (fname, source)) in source_files { + for (fhash, (fname, source)) in &source_files { let id = files.add(*fname, source.clone()); file_id_mapping.insert(*fhash, id); file_name_mapping.insert( @@ -984,7 +1000,7 @@ pub fn get_symbols( file_id_to_lines.insert(id, lines); } - let build_plan = BuildPlan::create(resolution_graph)?; + let mut build_plan = BuildPlan::create(resolution_graph, file_reader)?; let mut parsed_ast = None; let mut typed_ast = None; let mut diagnostics = None; @@ -1162,6 +1178,38 @@ pub fn get_symbols( Ok((Some(symbols), ide_diagnostics)) } +pub fn file_sources( + resolved_graph: &ResolvedGraph, + mut file_reader: Option>, +) -> ( + BTreeMap, + Option>, +) { + let files = resolved_graph + .package_table + .iter() + .flat_map(|(_, rpkg)| { + rpkg.get_sources(&resolved_graph.build_options) + .unwrap() + .iter() + .map(|fname| { + let mut contents = String::new(); + let _ = match file_reader.as_mut() { + Some(reader) => { + reader.read_to_string(&PathBuf::from(fname.as_str()), &mut contents) + } + None => FileSystemFileReader + .read_to_string(&PathBuf::from(fname.as_str()), &mut contents), + }; + let fhash = FileHash::new(&contents); + (fhash, (*fname, contents)) + }) + .collect::>() + }) + .collect(); + (files, file_reader) +} + /// Produces module ident string of the form pkg_name::module_name to be used as a map key. /// It's important that these are consistent between parsing AST and typed AST, fn parsing_mod_ident_to_map_key(mod_ident: &P::ModuleIdent_) -> String { @@ -3468,7 +3516,7 @@ fn docstring_test() { path.push("tests/symbols"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -3738,7 +3786,7 @@ fn symbols_test() { path.push("tests/symbols"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -4778,7 +4826,7 @@ fn const_test() { path.push("tests/symbols"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5017,7 +5065,7 @@ fn imports_test() { path.push("tests/symbols"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5218,7 +5266,7 @@ fn module_access_test() { path.push("tests/symbols"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5372,7 +5420,7 @@ fn parse_error_test() { path.push("tests/parse-error"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5456,7 +5504,7 @@ fn parse_error_with_deps_test() { path.push("tests/parse-error-dep"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5504,7 +5552,7 @@ fn pretype_error_test() { path.push("tests/pre-type-error"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5538,7 +5586,7 @@ fn pretype_error_with_deps_test() { path.push("tests/pre-type-error-dep"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5635,7 +5683,7 @@ fn dot_call_test() { path.push("tests/move-2024"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); @@ -5964,7 +6012,7 @@ fn mod_ident_uniform_test() { path.push("tests/mod-ident-uniform"); - let (symbols_opt, _) = get_symbols(path.as_path(), false).unwrap(); + let (symbols_opt, _) = get_symbols(Arc::new(CHashMap::new()), path.as_path(), false).unwrap(); let symbols = symbols_opt.unwrap(); let mut fpath = path.clone(); diff --git a/external-crates/move/crates/move-analyzer/src/vfs.rs b/external-crates/move/crates/move-analyzer/src/vfs.rs index 07733757290e2..c8285122f2659 100644 --- a/external-crates/move/crates/move-analyzer/src/vfs.rs +++ b/external-crates/move/crates/move-analyzer/src/vfs.rs @@ -11,76 +11,108 @@ //! saved) to its textual contents. use crate::symbols; +use chashmap::CHashMap; use lsp_server::Notification; use lsp_types::{ notification::Notification as _, DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams, }; -use std::path::PathBuf; +use move_compiler::shared::FileReader; +use std::{ + collections::HashMap, + io::Read, + path::{Path, PathBuf}, + sync::Arc, +}; /// A mapping from identifiers (file names, potentially, but not necessarily) to their contents. -#[derive(Debug, Default)] +#[derive(Debug, Default, Clone)] + +/// Virtual file system that serves the same version of the file each time it's queried, +/// whether this file comes from the IDE message (file open or update notification) or +/// it comes from the file system. pub struct VirtualFileSystem { - files: std::collections::HashMap, + /// Files pushed to the LSP server by the IDE via file open or update notifications + pub ide_files: Arc>, + /// Files served by this VFS (populated on demand from IDE files or from the file system) + pub all_files: HashMap, } -impl VirtualFileSystem { - /// Returns a reference to the buffer corresponding to the given identifier, or `None` if it - /// is not present in the system. - pub fn get(&self, identifier: &PathBuf) -> Option<&str> { - self.files.get(identifier).map(|s| s.as_str()) - } - - /// Inserts or overwrites the buffer corresponding to the given identifier. - /// - /// TODO: A far more efficient "virtual file system" would update its buffers with changes sent - /// from the client, instead of completely replacing them each time. The rust-analyzer has a - /// 'vfs' module that is capable of doing just that, but it is not published on crates.io. If - /// we could help get it published, we could use it here. - pub fn update(&mut self, identifier: PathBuf, content: &str) { - self.files.insert(identifier, content.to_string()); - } - - /// Removes the buffer and its identifier from the system. - pub fn remove(&mut self, identifier: &PathBuf) { - self.files.remove(identifier); +impl FileReader for VirtualFileSystem { + fn read_to_string(&mut self, fpath: &Path, buf: &mut String) -> std::io::Result { + // We may have a race here between a file being pushed by the IDE (and available in + // `ide_files`) and files only available in the file system. This should be OK, though, as + // in the worst case, we can always read from a file: + // - if we attempt to get `ide_files` file but the window closes in the meantime and it's no + // longer available, we still get up-to-date data from the file system (the file was saved + // or not before window closing but it does not matter) + // - if we attempt to read from file and the window opens in the meantime, the only + // consequence is that we will temporarily build symbols for a slightly out-of-date data, + // but this will quickly get updated once the user starts typing + match self.all_files.get(fpath) { + Some(s) => { + buf.push_str(s.as_str()); + Ok(s.len()) + } + None => match self.ide_files.remove(fpath) { + Some(s) => { + buf.push_str(s.as_str()); + let len = s.len(); + self.all_files.insert(fpath.to_path_buf(), s); + Ok(len) + } + None => { + let mut f = std::fs::File::open(fpath).map_err(|err| { + std::io::Error::new(err.kind(), format!("{}: {:?}", err, fpath)) + })?; + let len = f.read_to_string(buf)?; + self.all_files.insert(fpath.to_path_buf(), buf.clone()); + Ok(len) + } + }, + } } } /// Updates the given virtual file system based on the text document sync notification that was sent. pub fn on_text_document_sync_notification( - files: &mut VirtualFileSystem, + files: Arc>, symbolicator_runner: &symbols::SymbolicatorRunner, notification: &Notification, ) { + // TODO: A far more efficient "virtual file system" would update its buffers with changes sent + // from the client, instead of completely replacing them each time. The rust-analyzer has a + // 'vfs' module that is capable of doing just that, but it is not published on crates.io. If + // we could help get it published, we could use it here. eprintln!("text document notification"); match notification.method.as_str() { lsp_types::notification::DidOpenTextDocument::METHOD => { let parameters = serde_json::from_value::(notification.params.clone()) .expect("could not deserialize notification"); - files.update( + files.insert( parameters.text_document.uri.to_file_path().unwrap(), - ¶meters.text_document.text, + parameters.text_document.text, ); symbolicator_runner.run(parameters.text_document.uri.to_file_path().unwrap()); } lsp_types::notification::DidChangeTextDocument::METHOD => { - let parameters = + let mut parameters = serde_json::from_value::(notification.params.clone()) .expect("could not deserialize notification"); - files.update( + files.insert( parameters.text_document.uri.to_file_path().unwrap(), - ¶meters.content_changes.last().unwrap().text, + parameters.content_changes.pop().unwrap().text, ); + symbolicator_runner.run(parameters.text_document.uri.to_file_path().unwrap()); } lsp_types::notification::DidSaveTextDocument::METHOD => { let parameters = serde_json::from_value::(notification.params.clone()) .expect("could not deserialize notification"); - files.update( + files.insert( parameters.text_document.uri.to_file_path().unwrap(), - ¶meters.text.unwrap(), + parameters.text.unwrap(), ); symbolicator_runner.run(parameters.text_document.uri.to_file_path().unwrap()); } diff --git a/external-crates/move/crates/move-cli/src/base/build.rs b/external-crates/move/crates/move-cli/src/base/build.rs index dce9a6f9cf25f..fe2741b405726 100644 --- a/external-crates/move/crates/move-cli/src/base/build.rs +++ b/external-crates/move/crates/move-cli/src/base/build.rs @@ -14,10 +14,10 @@ pub struct Build; impl Build { pub fn execute(self, path: Option, config: BuildConfig) -> anyhow::Result<()> { let rerooted_path = reroot_path(path)?; - if config.fetch_deps_only { + if config.build_info.fetch_deps_only { let mut config = config; - if config.test_mode { - config.dev_mode = true; + if config.build_info.test_mode { + config.build_info.dev_mode = true; } config.download_deps_for_package(&rerooted_path, &mut std::io::stdout())?; return Ok(()); diff --git a/external-crates/move/crates/move-cli/src/base/info.rs b/external-crates/move/crates/move-cli/src/base/info.rs index 0811f3986048b..d95ad08e04f60 100644 --- a/external-crates/move/crates/move-cli/src/base/info.rs +++ b/external-crates/move/crates/move-cli/src/base/info.rs @@ -12,7 +12,7 @@ use std::path::PathBuf; pub struct Info; impl Info { - pub fn execute(self, path: Option, config: BuildConfig) -> anyhow::Result<()> { + pub fn execute(self, path: Option, mut config: BuildConfig) -> anyhow::Result<()> { let rerooted_path = reroot_path(path)?; config .resolution_graph_for_package(&rerooted_path, &mut std::io::stdout())? 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 2975de2f9842e..9097b675a727f 100644 --- a/external-crates/move/crates/move-cli/src/base/migrate.rs +++ b/external-crates/move/crates/move-cli/src/base/migrate.rs @@ -14,10 +14,10 @@ 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 { + if config.build_info.fetch_deps_only { let mut config = config; - if config.test_mode { - config.dev_mode = true; + if config.build_info.test_mode { + config.build_info.dev_mode = true; } config.download_deps_for_package(&rerooted_path, &mut std::io::stdout())?; return Ok(()); diff --git a/external-crates/move/crates/move-cli/src/base/prove.rs b/external-crates/move/crates/move-cli/src/base/prove.rs index f72cf553b4c59..d8be3ae8ccdca 100644 --- a/external-crates/move/crates/move-cli/src/base/prove.rs +++ b/external-crates/move/crates/move-cli/src/base/prove.rs @@ -162,7 +162,7 @@ pub fn run_move_prover( mut options: move_prover::cli::Options, ) -> anyhow::Result<()> { // Always run the prover in dev mode, so addresses get default assignments - config.dev_mode = true; + config.build_info.dev_mode = true; if !options.move_sources.is_empty() { bail!( diff --git a/external-crates/move/crates/move-cli/src/base/test.rs b/external-crates/move/crates/move-cli/src/base/test.rs index 25f23cce1d4f0..5795c42f3c500 100644 --- a/external-crates/move/crates/move-cli/src/base/test.rs +++ b/external-crates/move/crates/move-cli/src/base/test.rs @@ -139,8 +139,8 @@ pub fn run_move_unit_tests( writer: &mut W, ) -> Result<(UnitTestResult, Option)> { let mut test_plan = None; - build_config.test_mode = true; - build_config.dev_mode = true; + build_config.build_info.test_mode = true; + build_config.build_info.dev_mode = true; // Build the resolution graph (resolution graph diagnostics are only needed for CLI commands so // ignore them by passing a vector as the writer) @@ -176,7 +176,7 @@ pub fn run_move_unit_tests( }) .collect(); let root_package = resolution_graph.root_package(); - let build_plan = BuildPlan::create(resolution_graph)?; + let mut build_plan = BuildPlan::create(resolution_graph, None)?; // Compile the package. We need to intercede in the compilation, process being performed by the // Move package system, to first grab the compilation env, construct the test plan from it, and // then save it, before resuming the rest of the compilation and returning the results and diff --git a/external-crates/move/crates/move-cli/src/sandbox/cli.rs b/external-crates/move/crates/move-cli/src/sandbox/cli.rs index 39f3bed91b7d5..4d9e55af80e8d 100644 --- a/external-crates/move/crates/move-cli/src/sandbox/cli.rs +++ b/external-crates/move/crates/move-cli/src/sandbox/cli.rs @@ -270,6 +270,7 @@ impl SandboxCommand { let build_dir = Path::new( &move_args .build_config + .build_info .install_dir .as_ref() .unwrap_or(&PathBuf::from(DEFAULT_BUILD_DIR)), diff --git a/external-crates/move/crates/move-cli/src/sandbox/commands/test.rs b/external-crates/move/crates/move-cli/src/sandbox/commands/test.rs index ea2eedc5a17ce..c06bab902b6b3 100644 --- a/external-crates/move/crates/move-cli/src/sandbox/commands/test.rs +++ b/external-crates/move/crates/move-cli/src/sandbox/commands/test.rs @@ -15,7 +15,7 @@ use move_package::{ compilation::{compiled_package::OnDiskCompiledPackage, package_layout::CompiledPackageLayout}, resolution::resolution_graph::ResolvedGraph, source_package::{layout::SourcePackageLayout, manifest_parser::parse_move_manifest_from_file}, - BuildConfig, + BuildConfig, BuildInfo, }; use std::{ collections::{BTreeMap, HashMap}, @@ -129,8 +129,11 @@ fn copy_deps(tmp_dir: &Path, pkg_dir: &Path) -> anyhow::Result { // don't need to nest at all. Resolution graph diagnostics are only needed for CLI commands so // ignore them by passing a vector as the writer. let package_resolution = match (BuildConfig { - dev_mode: true, - ..Default::default() + build_info: BuildInfo { + dev_mode: true, + ..Default::default() + }, + file_reader: None, }) .resolution_graph_for_package(pkg_dir, &mut Vec::new()) { diff --git a/external-crates/move/crates/move-cli/src/sandbox/utils/package_context.rs b/external-crates/move/crates/move-cli/src/sandbox/utils/package_context.rs index c4764a97074d8..8616939922521 100644 --- a/external-crates/move/crates/move-cli/src/sandbox/utils/package_context.rs +++ b/external-crates/move/crates/move-cli/src/sandbox/utils/package_context.rs @@ -18,6 +18,7 @@ impl PackageContext { pub fn new(path: &Option, build_config: &BuildConfig) -> Result { let path = path.as_deref().unwrap_or_else(|| Path::new(".")); let build_dir = build_config + .build_info .install_dir .as_ref() .unwrap_or(&PathBuf::from(DEFAULT_BUILD_DIR)) diff --git a/external-crates/move/crates/move-cli/tests/build_tests/unbound_dependency/args.exp b/external-crates/move/crates/move-cli/tests/build_tests/unbound_dependency/args.exp index aa534517b6081..2069b611863ec 100644 --- a/external-crates/move/crates/move-cli/tests/build_tests/unbound_dependency/args.exp +++ b/external-crates/move/crates/move-cli/tests/build_tests/unbound_dependency/args.exp @@ -3,4 +3,4 @@ Error: Failed to resolve dependencies for package 'A' Caused by: 0: Parsing manifest for 'Foo' - 1: No such file or directory (os error 2) + 1: No such file or directory (os error 2): "./foo/Move.toml" diff --git a/external-crates/move/crates/move-compiler/src/command_line/compiler.rs b/external-crates/move/crates/move-compiler/src/command_line/compiler.rs index 9f5356a07ed23..ed6d73aec627f 100644 --- a/external-crates/move/crates/move-compiler/src/command_line/compiler.rs +++ b/external-crates/move/crates/move-compiler/src/command_line/compiler.rs @@ -15,7 +15,7 @@ use crate::{ expansion, hlir, interface_generator, naming, parser, parser::{comments::*, *}, shared::{ - CompilationEnv, Flags, IndexedPackagePath, NamedAddressMap, NamedAddressMaps, + CompilationEnv, FileReader, Flags, IndexedPackagePath, NamedAddressMap, NamedAddressMaps, NumericalAddress, PackageConfig, PackagePaths, }, to_bytecode, @@ -54,6 +54,8 @@ pub struct Compiler<'a> { known_warning_filters: Vec<(/* Prefix */ Option, Vec)>, package_configs: BTreeMap, default_config: Option, + /// Abstracted source file reader + file_reader: Option>, } pub struct SteppedCompiler<'a, const P: Pass> { @@ -161,6 +163,7 @@ impl<'a> Compiler<'a> { known_warning_filters: vec![], package_configs, default_config: None, + file_reader: None, }) } @@ -259,6 +262,12 @@ impl<'a> Compiler<'a> { self } + pub fn set_file_reader(mut self, file_reader: Box) -> Self { + assert!(self.file_reader.is_none()); + self.file_reader = Some(file_reader); + self + } + pub fn run( self, ) -> anyhow::Result<( @@ -278,14 +287,20 @@ impl<'a> Compiler<'a> { known_warning_filters, package_configs, default_config, + file_reader, } = self; generate_interface_files_for_deps( &mut deps, interface_files_dir_opt, &compiled_module_named_address_mapping, )?; - let mut compilation_env = - CompilationEnv::new(flags, visitors, package_configs, default_config); + let mut compilation_env = CompilationEnv::new( + flags, + visitors, + package_configs, + default_config, + file_reader, + ); if let Some(filter) = warning_filter { compilation_env.add_warning_filter_scope(filter); } diff --git a/external-crates/move/crates/move-compiler/src/parser/mod.rs b/external-crates/move/crates/move-compiler/src/parser/mod.rs index 6afa7b86d3cad..30faa507d990d 100644 --- a/external-crates/move/crates/move-compiler/src/parser/mod.rs +++ b/external-crates/move/crates/move-compiler/src/parser/mod.rs @@ -19,11 +19,7 @@ use anyhow::anyhow; use comments::*; use move_command_line_common::files::{find_move_filenames, FileHash}; use move_symbol_pool::Symbol; -use std::{ - collections::{BTreeSet, HashMap}, - fs::File, - io::Read, -}; +use std::collections::{BTreeSet, HashMap}; pub(crate) fn parse_program( compilation_env: &mut CompilationEnv, @@ -152,10 +148,8 @@ fn parse_file( MatchedFileCommentMap, FileHash, )> { - let mut f = File::open(fname.as_str()) - .map_err(|err| std::io::Error::new(err.kind(), format!("{}: {}", err, fname)))?; let mut source_buffer = String::new(); - f.read_to_string(&mut source_buffer)?; + compilation_env.read_to_string(std::path::Path::new(fname.as_str()), &mut source_buffer)?; let file_hash = FileHash::new(&source_buffer); let buffer = match verify_string(file_hash, &source_buffer) { Err(ds) => { diff --git a/external-crates/move/crates/move-compiler/src/shared/mod.rs b/external-crates/move/crates/move-compiler/src/shared/mod.rs index 7b8d2bf174a24..ca96ebdb66be1 100644 --- a/external-crates/move/crates/move-compiler/src/shared/mod.rs +++ b/external-crates/move/crates/move-compiler/src/shared/mod.rs @@ -24,6 +24,8 @@ use std::{ collections::{BTreeMap, BTreeSet}, fmt, hash::Hash, + io::Read, + path::Path, rc::Rc, sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}, }; @@ -224,6 +226,8 @@ pub struct CompilationEnv { known_filter_names: BTreeMap, prim_definers: BTreeMap, + /// Abstracted source file reader + file_reader: Option>, // TODO(tzakian): Remove the global counter and use this counter instead // pub counter: u64, } @@ -248,6 +252,7 @@ impl CompilationEnv { mut visitors: Vec, package_configs: BTreeMap, default_config: Option, + file_reader: Option>, ) -> Self { use crate::diagnostics::codes::{TypeSafety, UnusedItem}; visitors.extend([ @@ -340,6 +345,7 @@ impl CompilationEnv { known_filters, known_filter_names, prim_definers: BTreeMap::new(), + file_reader, } } @@ -545,6 +551,13 @@ impl CompilationEnv { pub fn primitive_definer(&self, t: N::BuiltinTypeName_) -> Option<&E::ModuleIdent> { self.prim_definers.get(&t) } + + pub fn read_to_string(&mut self, fpath: &Path, buf: &mut String) -> std::io::Result { + match self.file_reader.as_mut() { + Some(reader) => reader.read_to_string(fpath, buf), + None => FileSystemFileReader.read_to_string(fpath, buf), + } + } } pub fn format_allow_attr(attr_name: FilterPrefix, filter: FilterName) -> String { @@ -860,3 +873,21 @@ macro_rules! process_binops { } pub(crate) use process_binops; + +//************************************************************************************************** +// Source file reader +//************************************************************************************************** + +pub trait FileReader: 'static { + fn read_to_string(&mut self, fpath: &Path, buf: &mut String) -> std::io::Result; +} + +pub struct FileSystemFileReader; + +impl FileReader for FileSystemFileReader { + fn read_to_string(&mut self, fpath: &Path, buf: &mut String) -> std::io::Result { + let mut f = std::fs::File::open(fpath) + .map_err(|err| std::io::Error::new(err.kind(), format!("{}: {:?}", err, fpath)))?; + f.read_to_string(buf) + } +} diff --git a/external-crates/move/crates/move-package/Cargo.toml b/external-crates/move/crates/move-package/Cargo.toml index ecde35688b485..4b6c1a102ef56 100644 --- a/external-crates/move/crates/move-package/Cargo.toml +++ b/external-crates/move/crates/move-package/Cargo.toml @@ -24,6 +24,7 @@ treeline.workspace = true once_cell.workspace = true named-lock.workspace = true itertools.workspace = true +derivative.workspace = true move-binary-format.workspace = true move-compiler.workspace = true diff --git a/external-crates/move/crates/move-package/src/compilation/build_plan.rs b/external-crates/move/crates/move-package/src/compilation/build_plan.rs index 6d30b45c2ef99..ee9535b1fca6d 100644 --- a/external-crates/move/crates/move-package/src/compilation/build_plan.rs +++ b/external-crates/move/crates/move-package/src/compilation/build_plan.rs @@ -4,12 +4,12 @@ use crate::{ compilation::compiled_package::CompiledPackage, - resolution::resolution_graph::Package, - resolution::resolution_graph::ResolvedGraph, + resolution::resolution_graph::{Package, ResolvedGraph}, source_package::{ manifest_parser::{resolve_move_manifest_path, EDITION_NAME, PACKAGE_NAME}, parsed_manifest::PackageName, }, + BuildInfo, }; use anyhow::Result; use move_compiler::{ @@ -18,6 +18,7 @@ use move_compiler::{ report_diagnostics_to_color_buffer, report_warnings, FilesSourceText, Migration, }, editions::Edition, + shared::FileReader, Compiler, }; use std::{ @@ -33,11 +34,11 @@ use super::{ package_layout::CompiledPackageLayout, }; -#[derive(Debug, Clone)] pub struct BuildPlan { root: PackageName, sorted_deps: Vec, resolution_graph: ResolvedGraph, + file_reader: Option>, } struct CompilationDependencies<'a> { @@ -47,7 +48,10 @@ struct CompilationDependencies<'a> { } impl BuildPlan { - pub fn create(resolution_graph: ResolvedGraph) -> Result { + pub fn create( + resolution_graph: ResolvedGraph, + file_reader: Option>, + ) -> Result { let mut sorted_deps = resolution_graph.topological_order(); sorted_deps.reverse(); @@ -55,6 +59,7 @@ impl BuildPlan { root: resolution_graph.root_package(), sorted_deps, resolution_graph, + file_reader, }) } @@ -67,24 +72,32 @@ impl BuildPlan { } /// Compilation results in the process exit upon warning/failure - pub fn compile(&self, writer: &mut W) -> Result { + pub fn compile(&mut self, writer: &mut W) -> Result { self.compile_with_driver(writer, |compiler| compiler.build_and_report()) } /// Compilation results in the process exit upon warning/failure - pub fn migrate(&self, writer: &mut W) -> Result> { - let CompilationDependencies { - root_package, - project_root, - transitive_dependencies, - } = self.compute_dependencies(); + pub fn migrate(&mut self, writer: &mut W) -> Result> { + let root_module = self.root; + let contains_renaming = self.resolution_graph.contains_renaming(); + let ( + CompilationDependencies { + root_package, + project_root, + transitive_dependencies, + }, + file_reader, + build_info, + ) = self.compute_dependencies(); let (_, migration) = CompiledPackage::build_for_result( writer, root_package, transitive_dependencies, - &self.resolution_graph, - |compiler| compiler.generate_migration_patch(&self.root), + build_info, + contains_renaming, + file_reader, + |compiler| compiler.generate_migration_patch(&root_module), )?; Self::clean( @@ -95,7 +108,7 @@ impl BuildPlan { } /// Compilation process does not exit even if warnings/failures are encountered - pub fn compile_no_exit(&self, writer: &mut W) -> Result { + pub fn compile_no_exit(&mut self, writer: &mut W) -> Result { self.compile_with_driver(writer, |compiler| { let (files, units_res) = compiler.build()?; match units_res { @@ -115,7 +128,13 @@ impl BuildPlan { }) } - fn compute_dependencies(&self) -> CompilationDependencies { + fn compute_dependencies( + &mut self, + ) -> ( + CompilationDependencies, + Option>, + &BuildInfo, + ) { let root_package = &self.resolution_graph.package_table[&self.root]; let project_root = match &self.resolution_graph.build_options.install_dir { Some(under_path) => under_path.clone(), @@ -161,33 +180,46 @@ impl BuildPlan { }) .collect(); - CompilationDependencies { - root_package: root_package.clone(), - project_root, - transitive_dependencies, - } + let file_reader = std::mem::take(&mut self.file_reader); + + ( + CompilationDependencies { + root_package: root_package.clone(), + project_root, + transitive_dependencies, + }, + file_reader, + &self.resolution_graph.build_options, + ) } pub fn compile_with_driver( - &self, + &mut self, writer: &mut W, mut compiler_driver: impl FnMut( Compiler, ) -> anyhow::Result<(FilesSourceText, Vec)>, ) -> Result { - let CompilationDependencies { - root_package, - project_root, - transitive_dependencies, - } = self.compute_dependencies(); + let contains_renaming = self.resolution_graph.contains_renaming(); + let ( + CompilationDependencies { + root_package, + project_root, + transitive_dependencies, + }, + file_reader, + build_info, + ) = self.compute_dependencies(); let compiled = CompiledPackage::build_all( writer, &project_root, root_package, transitive_dependencies, - &self.resolution_graph, + build_info, + contains_renaming, + file_reader, &mut compiler_driver, )?; diff --git a/external-crates/move/crates/move-package/src/compilation/compiled_package.rs b/external-crates/move/crates/move-package/src/compilation/compiled_package.rs index df1d4d5ef01c3..b15d17059224b 100644 --- a/external-crates/move/crates/move-package/src/compilation/compiled_package.rs +++ b/external-crates/move/crates/move-package/src/compilation/compiled_package.rs @@ -9,7 +9,7 @@ use crate::{ layout::{SourcePackageLayout, REFERENCE_TEMPLATE_FILENAME}, parsed_manifest::{FileName, PackageDigest, PackageName}, }, - BuildConfig, + BuildInfo, }; use anyhow::{ensure, Result}; use colored::Colorize; @@ -28,7 +28,7 @@ use move_compiler::{ compiled_unit::{AnnotatedCompiledUnit, CompiledUnit, NamedCompiledModule}, diagnostics::FilesSourceText, editions::Flavor, - shared::{NamedAddressMap, NumericalAddress, PackageConfig, PackagePaths}, + shared::{FileReader, NamedAddressMap, NumericalAddress, PackageConfig, PackagePaths}, sui_mode::linters::{known_filters, linter_visitors}, Compiler, }; @@ -68,7 +68,7 @@ pub struct CompiledPackageInfo { /// package is not available/this package was not compiled. pub source_digest: Option, /// The build flags that were used when compiling this package. - pub build_flags: BuildConfig, + pub build_flags: BuildInfo, } /// Represents a compiled package in memory. @@ -270,8 +270,8 @@ impl OnDiskCompiledPackage { } #[allow(unused)] - pub(crate) fn are_build_flags_different(&self, build_config: &BuildConfig) -> bool { - build_config != &self.package.compiled_package_info.build_flags + pub(crate) fn are_build_flags_different(&self, build_info: &BuildInfo) -> bool { + build_info != &self.package.compiled_package_info.build_flags } fn get_compiled_units_paths(&self, package_name: Symbol) -> Result> { @@ -436,7 +436,9 @@ impl CompiledPackage { w: &mut W, resolved_package: Package, transitive_dependencies: Vec, - resolution_graph: &ResolvedGraph, + build_info: &BuildInfo, + contains_renaming: Option, + file_reader: Option>, mut compiler_driver: impl FnMut(Compiler) -> Result, ) -> Result> { let immediate_dependencies = transitive_dependencies @@ -452,11 +454,11 @@ impl CompiledPackage { // gather source/dep files with their address mappings let (sources_package_paths, deps_package_paths) = make_source_and_deps_for_compiler( - resolution_graph, + build_info, &resolved_package, transitive_dependencies, )?; - let flags = resolution_graph.build_options.compiler_flags(); + let flags = build_info.compiler_flags(); // Partition deps_package according whether src is available let (src_deps, bytecode_deps): (Vec<_>, Vec<_>) = deps_package_paths .clone() @@ -467,7 +469,7 @@ impl CompiledPackage { }); // If bytecode dependency is not empty, do not allow renaming if !bytecode_deps.is_empty() { - if let Some(pkg_name) = resolution_graph.contains_renaming() { + if let Some(pkg_name) = contains_renaming { anyhow::bail!( "Found address renaming in package '{}' when \ building with bytecode dependencies -- this is currently not supported", @@ -480,15 +482,17 @@ impl CompiledPackage { let mut paths = src_deps; paths.push(sources_package_paths.clone()); - let lint = !resolution_graph.build_options.no_lint; - let sui_mode = resolution_graph - .build_options + let lint = !build_info.no_lint; + let sui_mode = build_info .default_flavor .map_or(false, |f| f == Flavor::Sui); let mut compiler = Compiler::from_package_paths(paths, bytecode_deps) .unwrap() .set_flags(flags); + if let Some(file_reader) = file_reader { + compiler = compiler.set_file_reader(file_reader); + } if sui_mode { let (filter_attr_name, filters) = known_filters(); compiler = compiler.add_custom_known_filters(filter_attr_name, filters); @@ -509,14 +513,18 @@ impl CompiledPackage { w: &mut W, resolved_package: Package, transitive_dependencies: Vec, - resolution_graph: &ResolvedGraph, + build_info: &BuildInfo, + contains_renaming: Option, + file_reader: Option>, compiler_driver: impl FnMut(Compiler) -> Result, ) -> Result { let build_result = Self::build_for_driver( w, resolved_package, transitive_dependencies, - resolution_graph, + build_info, + contains_renaming, + file_reader, compiler_driver, )?; Ok(build_result.result) @@ -527,7 +535,9 @@ impl CompiledPackage { project_root: &Path, resolved_package: Package, transitive_dependencies: Vec, - resolution_graph: &ResolvedGraph, + build_info: &BuildInfo, + contains_renaming: Option, + file_reader: Option>, compiler_driver: impl FnMut(Compiler) -> Result<(FilesSourceText, Vec)>, ) -> Result { let BuildResult { @@ -540,7 +550,9 @@ impl CompiledPackage { w, resolved_package.clone(), transitive_dependencies, - resolution_graph, + build_info, + contains_renaming, + file_reader, compiler_driver, )?; let (file_map, all_compiled_units) = result; @@ -561,7 +573,7 @@ impl CompiledPackage { } let mut compiled_docs = None; - if resolution_graph.build_options.generate_docs { + if build_info.generate_docs { let model = run_model_builder_with_options( vec![sources_package_paths], deps_package_paths.into_iter().map(|(p, _)| p).collect_vec(), @@ -569,13 +581,13 @@ impl CompiledPackage { None, )?; - if resolution_graph.build_options.generate_docs { + if build_info.generate_docs { compiled_docs = Some(Self::build_docs( resolved_package.source_package.package.name, &model, &resolved_package.package_path, &immediate_dependencies, - &resolution_graph.build_options.install_dir, + &build_info.install_dir, )); } }; @@ -585,7 +597,7 @@ impl CompiledPackage { package_name: resolved_package.source_package.package.name, address_alias_instantiation: resolved_package.resolved_table, source_digest: Some(resolved_package.source_digest), - build_flags: resolution_graph.build_options.clone(), + build_flags: build_info.clone(), }, root_compiled_units, deps_compiled_units, @@ -792,7 +804,7 @@ pub(crate) fn apply_named_address_renaming( } pub(crate) fn make_source_and_deps_for_compiler( - resolution_graph: &ResolvedGraph, + build_info: &BuildInfo, root: &Package, deps: Vec, ) -> Result<( @@ -824,14 +836,11 @@ pub(crate) fn make_source_and_deps_for_compiler( named_address_mapping_for_compiler(&root.resolved_table), &root.renaming, ); - let sources = root.get_sources(&resolution_graph.build_options)?; + let sources = root.get_sources(build_info)?; let source_package_paths = PackagePaths { name: Some(( root.source_package.package.name, - root.compiler_config( - /* is_dependency */ false, - &resolution_graph.build_options, - ), + root.compiler_config(/* is_dependency */ false, build_info), )), paths: sources, named_address_map: root_named_addrs, diff --git a/external-crates/move/crates/move-package/src/compilation/model_builder.rs b/external-crates/move/crates/move-package/src/compilation/model_builder.rs index a953556499fae..35d7459bf7ad8 100644 --- a/external-crates/move/crates/move-package/src/compilation/model_builder.rs +++ b/external-crates/move/crates/move-package/src/compilation/model_builder.rs @@ -32,7 +32,7 @@ impl ModelBuilder { // across all packages and build the Move model from that. // TODO: In the future we will need a better way to do this to support renaming in packages // where we want to support building a Move model. - pub fn build_model(&self) -> Result { + pub fn build_model(&mut self) -> Result { // Make sure no renamings have been performed if let Some(pkg_name) = self.resolution_graph.contains_renaming() { anyhow::bail!( @@ -83,7 +83,7 @@ impl ModelBuilder { .collect::>>()?; let (target, deps) = make_source_and_deps_for_compiler( - &self.resolution_graph, + &self.resolution_graph.build_options, &root_package, deps_source_info, )?; diff --git a/external-crates/move/crates/move-package/src/lib.rs b/external-crates/move/crates/move-package/src/lib.rs index 29147e0ecb3b8..73f2698cc22fc 100644 --- a/external-crates/move/crates/move-package/src/lib.rs +++ b/external-crates/move/crates/move-package/src/lib.rs @@ -13,9 +13,11 @@ pub mod source_package; use anyhow::Result; use clap::*; +use derivative::*; use lock_file::LockFile; use move_compiler::{ editions::{Edition, Flavor}, + shared::{FileReader, FileSystemFileReader}, Flags, }; use move_core_types::account_address::AccountAddress; @@ -37,9 +39,26 @@ use crate::{ package_lock::PackageLock, }; -#[derive(Debug, Parser, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Default)] +#[allow(clippy::non_canonical_partial_ord_impl)] +#[derive(Derivative, Parser, Serialize, Deserialize, Default)] +#[derivative(Debug, Eq, PartialEq, PartialOrd, Clone)] #[clap(about)] pub struct BuildConfig { + #[structopt(flatten)] + pub build_info: BuildInfo, + + /// Optional source file reader + #[clap(skip)] + #[serde(skip_deserializing, skip_serializing)] + #[derivative(PartialEq = "ignore")] + #[derivative(PartialOrd = "ignore")] + #[derivative(Debug = "ignore")] + #[derivative(Clone(clone_with = "clone_file_reader"))] + pub file_reader: Option>, +} + +#[derive(Debug, Parser, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Default)] +pub struct BuildInfo { /// Compile in 'dev' mode. The 'dev-addresses' and 'dev-dependencies' fields will be used if /// this flag is set. This flag is useful for development of packages that expose named /// addresses that are not set to a specific value. @@ -105,6 +124,12 @@ pub struct BuildConfig { pub no_lint: bool, } +/// Does not really do cloning - it's implemented to make Serde happy but the field itself +/// will be either way ignored during cloning. +fn clone_file_reader(_: &Option>) -> Option> { + None +} + #[derive(Debug, Clone, Eq, PartialEq, PartialOrd)] pub struct ModelConfig { /// If set, also files which are in dependent packages are considered as targets. @@ -116,25 +141,64 @@ pub struct ModelConfig { pub const NEEDS_MIGRATION: &str = "NO_ROOT_CRATE_EDITION"; +impl BuildInfo { + pub fn update_lock_file_toolchain_version( + &self, + path: &PathBuf, + compiler_version: String, + ) -> Result<()> { + let Some(lock_file) = self.lock_file.as_ref() else { + return Ok(()); + }; + let install_dir = self.install_dir.as_ref().unwrap_or(path).to_owned(); + let mut lock = LockFile::from(install_dir, lock_file)?; + lock.seek(SeekFrom::Start(0))?; + update_compiler_toolchain( + &mut lock, + compiler_version, + self.default_edition.unwrap_or_default(), + self.default_flavor.unwrap_or_default(), + )?; + let _mutx = PackageLock::lock(); + lock.commit(lock_file)?; + Ok(()) + } + + pub fn compiler_flags(&self) -> Flags { + let flags = if self.test_mode { + Flags::testing() + } else { + Flags::empty() + }; + flags + .set_warnings_are_errors(self.warnings_are_errors) + .set_silence_warnings(self.silence_warnings) + } +} + impl BuildConfig { /// Compile the package at `path` or the containing Move package. Exit process on warning or /// failure. - pub fn compile_package(self, path: &Path, writer: &mut W) -> Result { + pub fn compile_package( + mut self, + path: &Path, + writer: &mut W, + ) -> Result { let resolved_graph = self.resolution_graph_for_package(path, writer)?; let _mutx = PackageLock::lock(); // held until function returns - BuildPlan::create(resolved_graph)?.compile(writer) + BuildPlan::create(resolved_graph, None)?.compile(writer) } /// Compile the package at `path` or the containing Move package. Exit process on warning or /// failure. Will trigger migration if the package is missing an edition. pub fn cli_compile_package( - self, + mut self, path: &Path, writer: &mut W, ) -> Result { let resolved_graph = self.resolution_graph_for_package(path, writer)?; let _mutx = PackageLock::lock(); // held until function returns - let build_plan = BuildPlan::create(resolved_graph)?; + let mut build_plan = BuildPlan::create(resolved_graph, None)?; // TODO: When we are ready to release and enable automatic migration, uncomment this. // if !build_plan.root_crate_edition_defined() { // Err(anyhow::format_err!(NEEDS_MIGRATION)) @@ -147,26 +211,26 @@ impl BuildConfig { /// Compile the package at `path` or the containing Move package. Do not exit process on warning /// or failure. pub fn compile_package_no_exit( - self, + mut self, path: &Path, writer: &mut W, ) -> Result { let resolved_graph = self.resolution_graph_for_package(path, writer)?; let _mutx = PackageLock::lock(); // held until function returns - BuildPlan::create(resolved_graph)?.compile_no_exit(writer) + BuildPlan::create(resolved_graph, None)?.compile_no_exit(writer) } /// Compile the package at `path` or the containing Move package. Exit process on warning or /// failure. pub fn migrate_package( - self, + mut self, path: &Path, writer: &mut W, reader: &mut R, ) -> Result<()> { let resolved_graph = self.resolution_graph_for_package(path, writer)?; let _mutx = PackageLock::lock(); // held until function returns - let build_plan = BuildPlan::create(resolved_graph)?; + let build_plan = BuildPlan::create(resolved_graph, None)?; migration::migrate(build_plan, writer, reader)?; Ok(()) } @@ -177,7 +241,7 @@ impl BuildConfig { // TODO: In the future we will need a better way to do this to support renaming in packages // where we want to support building a Move model. pub fn move_model_for_package( - self, + mut self, path: &Path, model_config: ModelConfig, ) -> Result { @@ -188,11 +252,22 @@ impl BuildConfig { ModelBuilder::create(resolved_graph, model_config).build_model() } - pub fn download_deps_for_package(&self, path: &Path, writer: &mut W) -> Result<()> { + pub fn download_deps_for_package( + &mut self, + path: &Path, + writer: &mut W, + ) -> Result<()> { let path = SourcePackageLayout::try_find_root(path)?; - let manifest_string = - std::fs::read_to_string(path.join(SourcePackageLayout::Manifest.path()))?; - let lock_string = std::fs::read_to_string(path.join(SourcePackageLayout::Lock.path())).ok(); + let mut manifest_string = String::new(); + self.read_to_string( + &path.join(SourcePackageLayout::Manifest.path()), + &mut manifest_string, + )?; + let mut buf = String::new(); + let lock_string = self + .read_to_string(&path.join(SourcePackageLayout::Lock.path()), &mut buf) + .ok() + .map(|_| buf); let _mutx = PackageLock::lock(); // held until function returns resolution::download_dependency_repos(manifest_string, lock_string, self, &path, writer)?; @@ -200,26 +275,40 @@ impl BuildConfig { } pub fn resolution_graph_for_package( - mut self, + &mut self, path: &Path, writer: &mut W, ) -> Result { - if self.test_mode { - self.dev_mode = true; + if self.build_info.test_mode { + self.build_info.dev_mode = true; } let path = SourcePackageLayout::try_find_root(path)?; - let manifest_string = - std::fs::read_to_string(path.join(SourcePackageLayout::Manifest.path()))?; - let lock_string = std::fs::read_to_string(path.join(SourcePackageLayout::Lock.path())).ok(); + let mut manifest_string = String::new(); + self.read_to_string( + &path.join(SourcePackageLayout::Manifest.path()), + &mut manifest_string, + )?; + let mut buf = String::new(); + let lock_string = self + .read_to_string(&path.join(SourcePackageLayout::Lock.path()), &mut buf) + .ok() + .map(|_| buf); let _mutx = PackageLock::lock(); // held until function returns - let install_dir_set = self.install_dir.is_some(); - let install_dir = self.install_dir.as_ref().unwrap_or(&path).to_owned(); + let install_dir_set = self.build_info.install_dir.is_some(); + let install_dir = self + .build_info + .install_dir + .as_ref() + .unwrap_or(&path) + .to_owned(); + let file_reader = std::mem::take(&mut self.file_reader); let mut dep_graph_builder = DependencyGraphBuilder::new( - self.skip_fetch_latest_git_deps, + self.build_info.skip_fetch_latest_git_deps, writer, install_dir.clone(), + file_reader, ); let (dependency_graph, modified) = dep_graph_builder.get_graph( &DependencyKind::default(), @@ -227,12 +316,12 @@ impl BuildConfig { manifest_string, lock_string, )?; - + self.file_reader = std::mem::take(&mut dep_graph_builder.file_reader); if modified || install_dir_set { // (1) Write the Move.lock file if the existing one is `modified`, or // (2) `install_dir` is set explicitly, which may be a different directory, and where a Move.lock does not exist yet. let lock = dependency_graph.write_to_lock(install_dir)?; - if let Some(lock_path) = &self.lock_file { + if let Some(lock_path) = &self.build_info.lock_file { lock.commit(lock_path)?; } } @@ -251,36 +340,10 @@ impl BuildConfig { ) } - pub fn compiler_flags(&self) -> Flags { - let flags = if self.test_mode { - Flags::testing() - } else { - Flags::empty() - }; - flags - .set_warnings_are_errors(self.warnings_are_errors) - .set_silence_warnings(self.silence_warnings) - } - - pub fn update_lock_file_toolchain_version( - &self, - path: &PathBuf, - compiler_version: String, - ) -> Result<()> { - let Some(lock_file) = self.lock_file.as_ref() else { - return Ok(()); - }; - let install_dir = self.install_dir.as_ref().unwrap_or(path).to_owned(); - let mut lock = LockFile::from(install_dir, lock_file)?; - lock.seek(SeekFrom::Start(0))?; - update_compiler_toolchain( - &mut lock, - compiler_version, - self.default_edition.unwrap_or_default(), - self.default_flavor.unwrap_or_default(), - )?; - let _mutx = PackageLock::lock(); - lock.commit(lock_file)?; - Ok(()) + pub fn read_to_string(&mut self, fpath: &Path, buf: &mut String) -> std::io::Result { + match self.file_reader.as_mut() { + Some(reader) => reader.read_to_string(fpath, buf), + None => FileSystemFileReader.read_to_string(fpath, buf), + } } } diff --git a/external-crates/move/crates/move-package/src/resolution/dependency_graph.rs b/external-crates/move/crates/move-package/src/resolution/dependency_graph.rs index 2476692df2545..0a3b565d4d0f9 100644 --- a/external-crates/move/crates/move-package/src/resolution/dependency_graph.rs +++ b/external-crates/move/crates/move-package/src/resolution/dependency_graph.rs @@ -3,12 +3,12 @@ use anyhow::{bail, Context, Result}; use colored::Colorize; +use move_compiler::shared::{FileReader, FileSystemFileReader}; use move_symbol_pool::Symbol; use petgraph::{algo, prelude::DiGraphMap, Direction}; use std::{ collections::{btree_map::Entry, BTreeMap, BTreeSet, VecDeque}, fmt, - fs::File, io::{BufWriter, Read, Write}, path::{Path, PathBuf}, process::Command, @@ -196,6 +196,8 @@ pub struct DependencyGraphBuilder { visited_dependencies: VecDeque<(PackageIdentifier, PM::InternalDependency)>, /// Installation directory for compiled artifacts (from BuildConfig). install_dir: PathBuf, + /// Optional file reader + pub file_reader: Option>, } impl DependencyGraphBuilder { @@ -203,12 +205,14 @@ impl DependencyGraphBuilder { skip_fetch_latest_git_deps: bool, progress_output: Progress, install_dir: PathBuf, + file_reader: Option>, ) -> Self { DependencyGraphBuilder { dependency_cache: DependencyCache::new(skip_fetch_latest_git_deps), progress_output, visited_dependencies: VecDeque::new(), install_dir, + file_reader, } } @@ -228,13 +232,13 @@ impl DependencyGraphBuilder { // compute digests eagerly as even if we can't reuse existing lock file, they need to become // part of the newly computed dependency graph let new_manifest_digest = digest_str(manifest_string.into_bytes().as_slice()); - let lock_path = root_path.join(SourcePackageLayout::Lock.path()); - let lock_file = File::open(lock_path); - let digest_and_lock_contents = lock_file - .map(|mut lock_file| match schema::Header::read(&mut lock_file) { - Ok(header) => Some((header.manifest_digest, header.deps_digest, lock_string_opt)), - Err(_) => None, // malformed header - regenerate lock file - }) + let digest_and_lock_contents = lock_string_opt + .map( + |lock_string| match schema::Header::read(&mut lock_string.as_bytes()) { + Ok(header) => Some((header.manifest_digest, header.deps_digest, lock_string)), + Err(_) => None, // malformed header - regenerate lock file + }, + ) .unwrap_or(None); // collect sub-graphs for "regular" and "dev" dependencies @@ -274,7 +278,7 @@ impl DependencyGraphBuilder { .collect::>>()?; let new_deps_digest = self.dependency_digest(dep_lock_files, dev_dep_lock_files)?; let (manifest_digest, deps_digest) = match digest_and_lock_contents { - Some((old_manifest_digest, old_deps_digest, Some(lock_string))) + Some((old_manifest_digest, old_deps_digest, lock_string)) if old_manifest_digest == new_manifest_digest && old_deps_digest == new_deps_digest => { @@ -440,11 +444,17 @@ impl DependencyGraphBuilder { .download_and_update_if_remote(dep_pkg_name, &d.kind, &mut self.progress_output) .with_context(|| format!("Fetching '{}'", dep_pkg_name))?; let pkg_path = dep_pkg_path.join(local_path(&d.kind)); - let manifest_string = - std::fs::read_to_string(pkg_path.join(SourcePackageLayout::Manifest.path())) - .with_context(|| format!("Parsing manifest for '{}'", dep_pkg_name))?; - let lock_string = - std::fs::read_to_string(pkg_path.join(SourcePackageLayout::Lock.path())).ok(); + let mut manifest_string = String::new(); + self.read_to_string( + &pkg_path.join(SourcePackageLayout::Manifest.path()), + &mut manifest_string, + ) + .with_context(|| format!("Parsing manifest for '{}'", dep_pkg_name))?; + let mut buf = String::new(); + let lock_string = self + .read_to_string(&pkg_path.join(SourcePackageLayout::Lock.path()), &mut buf) + .ok() + .map(|_| buf); // resolve name and version let manifest = @@ -540,6 +550,13 @@ impl DependencyGraphBuilder { Ok(hashed_files_digest(dep_hashes)) } } + + pub fn read_to_string(&mut self, fpath: &Path, buf: &mut String) -> std::io::Result { + match self.file_reader.as_mut() { + Some(reader) => reader.read_to_string(fpath, buf), + None => FileSystemFileReader.read_to_string(fpath, buf), + } + } } impl DependencyGraph { diff --git a/external-crates/move/crates/move-package/src/resolution/mod.rs b/external-crates/move/crates/move-package/src/resolution/mod.rs index 2fbd3959e7850..937d2d8631ec4 100644 --- a/external-crates/move/crates/move-package/src/resolution/mod.rs +++ b/external-crates/move/crates/move-package/src/resolution/mod.rs @@ -25,19 +25,22 @@ pub mod resolving_table; pub fn download_dependency_repos( manifest_string: String, lock_string: Option, - build_options: &BuildConfig, + build_options: &mut BuildConfig, root_path: &Path, progress_output: &mut Progress, ) -> Result<()> { let install_dir = build_options + .build_info .install_dir .as_ref() .unwrap_or(&root_path.to_path_buf()) .to_owned(); + let file_reader = std::mem::take(&mut build_options.file_reader); let mut dep_graph_builder = DependencyGraphBuilder::new( - build_options.skip_fetch_latest_git_deps, + build_options.build_info.skip_fetch_latest_git_deps, progress_output, install_dir, + file_reader, ); let (graph, _) = dep_graph_builder.get_graph( &DependencyKind::default(), @@ -45,13 +48,14 @@ pub fn download_dependency_repos( manifest_string, lock_string, )?; + build_options.file_reader = std::mem::take(&mut dep_graph_builder.file_reader); for pkg_id in graph.topological_order() { if pkg_id == graph.root_package_id { continue; } - if !(build_options.dev_mode || graph.always_deps.contains(&pkg_id)) { + if !(build_options.build_info.dev_mode || graph.always_deps.contains(&pkg_id)) { continue; } diff --git a/external-crates/move/crates/move-package/src/resolution/resolution_graph.rs b/external-crates/move/crates/move-package/src/resolution/resolution_graph.rs index 3401bafa37e6f..a85b5cf5b4025 100644 --- a/external-crates/move/crates/move-package/src/resolution/resolution_graph.rs +++ b/external-crates/move/crates/move-package/src/resolution/resolution_graph.rs @@ -4,7 +4,7 @@ use anyhow::{bail, Context, Result}; use move_command_line_common::files::{ - extension_equals, find_filenames, find_move_filenames, FileHash, MOVE_COMPILED_EXTENSION, + extension_equals, find_filenames, find_move_filenames, MOVE_COMPILED_EXTENSION, }; use move_compiler::command_line::DEFAULT_OUTPUT_DIR; use move_compiler::{diagnostics::WarningFilters, shared::PackageConfig}; @@ -12,7 +12,6 @@ use move_core_types::account_address::AccountAddress; use move_symbol_pool::Symbol; use std::{ collections::{BTreeMap, BTreeSet}, - fs, io::Write, path::{Path, PathBuf}, }; @@ -28,7 +27,7 @@ use crate::{ FileName, NamedAddress, PackageDigest, PackageName, SourceManifest, SubstOrRename, }, }, - BuildConfig, + BuildConfig, BuildInfo, }; use super::{ @@ -50,7 +49,7 @@ use super::{ pub struct ResolvedGraph { pub graph: DG::DependencyGraph, /// Build options - pub build_options: BuildConfig, + pub build_options: BuildInfo, /// A mapping of package name to its resolution pub package_table: PackageTable, } @@ -77,14 +76,14 @@ pub struct Package { impl ResolvedGraph { pub fn resolve( graph: DG::DependencyGraph, - build_options: BuildConfig, + build_options: &mut BuildConfig, dependency_cache: &mut DependencyCache, progress_output: &mut Progress, ) -> Result { let mut package_table = PackageTable::new(); let mut resolving_table = ResolvingTable::new(); - let dep_mode = if build_options.dev_mode { + let dep_mode = if build_options.build_info.dev_mode { DG::DependencyMode::DevOnly } else { DG::DependencyMode::Always @@ -94,7 +93,7 @@ impl ResolvedGraph { // dependencies get resolved before it does. for pkg_id in graph.topological_order().into_iter().rev() { // Skip dev-mode packages if not in dev-mode. - if !(build_options.dev_mode || graph.always_deps.contains(&pkg_id)) { + if !(build_options.build_info.dev_mode || graph.always_deps.contains(&pkg_id)) { continue; } @@ -109,7 +108,7 @@ impl ResolvedGraph { graph.root_path.join(local_path(&pkg.kind)) }; - let mut resolved_pkg = Package::new(package_path, &build_options) + let mut resolved_pkg = Package::new(package_path, build_options) .with_context(|| format!("Resolving package '{pkg_id}'"))?; // Check dependencies package names from manifest are consistent with ther names @@ -155,7 +154,7 @@ impl ResolvedGraph { } // Add additional addresses to all package resolution tables. - for (name, addr) in &build_options.additional_named_addresses { + for (name, addr) in &build_options.build_info.additional_named_addresses { let name = NamedAddress::from(name.as_str()); for pkg in package_table.keys() { resolving_table @@ -169,7 +168,7 @@ impl ResolvedGraph { let root_package = &package_table[&graph.root_package_id]; // Add dev addresses, but only for the root package - if build_options.dev_mode { + if build_options.build_info.dev_mode { let mut addr_to_name_mapping = BTreeMap::new(); for (name, addr) in resolving_table.bindings(graph.root_package_id) { if let Some(addr) = addr { @@ -248,7 +247,7 @@ impl ResolvedGraph { Ok(ResolvedGraph { graph, - build_options, + build_options: build_options.build_info.clone(), package_table, }) } @@ -309,23 +308,6 @@ impl ResolvedGraph { .into_iter() } - pub fn file_sources(&self) -> BTreeMap { - self.package_table - .iter() - .flat_map(|(_, rpkg)| { - rpkg.get_sources(&self.build_options) - .unwrap() - .iter() - .map(|fname| { - let contents = fs::read_to_string(fname.as_str()).unwrap(); - let fhash = FileHash::new(&contents); - (fhash, (*fname, contents)) - }) - .collect::>() - }) - .collect() - } - pub fn contains_renaming(&self) -> Option { // Make sure no renamings have been performed self.package_table @@ -492,8 +474,8 @@ impl Package { .collect() } - pub fn get_sources(&self, config: &BuildConfig) -> Result> { - let places_to_look = source_paths_for_config(&self.package_path, config); + pub fn get_sources(&self, build_info: &BuildInfo) -> Result> { + let places_to_look = source_paths_for_config(&self.package_path, build_info); Ok(find_move_filenames(&places_to_look, false)? .into_iter() .map(FileName::from) @@ -522,7 +504,7 @@ impl Package { pub(crate) fn compiler_config( &self, is_dependency: bool, - config: &BuildConfig, + build_info: &BuildInfo, ) -> PackageConfig { PackageConfig { is_dependency, @@ -530,20 +512,20 @@ impl Package { .source_package .package .flavor - .or(config.default_flavor) + .or(build_info.default_flavor) .unwrap_or_default(), edition: self .source_package .package .edition - .or(config.default_edition) + .or(build_info.default_edition) .unwrap_or_default(), warning_filter: WarningFilters::new_for_source(), } } } -fn source_paths_for_config(package_path: &Path, config: &BuildConfig) -> Vec { +fn source_paths_for_config(package_path: &Path, build_info: &BuildInfo) -> Vec { let mut places_to_look = Vec::new(); let mut add_path = |layout_path: SourcePackageLayout| { let path = package_path.join(layout_path.path()); @@ -556,7 +538,7 @@ fn source_paths_for_config(package_path: &Path, config: &BuildConfig) -> Vec Vec Result { - let mut source_paths = source_paths_for_config(package_path, config); + let mut source_paths = source_paths_for_config(package_path, &config.build_info); source_paths.push(package_path.join(SourcePackageLayout::Manifest.path())); compute_digest(&source_paths) } diff --git a/external-crates/move/crates/move-package/tests/package_hash_skips_non_move_files.rs b/external-crates/move/crates/move-package/tests/package_hash_skips_non_move_files.rs index 384bb0cf5d749..4e38a7e8e7b0a 100644 --- a/external-crates/move/crates/move-package/tests/package_hash_skips_non_move_files.rs +++ b/external-crates/move/crates/move-package/tests/package_hash_skips_non_move_files.rs @@ -2,7 +2,7 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use move_package::BuildConfig; +use move_package::{BuildConfig, BuildInfo}; use std::{io::Write, path::Path}; use tempfile::tempdir; @@ -14,8 +14,11 @@ fn package_hash_skips_non_move_files() { // passing a vector as the writer let pkg1 = BuildConfig { - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - ..Default::default() + build_info: BuildInfo { + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + ..Default::default() + }, + file_reader: None, } .resolution_graph_for_package(path, &mut Vec::new()) .unwrap(); @@ -27,8 +30,11 @@ fn package_hash_skips_non_move_files() { .unwrap(); let pkg2 = BuildConfig { - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - ..Default::default() + build_info: BuildInfo { + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + ..Default::default() + }, + file_reader: None, } .resolution_graph_for_package(path, &mut Vec::new()) .unwrap(); diff --git a/external-crates/move/crates/move-package/tests/test_additional_addresses.rs b/external-crates/move/crates/move-package/tests/test_additional_addresses.rs index acfb33bd1de3a..8265f17831bcb 100644 --- a/external-crates/move/crates/move-package/tests/test_additional_addresses.rs +++ b/external-crates/move/crates/move-package/tests/test_additional_addresses.rs @@ -6,7 +6,7 @@ use move_core_types::account_address::AccountAddress; use move_package::{ resolution::{dependency_graph as DG, resolution_graph as RG}, source_package::{layout::SourcePackageLayout, parsed_manifest as PM}, - BuildConfig, + BuildConfig, BuildInfo, }; use std::{collections::BTreeMap, path::PathBuf}; use tempfile::tempdir; @@ -28,6 +28,7 @@ fn test_additonal_addresses() { /* skip_fetch_latest_git_deps */ true, std::io::sink(), tempdir().unwrap().path().to_path_buf(), + /* file reader */ None, ); let (dg, _) = dep_graph_builder .get_graph( @@ -46,13 +47,16 @@ fn test_additonal_addresses() { assert!(RG::ResolvedGraph::resolve( dg.clone(), - BuildConfig { - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - additional_named_addresses: BTreeMap::from([( - "A".to_string(), - AccountAddress::from_hex_literal("0x1").unwrap() - )]), - ..Default::default() + &mut BuildConfig { + build_info: BuildInfo { + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + additional_named_addresses: BTreeMap::from([( + "A".to_string(), + AccountAddress::from_hex_literal("0x1").unwrap() + )]), + ..Default::default() + }, + file_reader: None, }, &mut dependency_cache, &mut progress_output, @@ -61,9 +65,12 @@ fn test_additonal_addresses() { assert!(RG::ResolvedGraph::resolve( dg, - BuildConfig { - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - ..Default::default() + &mut BuildConfig { + build_info: BuildInfo { + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + ..Default::default() + }, + file_reader: None, }, &mut dependency_cache, &mut progress_output, @@ -84,6 +91,7 @@ fn test_additonal_addresses_already_assigned_same_value() { /* skip_fetch_latest_git_deps */ true, std::io::sink(), tempdir().unwrap().path().to_path_buf(), + /* file reader */ None, ); let (dg, _) = dep_graph_builder .get_graph( @@ -102,13 +110,16 @@ fn test_additonal_addresses_already_assigned_same_value() { assert!(RG::ResolvedGraph::resolve( dg, - BuildConfig { - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - additional_named_addresses: BTreeMap::from([( - "A".to_string(), - AccountAddress::from_hex_literal("0x0").unwrap() - )]), - ..Default::default() + &mut BuildConfig { + build_info: BuildInfo { + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + additional_named_addresses: BTreeMap::from([( + "A".to_string(), + AccountAddress::from_hex_literal("0x0").unwrap() + )]), + ..Default::default() + }, + file_reader: None, }, &mut dependency_cache, &mut progress_output, @@ -129,6 +140,7 @@ fn test_additonal_addresses_already_assigned_different_value() { /* skip_fetch_latest_git_deps */ true, std::io::sink(), tempdir().unwrap().path().to_path_buf(), + /* file reader */ None, ); let (dg, _) = dep_graph_builder .get_graph( @@ -147,13 +159,16 @@ fn test_additonal_addresses_already_assigned_different_value() { assert!(RG::ResolvedGraph::resolve( dg, - BuildConfig { - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - additional_named_addresses: BTreeMap::from([( - "A".to_string(), - AccountAddress::from_hex_literal("0x1").unwrap() - )]), - ..Default::default() + &mut BuildConfig { + build_info: BuildInfo { + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + additional_named_addresses: BTreeMap::from([( + "A".to_string(), + AccountAddress::from_hex_literal("0x1").unwrap() + )]), + ..Default::default() + }, + file_reader: None, }, &mut dependency_cache, &mut progress_output, diff --git a/external-crates/move/crates/move-package/tests/test_dependency_graph.rs b/external-crates/move/crates/move-package/tests/test_dependency_graph.rs index 129fb92069782..8612d743c12c1 100644 --- a/external-crates/move/crates/move-package/tests/test_dependency_graph.rs +++ b/external-crates/move/crates/move-package/tests/test_dependency_graph.rs @@ -38,6 +38,7 @@ fn no_dep_graph() { /* skip_fetch_latest_git_deps */ true, std::io::sink(), tempfile::tempdir().unwrap().path().to_path_buf(), + /* file reader */ None, ); let (graph, _) = dep_graph_builder .get_graph( @@ -154,6 +155,7 @@ fn always_deps() { /* skip_fetch_latest_git_deps */ true, std::io::sink(), tempfile::tempdir().unwrap().path().to_path_buf(), + /* file reader */ None, ); let (graph, _) = dep_graph_builder .get_graph( @@ -563,6 +565,7 @@ fn immediate_dependencies() { /* skip_fetch_latest_git_deps */ true, std::io::sink(), tempfile::tempdir().unwrap().path().to_path_buf(), + /* file reader */ None, ); let (graph, _) = dep_graph_builder .get_graph( diff --git a/external-crates/move/crates/move-package/tests/test_lock_file.rs b/external-crates/move/crates/move-package/tests/test_lock_file.rs index f4428f560ff2f..b61ab9ea6e357 100644 --- a/external-crates/move/crates/move-package/tests/test_lock_file.rs +++ b/external-crates/move/crates/move-package/tests/test_lock_file.rs @@ -12,7 +12,7 @@ use tempfile::TempDir; use move_compiler::editions::{Edition, Flavor}; use move_package::lock_file::schema::ToolchainVersion; use move_package::lock_file::LockFile; -use move_package::BuildConfig; +use move_package::{BuildConfig, BuildInfo}; #[test] fn commit() { @@ -79,13 +79,17 @@ fn update_lock_file_toolchain_version() { lock.commit(&lock_path).unwrap(); let build_config = BuildConfig { - default_flavor: Some(Flavor::Sui), - default_edition: Some(Edition::E2024_ALPHA), - lock_file: Some(lock_path.clone()), - ..Default::default() + build_info: BuildInfo { + default_flavor: Some(Flavor::Sui), + default_edition: Some(Edition::E2024_ALPHA), + lock_file: Some(lock_path.clone()), + ..Default::default() + }, + file_reader: None, }; - let _ = - build_config.update_lock_file_toolchain_version(&pkg.path().to_path_buf(), "0.0.1".into()); + let _ = build_config + .build_info + .update_lock_file_toolchain_version(&pkg.path().to_path_buf(), "0.0.1".into()); let mut lock_file = File::open(lock_path).unwrap(); let toolchain_version = diff --git a/external-crates/move/crates/move-package/tests/test_removal_second_compilation.rs b/external-crates/move/crates/move-package/tests/test_removal_second_compilation.rs index 5e645615103b3..f68285c51dc59 100644 --- a/external-crates/move/crates/move-package/tests/test_removal_second_compilation.rs +++ b/external-crates/move/crates/move-package/tests/test_removal_second_compilation.rs @@ -2,7 +2,7 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use move_package::{compilation::package_layout::CompiledPackageLayout, BuildConfig}; +use move_package::{compilation::package_layout::CompiledPackageLayout, BuildConfig, BuildInfo}; use std::path::Path; use tempfile::tempdir; @@ -12,10 +12,13 @@ fn test_that_second_build_artifacts_removed() { let dir = tempdir().unwrap().path().to_path_buf(); BuildConfig { - dev_mode: true, - test_mode: true, - install_dir: Some(dir.clone()), - ..Default::default() + build_info: BuildInfo { + dev_mode: true, + test_mode: true, + install_dir: Some(dir.clone()), + ..Default::default() + }, + file_reader: None, } .compile_package(path, &mut Vec::new()) .unwrap(); @@ -37,10 +40,13 @@ fn test_that_second_build_artifacts_removed() { // Now make sure the MoveStdlib still exists, but that the test-only code is removed BuildConfig { - dev_mode: true, - test_mode: false, - install_dir: Some(dir.clone()), - ..Default::default() + build_info: BuildInfo { + dev_mode: true, + test_mode: false, + install_dir: Some(dir.clone()), + ..Default::default() + }, + file_reader: None, } .compile_package(path, &mut Vec::new()) .unwrap(); @@ -55,10 +61,13 @@ fn test_that_second_build_artifacts_removed() { .exists()); BuildConfig { - dev_mode: false, - test_mode: false, - install_dir: Some(dir.clone()), - ..Default::default() + build_info: BuildInfo { + dev_mode: false, + test_mode: false, + install_dir: Some(dir.clone()), + ..Default::default() + }, + file_reader: None, } .compile_package(path, &mut Vec::new()) .unwrap(); diff --git a/external-crates/move/crates/move-package/tests/test_runner.rs b/external-crates/move/crates/move-package/tests/test_runner.rs index cc4e562afffa4..0c374c9b86ff5 100644 --- a/external-crates/move/crates/move-package/tests/test_runner.rs +++ b/external-crates/move/crates/move-package/tests/test_runner.rs @@ -10,12 +10,10 @@ use move_package::{ compilation::{ build_plan::BuildPlan, compiled_package::CompiledPackageInfo, model_builder::ModelBuilder, }, - package_hooks, - package_hooks::PackageHooks, - package_hooks::PackageIdentifier, + package_hooks::{self, PackageHooks, PackageIdentifier}, resolution::resolution_graph::Package, source_package::parsed_manifest::{CustomDepInfo, PackageDigest, SourceManifest}, - BuildConfig, ModelConfig, + BuildConfig, BuildInfo, ModelConfig, }; use move_symbol_pool::Symbol; use std::{ @@ -120,16 +118,19 @@ impl Test<'_> { let out_path = self.output_dir.path().to_path_buf(); let lock_path = out_path.join("Move.lock"); - let config = BuildConfig { - dev_mode: true, - test_mode: false, - generate_docs: false, - install_dir: Some(out_path), - force_recompilation: false, - lock_file: ["locked", "notlocked"] - .contains(&ext) - .then(|| lock_path.clone()), - ..Default::default() + let mut config = BuildConfig { + build_info: BuildInfo { + dev_mode: true, + test_mode: false, + generate_docs: false, + install_dir: Some(out_path), + force_recompilation: false, + lock_file: ["locked", "notlocked"] + .contains(&ext) + .then(|| lock_path.clone()), + ..Default::default() + }, + file_reader: None, }; let mut progress = Vec::new(); @@ -147,7 +148,7 @@ impl Test<'_> { "notlocked" => "Lock file uncommitted\n".to_string(), "compiled" => { - let mut pkg = BuildPlan::create(resolved_package?)?.compile(&mut progress)?; + let mut pkg = BuildPlan::create(resolved_package?, None)?.compile(&mut progress)?; scrub_compiled_package(&mut pkg.compiled_package_info); format!("{:#?}\n", pkg.compiled_package_info) } @@ -179,7 +180,7 @@ impl Test<'_> { } } -fn scrub_build_config(config: &mut BuildConfig) { +fn scrub_build_config(config: &mut BuildInfo) { config.install_dir = Some(PathBuf::from("ELIDED_FOR_TEST")); config.lock_file = Some(PathBuf::from("ELIDED_FOR_TEST")); } diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled index da5a06a0b0d41..06b06d14930f6 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.compiled @@ -4,7 +4,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved index 32a4ab9bf6494..2d64eea42507b 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "919A5B078B47AD46674F36E1605578927D5BC4536A7646D78D1320A25DDD57CC", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled index f74fc3ee75168..78b0b7bfe16f5 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved index 76742c402135a..adec8fd05989c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_assigned/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "151286C56FC37AEF93D980A892F558C8EE65FBF062991BDF23C9FC88478D3648", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled index 80d7777d996c4..0344fbb14bae4 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved index 34c483a71e454..41438b606251b 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_address_not_assigned_with_dev_assignment/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "5FB1273C1E2450599D1BC004959D0340057A7B589D254601F2C4476F29B21D13", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled index 482fdae72d221..cb1c58379f372 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/basic_no_deps_test_mode/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved index 3e3114dae4e5a..f926ffd9d2f45 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/dep_dev_dep_diamond/Move.resolved @@ -102,7 +102,7 @@ ResolvedGraph { manifest_digest: "98BBCE8D1C29472825E598691218A0CBC5BDA1A56C4429F5C2311C245DEC28CE", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved index ab2cc659b1c11..f95405c667ebc 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/dep_good_digest/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "A4DB860CC2BC78C04706A7383CA52121876F87057538DF814C66F7EE6025E644", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled index 2ec55a75bcc20..bcffab5c48640 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.compiled @@ -7,7 +7,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved index 1f66433b1958f..f295ba7916f7c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_backflow_resolution/Move.resolved @@ -77,7 +77,7 @@ ResolvedGraph { manifest_digest: "4644801498736A1617863CD04105A53E729A60DBD4838D2F676196147E78C889", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved index 8fa567db7e906..f9037701e6eb2 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_dev_override_with_reg/Move.resolved @@ -83,7 +83,7 @@ ResolvedGraph { manifest_digest: "CB01A8B6F9859E70A0A5DA10F8547C13EDDD63E9EDF72E930DD37C8EFC41F3F3", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved index c7365127779ee..873920198e2c1 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_no_conflict/Move.resolved @@ -81,7 +81,7 @@ ResolvedGraph { manifest_digest: "B06FCED8E0EF6B62EC0B572DC233C0D70206B1C10EEDEA0403CA64AFBB3E439B", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved index 611f94801c355..504e727e8f03d 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override/Move.resolved @@ -87,7 +87,7 @@ ResolvedGraph { manifest_digest: "82E01E336DD3374BDC42CA355AB6ACA69E44DB65E36DC0A831F36B06F6832574", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved index 3a4095c82057e..cc620dddc93c7 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_external_override_root/Move.resolved @@ -103,7 +103,7 @@ ResolvedGraph { manifest_digest: "E1BD09BE802FCCF437672321DEBFD0C8000F9D4A0AC5E54ED432087ABACA9667", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved index 2b3b23b0819c6..28adfc3ce84a5 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_nested_override/Move.resolved @@ -129,7 +129,7 @@ ResolvedGraph { manifest_digest: "86DBE490660052E70AF19AEB6DB3CDFE90F770D67E008E12C753575AB346B43C", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved index 5ec67d801b9dc..c807391586dbd 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_override/Move.resolved @@ -85,7 +85,7 @@ ResolvedGraph { manifest_digest: "F64B7E3BA42923C4AFD7490B03D34813BA434044DC83D46F869DD5BB9A6052B2", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved index cb5a05130e1b1..b2a0c6567c7f9 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_transitive_nested_override/Move.resolved @@ -121,7 +121,7 @@ ResolvedGraph { manifest_digest: "B2F5516D0E0D7FC1D1A91EF42181BC28609979CA8D75F7EF01B473AF22303C1D", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved index ad736e52e9912..749ebd9014a70 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_two_nested_overrides/Move.resolved @@ -137,7 +137,7 @@ ResolvedGraph { manifest_digest: "88451CA3B87F330C2224714E02829B02787D5AEA4F9CCD9FF239ED0344CF0632", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved index 8f9125ae41a60..31d33850611f4 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dep_with_deps/Move.resolved @@ -137,7 +137,7 @@ ResolvedGraph { manifest_digest: "D91D5258B2367D3D997443497ADC70411B9936C70B2CFFEDB81466DD133BA63B", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved index 56b5a74cf6781..adefe7184d0a6 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_dual_override/Move.resolved @@ -137,7 +137,7 @@ ResolvedGraph { manifest_digest: "EE8E91AA52F0CF9E3BB13B169696C40E3F6E8EFBD9E612B06B124CD509CFCDB5", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled index 2ec55a75bcc20..bcffab5c48640 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.compiled @@ -7,7 +7,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved index 99183ce6071bd..4575ad29efa5c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_no_conflict/Move.resolved @@ -77,7 +77,7 @@ ResolvedGraph { manifest_digest: "2CE4CA7B1785FEAE60C59A993DB1182E09DB665E694C6104DF566E065752C030", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved index 8dcc57c2d6a7a..b47976e79cf84 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v1/Move.resolved @@ -113,7 +113,7 @@ ResolvedGraph { manifest_digest: "0A80C25B25B48880831BFCCC1EDF50CC05B33E5855777F8F119538F2FB7B7601", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved index cdcc7fa9a2cd4..b7e176f10553a 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/diamond_problem_with_and_without_override_v2/Move.resolved @@ -113,7 +113,7 @@ ResolvedGraph { manifest_digest: "29407D5EEB9708B0005BD2BB6ED487E03C55AA23B440DAB7A0C4F8588239D4F6", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved index 1fb81bb47aabe..f8171bcaf0094 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/direct_and_indirect_dep/Move.resolved @@ -77,7 +77,7 @@ ResolvedGraph { manifest_digest: "373B3598A66D05FBD7DE398D2F588C9C79C9F38757140E8717C1D851CBC5C15F", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved index 6d094b9e44db3..30918186f9d7f 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external/Move.resolved @@ -55,7 +55,7 @@ ResolvedGraph { manifest_digest: "8D09D19521F36950C0698F14ED09FE4F6175C022796F1E401F2F5A1BCA6FCE98", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved index 1080bb9e4d386..b87cc35b4b276 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external_dev_dep/Move.resolved @@ -93,7 +93,7 @@ ResolvedGraph { manifest_digest: "84A0B503BE9F9B341AC66860713D12704876E5C2425891E3B94626B12E4313E5", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved index 5e7a83fc192db..d6eab46569ab2 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/external_overlap/Move.resolved @@ -63,7 +63,7 @@ ResolvedGraph { manifest_digest: "2401A97D2FE979752E0726963BFC3F677A4FA8041F3C6FAE5A4302401B165463", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved index b0226c4f0ebca..346bc68409000 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock/Move.resolved @@ -51,7 +51,7 @@ ResolvedGraph { manifest_digest: "9DB26BA0BAD462FDDF65A0EDFF4C77DB02930DF5610D82F97B38FA6CC6EBEDA6", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved index f3c75471c123d..77c2d27e033ec 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_from_lock_no_manifest/Move.resolved @@ -51,7 +51,7 @@ ResolvedGraph { manifest_digest: "AA7756B3B213FDC25613CEA73598686AD82A71AE040693F919D582DE22C8FEF7", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved index c63c1797ca327..03e5867c9cb43 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename/Move.resolved @@ -51,7 +51,7 @@ ResolvedGraph { manifest_digest: "16BB782949D226228DAF21045B45585AD7D7C8F6468D6ED504C0B5302C9CA861", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled index 08b1283d09659..a3a3d136b9faf 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/multiple_deps_rename_one/Move.compiled @@ -8,7 +8,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_bad_parent/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_bad_parent/Move.resolved index 8096138d5fad7..b952cc88295db 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_bad_parent/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_bad_parent/Move.resolved @@ -1 +1 @@ -Failed to resolve dependencies for package 'NestedDeps': Parsing manifest for 'Nested': No such file or directory (os error 2) +Failed to resolve dependencies for package 'NestedDeps': Parsing manifest for 'Nested': No such file or directory (os error 2): "/Users/adamwelc/.move/_________ed613ee8e/language/tools/move-package/tests/test_sources/nested_deps_bad_parent/deps_only/nested/Move.toml" diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved index d50787f570a7d..0951c0706e698 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_git_local/Move.resolved @@ -59,7 +59,7 @@ ResolvedGraph { manifest_digest: "598DCC919F7378E59F328E1B448D1AAC70B8F34894146860B3ABF46600F9F79B", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved index 48ac0e0398e3f..65d1051c0434f 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_deps_shared_override/Move.resolved @@ -93,7 +93,7 @@ ResolvedGraph { manifest_digest: "5005BF461ECC5281FE314371B38D8C163C5395D7455B91BEA0F63C1BCFD57551", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved index 36aa8773b5fcd..987c781621702 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/nested_pruned_override/Move.resolved @@ -77,7 +77,7 @@ ResolvedGraph { manifest_digest: "0157AC19D24D39641693161A0A6A0A4E3C424C337419209BBCD31C7C8BC34D18", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled index 996a9186cb300..fed73349a1bea 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved index 216fed6658468..2506f44a5f04c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "0C66C2C067539518C3189E86B5A09D478C872C0F97ACE6D707AE9753319E56AA", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled index 996a9186cb300..fed73349a1bea 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved index 914b15d9dae7d..1ff11d647fb47 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_assigned_address/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "D1ED8F4323C1E149A29AEDE1E73EC97B117A39132914F088144621C5CD2E6059", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved index fdf5a57aaa72e..ac8a51771cd87 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_multiple_of_same_name/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "0C66C2C067539518C3189E86B5A09D478C872C0F97ACE6D707AE9753319E56AA", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled index 996a9186cb300..fed73349a1bea 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved index a0fbd25191061..2fdd4a88f7936 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_override/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "340302CAC58F9844D483E9F19F08D9578B90043E621D953A62A4B679F8D98896", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved index 48322687ad9ca..8a7d7bc04113f 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_reassigned_address/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "31285FC133B1449F5013BA29028EB9FD6518907FB5CC2EE4E6B601B4EB4D271D", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled index 996a9186cb300..fed73349a1bea 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_renamed/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved index c6b93fe439c5b..22ca19060f4f1 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_unification_across_local_renamings/Move.resolved @@ -33,7 +33,7 @@ ResolvedGraph { manifest_digest: "0C66C2C067539518C3189E86B5A09D478C872C0F97ACE6D707AE9753319E56AA", deps_digest: "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled index 996a9186cb300..fed73349a1bea 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/one_dep_with_scripts/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved index 6e7e518f9ee4a..475609fa0fb33 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_2024_alpha/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "ED0F3693A744272C975287D7B3CB4B7E9E1C186E2D68CC6858DAD286347D1F7B", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved index efeb30de6d7bf..d07ed2cc8d3b2 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_edition_legacy/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "7BE8C17517DC6FC0EF6A05842A149B6B552A270E4F1B29DA846E41718C4CAC4B", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved index 51aee89431a74..4c5f28b6da841 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_global_storage/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "4B5A39F0084184A337A86CB7E44DCB9DC4A42B22E8B9681B495B52A721B0B0B8", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved index fd39965ff75e9..a248ae8232383 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_flavor_sui/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "843626B76619D0C508D11EB76988677F42BF33AC853A0F44DA77BEAAF22AB355", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest/Move.resolved index c5dbceda420d6..df44bd655e334 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest/Move.resolved @@ -1 +1 @@ -Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2) +Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2): "tests/test_sources/parsing_full_manifest/../a/Move.toml" diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest_with_extra_field/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest_with_extra_field/Move.resolved index c5dbceda420d6..8427f91c1c12b 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest_with_extra_field/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_full_manifest_with_extra_field/Move.resolved @@ -1 +1 @@ -Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2) +Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2): "tests/test_sources/parsing_full_manifest_with_extra_field/../a/Move.toml" diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_hex_address_in_subst/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_hex_address_in_subst/Move.resolved index c5dbceda420d6..cbf21d5c470ed 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_hex_address_in_subst/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_hex_address_in_subst/Move.resolved @@ -1 +1 @@ -Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2) +Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2): "tests/test_sources/parsing_invalid_hex_address_in_subst/a/Move.toml" diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved index 908fbcaf2bef4..dc50411cc5aa3 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_invalid_identifier_package_name/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "D107C27F4F0CCCEA32AAA8A2CBCA3041764F6920DA7EEF69C4B0D55E4D80D5D6", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved index 3c9ad25a3b2d2..1084afebc64d6 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_minimal_manifest/Move.resolved @@ -13,7 +13,7 @@ ResolvedGraph { manifest_digest: "510F9FB59C4AEDBB7F7FF005B7DC3C7D67E78E0CB1ABB573DE635B21B4BD00B6", deps_digest: "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_non_identifier_address_name_in_subst/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_non_identifier_address_name_in_subst/Move.resolved index c5dbceda420d6..6f7dfd3a7840c 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_non_identifier_address_name_in_subst/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_non_identifier_address_name_in_subst/Move.resolved @@ -1 +1 @@ -Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2) +Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2): "tests/test_sources/parsing_non_identifier_address_name_in_subst/a/Move.toml" diff --git a/external-crates/move/crates/move-package/tests/test_sources/parsing_unknown_toplevel_field/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/parsing_unknown_toplevel_field/Move.resolved index c5dbceda420d6..e1f31fd139161 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/parsing_unknown_toplevel_field/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/parsing_unknown_toplevel_field/Move.resolved @@ -1 +1 @@ -Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2) +Failed to resolve dependencies for package 'name': Parsing manifest for 'A': No such file or directory (os error 2): "tests/test_sources/parsing_unknown_toplevel_field/../a/Move.toml" diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled index c35c4297f3a8f..c1ac99e09ee20 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.compiled @@ -7,7 +7,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved index 54bda1cdcfb04..86bb83e5e3067 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name/Move.resolved @@ -77,7 +77,7 @@ ResolvedGraph { manifest_digest: "6F18190939664D7ECC8F2DC327E079037A743E0CFF3FA5F72DABD2B6B5C3D200", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved index 5bf7a7a6e7808..083967a01dc56 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_pkg_name_override/Move.resolved @@ -85,7 +85,7 @@ ResolvedGraph { manifest_digest: "6C8AB032D245517996BC9E218500AF7471360346649D91F8858488AF631742A8", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved index 583a9eab1ac58..eb5008a8e7fe0 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version/Move.resolved @@ -55,7 +55,7 @@ ResolvedGraph { manifest_digest: "A152DBB11C386226B7A6435D66090103E0CC19330A38251784E4D2D0C0EF57A5", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved index d22c96ad783fe..0378caf0aaf6f 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond/Move.resolved @@ -83,7 +83,7 @@ ResolvedGraph { manifest_digest: "88C81CA573217383E355274A37F0C6171DDE43ED835A166B0D6446C294788F65", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved index 683f08832defc..5907a8f247165 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep/Move.resolved @@ -101,7 +101,7 @@ ResolvedGraph { manifest_digest: "66CAE9439801A11D189DACA1182DFEF8BF0CA1C5F043F966D466CD7E7C486FB3", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved index 7157bb26bc33f..d4aff6166c5b8 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_deep_success/Move.resolved @@ -103,7 +103,7 @@ ResolvedGraph { manifest_digest: "E301B66162FDBFF21CE0504F64D66F3F9CFE1FC85B6675A3D91C417A41284EEA", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved index bf6fa63a5e592..c1fa1b6d07b52 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_external/Move.resolved @@ -83,7 +83,7 @@ ResolvedGraph { manifest_digest: "99C31161E1ED00C7621A2403D3513580715CA556C77C3C26FB1233B0778291AF", deps_digest: "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved index a40df3e8cad3c..2056168afdf94 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved +++ b/external-crates/move/crates/move-package/tests/test_sources/resolve_version_diamond_override/Move.resolved @@ -91,7 +91,7 @@ ResolvedGraph { manifest_digest: "84867C472017C20EFC5FF536C440568833A0F592C104B9F9EF5CD5A27D109CDB", deps_digest: "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3", }, - build_options: BuildConfig { + build_options: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled b/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled index f74fc3ee75168..78b0b7bfe16f5 100644 --- a/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled +++ b/external-crates/move/crates/move-package/tests/test_sources/test_symlinks/Move.compiled @@ -6,7 +6,7 @@ CompiledPackageInfo { source_digest: Some( "ELIDED_FOR_TEST", ), - build_flags: BuildConfig { + build_flags: BuildInfo { dev_mode: true, test_mode: false, generate_docs: false, diff --git a/external-crates/move/crates/move-stdlib/tests/move_unit_test.rs b/external-crates/move/crates/move-stdlib/tests/move_unit_test.rs index 209644048f92a..50cbcc20c2722 100644 --- a/external-crates/move/crates/move-stdlib/tests/move_unit_test.rs +++ b/external-crates/move/crates/move-stdlib/tests/move_unit_test.rs @@ -29,9 +29,12 @@ fn run_tests_for_pkg(path_to_pkg: impl Into, include_nursery_natives: bo let result = run_move_unit_tests( &pkg_path, move_package::BuildConfig { - test_mode: true, - install_dir: Some(tempdir().unwrap().path().to_path_buf()), - ..Default::default() + build_info: move_package::BuildInfo { + test_mode: true, + install_dir: Some(tempdir().unwrap().path().to_path_buf()), + ..Default::default() + }, + file_reader: None, }, UnitTestingConfig::default_with_bound(Some(1_000_000_000)), natives,