-
-
Notifications
You must be signed in to change notification settings - Fork 726
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
Better dotnet tool integration #2685
Comments
Good feedback. In 1.0 bootstrapping won't need an extra run, believe there's already a PR for that. Integrating the Nothing should stop you from using local tools and tools manifest already today to boostrap tools, Cake tool resolution should find them. But using |
Implicit bootstrapping of modules has been implemented with #2833 for Cake 1.0.0. Documentation on website has also been updated to make .NET Tool the recommended runner: https://cakebuild.net/docs/getting-started/running-cake-scripts @gitfool Is there anything else or can this issue be closed? |
@pascalberger I think this issue can be closed and a couple of new issues created, if agreed and not already existing, focusing on:
This is the most downloaded Cake module, which is not surprising given the appeal and utility of portable .NET [Core] tools, and should be built-in to Cake core, unless I'm missing some advantages to having it in a separate module. (I would expect that most users would not need to use modules if this was built-in.)
|
GH2685/2903: Integrate Cake.DotNetTool.Module
🎉 This issue has been resolved in version v1.1.0 🎉 The release is available on: Your GitReleaseManager bot 📦🚀 |
It would be great to have better dotnet tool integration, especially now that we have local tools in .NET Core 3.0. I've been pondering what a minimal Cake build could look like. My BoardGameGeek.Dungeon repo can serve as the use case.
Current Cake related files:
For Azure Pipelines and GitHub Actions builds I avoid the Cake bootstrap by using a Docker image with the Cake tool already installed. However, all builds still have to bootstrap Cake modules in order to use dotnet tools in the Cake build itself, one of the most common being GitVersion.
BoardGameGeek.Dungeon is built using Cake.Dungeon, and in the depths lives the bootstrap.cake script with the following:
This is the first barrier to diet Cake nirvana as it requires Cake to be invoked twice, first to install the
Cake.DotNetTool.Module
to extend Cake to support#tool
, then again for the actual build, using something like the following:Not too bad, although more verbose in PowerShell until v7 drops next year with long overdue support for pipeline chain operators, but really it's surely about time this module moved into Cake core, and when it does we'll want it to play nice with dotnet local tools. (The two step bootstrap will still be required if you're using other Cake modules, but I'd argue that's much less common, and using dotnet [local] tools is standard now, especially if writing cross-platform builds.)
Anyway, given support for dotnet local tools, I would be able to delete the above Cake related files and replace them with a single
dotnet-tools.json
manifest file:Then to invoke the build on a clean machine I'd use the following:
... or when the dotnet tool module is moved to Cake core:
... and when the Cake dotnet tool is already installed (on a local dev machine):
Also, for this to integrate better with dotnet local tools, the
#tool
directive should use the local tool directly, presumably invokingdotnet <tool>
, rather than extracting and copying what was previously a global tool into the Cake tools directory alongside addins and modules. (I'm hoping such a change would also avoid the quirk resulting from building the same directory in Windows and then WSL or Docker with a host mount, or vice versa, where you first need to explicitly delete any such copied dotnet tools which would be for the wrong platform.)So in summary, a minimal Cake build would simply leverage dotnet local tools to bootstrap Cake itself, and given the dotnet tool module was moved to Cake core, a common case requiring an extra module bootstrap step could most likely be avoided, and the
#tool
directive would use the dotnet local tool directly, rather than copying a platform specific executable into its own tools directory.The text was updated successfully, but these errors were encountered: