-
Notifications
You must be signed in to change notification settings - Fork 265
feat: Hint developers to use cargo near build
to build contracts instead of cargo build
#1361
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
…stead of `cargo build`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1361 +/- ##
==========================================
+ Coverage 80.34% 80.35% +0.01%
==========================================
Files 104 104
Lines 15243 15243
==========================================
+ Hits 12247 12249 +2
+ Misses 2996 2994 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@race-of-sloths include |
@frol Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 8! @dj8yfo received 25 Sloth Points for reviewing and scoring this pull request. Congratulations @frol! Your PR was highly scored and you completed another monthly streak! To keep your monthly streak make another pull request next month and get 8+ score for it What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
"⚠️ Use `cargo near build` instead of `cargo build` to compile your contract | ||
|
||
💡 Install cargo-near from https://github.com/near/cargo-near" |
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.
the message is misleading, as it assumes the reason of error, and tells nothing to user about the
actual not(any( test, doctest, clippy, target_family = "wasm", feature = "unit-testing", feature = "__abi-generate" ))
condition, that has been checked.
I do believe that the actual reason has to be printed first (so that it doesn't require to dig into sources), and one of assumed possible reasons Use cargo near build instead of cargo build to compile your contract
suggested after that.
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.
@dj8yfo The longer the message, the less likely users will read it fully, so while I agree with you in general, this is the conscious tradeoff I had to make.
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.
@race-of-sloths score 8
it looks to me the collection of footguns will be expanded while deleting 1 existing exhibit
a newly added footgun https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.template.toml#L42 won't be a problem in context of cargo near new
skeleton project, but it may pop elsewhere
It is a more robust version of near/cargo-near#350, which works for all existing contracts that will pull in the latest near-sdk-rs.
Without this patch
cargo build
will succeed, but this confuses users as they cannot find the wasm file.This PR ensured that none of the legacy commands will fail:
cargo test
will pass thanks tounit-testing
feature being enabled in all contracts for near-sdk indev-dependency
cargo build --target=wasm...
will pass since this check does not trigger compilation error iftarget_family="wasm"
cargo near build
will set__abi_generate
feature for the ABI build, andtarget_family="wasm"
for the contract build