|
| 1 | +use bytesize::ByteSize; |
1 | 2 | use freenet::server::WebApp;
|
2 | 3 | use serde::{Deserialize, Serialize};
|
3 | 4 | use serde_with::skip_serializing_none;
|
@@ -102,14 +103,20 @@ fn compile_rust_wasm_lib(cli_config: &BuildToolConfig, work_dir: &Path) -> anyho
|
102 | 103 | };
|
103 | 104 |
|
104 | 105 | let package_type = cli_config.package_type;
|
105 |
| - println!("Compiling {package_type} with rust"); |
| 106 | + tracing::info!("Compiling {package_type} with rust, args: {:?}", cmd_args); |
106 | 107 |
|
107 | 108 | // Set CARGO_TARGET_DIR if not already set to ensure consistent output location
|
108 | 109 | let mut command = Command::new("cargo");
|
109 | 110 | if env::var("CARGO_TARGET_DIR").is_err() {
|
110 | 111 | command.env("CARGO_TARGET_DIR", get_workspace_target_dir());
|
111 | 112 | }
|
112 | 113 |
|
| 114 | + tracing::info!( |
| 115 | + command = ?"cargo", |
| 116 | + args = ?cmd_args, |
| 117 | + "Executing cargo command" |
| 118 | + ); |
| 119 | + |
113 | 120 | let child = command
|
114 | 121 | .args(&cmd_args)
|
115 | 122 | .current_dir(work_dir)
|
@@ -186,7 +193,7 @@ mod contract {
|
186 | 193 | build_web_state(&config, embedded, cwd)?
|
187 | 194 | }
|
188 | 195 | ContractType::Standard => {
|
189 |
| - println!("Packaging generic contract type"); |
| 196 | + tracing::warn!("Packaging generic contract type"); |
190 | 197 | build_generic_state(&mut config, cwd)?
|
191 | 198 | }
|
192 | 199 | }
|
@@ -425,13 +432,20 @@ mod contract {
|
425 | 432 | .map(Ok)
|
426 | 433 | .unwrap_or_else(|| get_default_ouput_dir(cwd).map(|p| p.join(DEFAULT_OUTPUT_NAME)))?;
|
427 | 434 |
|
428 |
| - println!("Bundling contract state"); |
| 435 | + tracing::info!("Bundling contract state"); |
429 | 436 | let state: PathBuf = (sources.len() == 1)
|
430 | 437 | .then(|| sources.pop().unwrap())
|
431 | 438 | .ok_or_else(|| Error::MissConfiguration(REQ_ONE_FILE_ERR.into()))?
|
432 | 439 | .into();
|
433 |
| - std::fs::copy(cwd.join(state), output_path)?; |
434 |
| - println!("Finished bundling state"); |
| 440 | + let src_path = cwd.join(&state); |
| 441 | + let bytes_written = std::fs::copy(&src_path, &output_path)?; |
| 442 | + let human_size = bytesize::ByteSize(bytes_written).to_string(); |
| 443 | + tracing::info!( |
| 444 | + path = ?output_path, |
| 445 | + human_size = %human_size, |
| 446 | + "Wrote contract state file" |
| 447 | + ); |
| 448 | + tracing::info!("Finished bundling state"); |
435 | 449 | Ok(())
|
436 | 450 | }
|
437 | 451 |
|
@@ -483,8 +497,15 @@ mod contract {
|
483 | 497 | get_default_ouput_dir(cwd)?.join(package_name)
|
484 | 498 | };
|
485 | 499 | let output = get_versioned_contract(&output_lib, cli_config)?;
|
486 |
| - let mut file = File::create(out_file)?; |
| 500 | + let mut file = File::create(&out_file)?; |
487 | 501 | file.write_all(output.as_slice())?;
|
| 502 | + let size = output.len(); |
| 503 | + let human_size = ByteSize(size as u64).to_string(); |
| 504 | + tracing::info!( |
| 505 | + path = ?out_file, |
| 506 | + size = %human_size, |
| 507 | + "Wrote contract output file" |
| 508 | + ); |
488 | 509 | }
|
489 | 510 | None => println!("no lang specified, skipping contract compilation"),
|
490 | 511 | }
|
|
0 commit comments