-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(source-scan): similar behaviour of build destination with --no-docker
flow
#153
feat(source-scan): similar behaviour of build destination with --no-docker
flow
#153
Conversation
--no-docker
flow--no-docker
flow
9d8c116
to
9318292
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good enough for a proof of concept, so I will merge it without asking to address the comment right now.
for entry in dir.flatten() { | ||
if entry | ||
.path() | ||
.extension() | ||
.unwrap_or(OsStr::new("not_wasm")) | ||
.to_str() | ||
.unwrap_or("not_wasm") | ||
== "wasm" | ||
{ | ||
let out_wasm_path = { | ||
let filename = entry | ||
.path() | ||
.file_name() | ||
.unwrap() | ||
.to_string_lossy() | ||
.into_owned(); | ||
destination_dir.push(filename); | ||
destination_dir | ||
}; | ||
if out_wasm_path.exists() { | ||
println!(" {}", "removing previous artifact".cyan()); | ||
std::fs::remove_file(&out_wasm_path)?; | ||
} | ||
std::fs::copy::<std::path::PathBuf, camino::Utf8PathBuf>( | ||
entry.path(), | ||
out_wasm_path.clone(), | ||
)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we should resolve the wasm file name from Cargo metadata and don't search wasm files in the target folder as that might be a wrong wasm file after all.
this addresses #153 (comment) screenshot from https://github.com/dj8yfo/sample_no_workspace/tree/metadata_image_repo_build_cmd ![Screenshot_20240424_154301](https://github.com/near/cargo-near/assets/26653921/afe9a29c-6c78-494d-bb42-b71b1ff260f2)
Following has been compared to
--no-docker
counterparts,they produce the same output
*.wasm
paths (*.json
and*.zst
aren't producedas result of a build).
Tested on https://github.com/dj8yfo/sample_no_workspace/tree/set_metadata_with_repo .
cargo near build --no-abi
cargo near build
cargo near deploy
cargo near build --no-abi --out-dir /path/to/tmp_build_destination
cargo near build --out-dir /path/to/tmp_build_destination
cargo near deploy --out-dir /path/to/tmp_build_destination