feat(anchor-cli): cargo shim with set nightly rust #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, I saw the issue with the nightly usage, and personally I prefer not having to use nightly as well when possible.
The current solution would force anchor to use nightly when we had an override, but I thought it would instead be nicer to provide both toolchains to anchor and let it pick the one it wants, so for example during IDL it will use nightly, but during normal build it would use stable.
To do that, I created a small shim script that acts in a similar way as the actual
cargobinary, where the right toolchain is dispatched based on the first argument, in this case if omitted it would use stable and when+nightlyis specified it would use the nightly toolchain we configured it for.This is useful for multi-version compatibility: in this case 0.30.1 still makes use of the old API, therefore having a nightly toolchain which is compatible allows users (like me) to still make use of this specific anchor version. In the newer versions, the usage was patched so "latest" nightly is selected.
I also edited the patches so that
+nightlyis set normally by the IDL build step (since it would use the shim), and we only skip the toolchain installation phase.