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

Add ability to execute MinVer as global tool and fallback logic #7

Merged
merged 1 commit into from
Nov 24, 2020

Conversation

augustoproiete
Copy link
Member

Closes #5

By default Cake.MinVer:

  • Tries to execute MinVer as a local tool (dotnet minver)
  • If executing the local tool fails, tries to execute as a global tool (minver)

Setting PreferGlobalTool to true tells Cake.MinVer to invert the statement above, i.e.:

  • Tries to execute MinVer as a global tool (minver)
  • If executing the global tool fails, tries to execute as a local tool (dotnet minver)

Setting NoFallback to false disables the fallback logic and Cake.MinVer will only attempt
to execute one of the tools. Which one depends on the value of PreferGlobalTool.

N.B.: If ToolPath is set

  • PreferGlobalTool is assumed true given that only global tools can have custom paths
  • NoFallback is assumed true given that a specific tool was provided and is expected to exist

Useful information:
https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools

By default Cake.MinVer:
- Tries to execute MinVer as a local tool (`dotnet minver`)
- If executing the local tool fails, tries to execute as a global tool (`minver`)

Setting `PreferGlobalTool` to `true` tells Cake.MinVer to invert the statement above, i.e.:
- Tries to execute MinVer as a global tool (`minver`)
- If executing the global tool fails, tries to execute as a local tool (`dotnet minver`)

Setting `NoFallback` to `false` disables the fallback logic and Cake.MinVer will only attempt
to execute one of the tools. Which one depends on the value of `PreferGlobalTool`.

N.B.: If `ToolPath` is set
- `PreferGlobalTool` is assumed `true` given that only global tools can have custom paths
- `NoFallback` is assumed `true` given that a specific tool was provided and is expected to exist

Useful information:
https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools
@augustoproiete augustoproiete added bug Something isn't working enhancement New feature or request labels Nov 22, 2020
@augustoproiete augustoproiete added this to the 0.2.0 milestone Nov 22, 2020
@augustoproiete augustoproiete force-pushed the run-as-global-tool-and-fallback-logic branch 2 times, most recently from 5e47bb0 to 32c404e Compare November 22, 2020 21:21
@dario-griffo-cko
Copy link

I have tested this locally and works perfect! Thanks a lot for the quick patch.
Just one question, do you know if there a setting for cake to allow preview packages to be downloaded? I couldn't use your preview package from nuget, so packed locally a v0.2.0 in a local source folder I have and no issues.
Again: great work!

@augustoproiete
Copy link
Member Author

That's great to hear @dario-griffo-cko! Thanks for testing it.

Yes, Cake can download preview packages. You need to append &prerelease=true in the #nuget directive:

#addin "nuget:?package=Cake.MinVer&version=0.2.0-preview&prerelease=true"

@augustoproiete augustoproiete merged commit 1885916 into master Nov 24, 2020
@augustoproiete augustoproiete deleted the run-as-global-tool-and-fallback-logic branch November 24, 2020 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception while trying to run Cake.MinVer with minver-cli installed as global tool
2 participants