Skip to content

Conversation

@ascjones
Copy link
Collaborator

@ascjones ascjones commented Feb 28, 2023

Since #964, if the contract is unchanged the contract optimization and metadata generation steps are skipped. Currently this means that the optimization_result and metadata_result fields on BuildResult are both None. 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 be None

This 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:

image

@ascjones ascjones marked this pull request as ready for review March 1, 2023 10:20
mod workspace;

#[deprecated(since = "2.0.2", note = "Use MetadataArtifacts instead")]
pub use self::metadata::MetadataArtifacts as MetadataResult;
Copy link
Collaborator Author

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.

@cmichi
Copy link
Collaborator

cmichi commented Mar 1, 2023

image

Missing line break here.


/// Get the last modified date of the given file.
fn file_last_modified(path: &Path) -> SystemTime {
fs::metadata(path).unwrap().modified().unwrap()
Copy link
Contributor

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?

Copy link
Collaborator Author

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

@ascjones
Copy link
Collaborator Author

ascjones commented Mar 1, 2023

image

Missing line break here.

I believe I fixed that in a153e2a (see image in PR description)

Copy link
Collaborator

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

@ascjones ascjones merged commit c0a3611 into master Mar 1, 2023
@ascjones ascjones deleted the aj/build-result branch March 1, 2023 16:03
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.

4 participants