-
Notifications
You must be signed in to change notification settings - Fork 125
Return artifact paths when contracts unchanged #992
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
Conversation
| mod workspace; | ||
|
|
||
| #[deprecated(since = "2.0.2", note = "Use MetadataArtifacts instead")] | ||
| pub use self::metadata::MetadataArtifacts as MetadataResult; |
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.
Renamed this type, so have added this alias to be backwards compatible.
crates/build/src/tests.rs
Outdated
|
|
||
| /// Get the last modified date of the given file. | ||
| fn file_last_modified(path: &Path) -> SystemTime { | ||
| fs::metadata(path).unwrap().modified().unwrap() |
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.
Should the Result be handled here? Are we sure that the file exists under given path?
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.
At the moment we are assuming the file exists, yes. In the cases it is used in the tests that should be true. That said I have replaced the unwraps with ok_or_else to properly display the error message in case of an error to make it easier to debug these errors if they arise. dfc9215
I believe I fixed that in a153e2a (see image in PR description) |
cmichi
left a comment
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.
Thanks, we should also issue a release with this one.

Since #964, if the contract is unchanged the contract optimization and metadata generation steps are skipped. Currently this means that the
optimization_resultandmetadata_resultfields onBuildResultare bothNone. Tools and library users depend on those results to get the paths to the contract Wasm and metadata artifacts. So on a fresh contract build those would have values, and on a subsequent build with no changes to the contract those results will both beNoneThis PR ensures that users can still determine those artifact paths even if the optimization and metadata steps are skipped.
This is how the output now looks when artifacts are unchanged: