Skip to content
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

Merged

Conversation

dj8yfo
Copy link
Collaborator

@dj8yfo dj8yfo commented Apr 19, 2024

Following has been compared to --no-docker counterparts,
they produce the same output *.wasm paths (*.json and *.zst aren't produced
as result of a build).
Tested on https://github.com/dj8yfo/sample_no_workspace/tree/set_metadata_with_repo .

  • without arg
    • cargo near build --no-abi
    • cargo near build
    • cargo near deploy
  • with arg
    • 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

Screenshot_20240419_230137

@dj8yfo dj8yfo changed the title feat: similar behaviour of build destination with --no-docker flow feat(source-scan): similar behaviour of build destination with --no-docker flow Apr 19, 2024
@dj8yfo dj8yfo force-pushed the source-scan-build-destination branch from 9d8c116 to 9318292 Compare April 22, 2024 11:08
@dj8yfo dj8yfo marked this pull request as ready for review April 22, 2024 11:45
Copy link
Contributor

@frol frol left a 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.

Comment on lines +88 to +114
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(),
)?;
Copy link
Contributor

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.

@frol frol merged commit a421525 into near:source-scan-integration Apr 23, 2024
13 of 14 checks passed
@dj8yfo dj8yfo deleted the source-scan-build-destination branch May 13, 2024 13:37
@dj8yfo dj8yfo mentioned this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants