Closed augustoproiete closed 4 years ago
FWIW I provided a solution to this in https://github.com/cake-build/resources/pull/17 but there was little enthusiasm for adding such support.
I've just updated my branch (rebased against master) but won't bother creating a new pull request unless there's renewed interest.
What is the exact use case to change the folders?
As @flcdrg mentioned we're hesitant to add the complexity required to parse the cake.config
file to the bootstrapper. These bootstrappers are intended as a starting point for what can be done. It is the developer's discretion to extend the bootstrapper to solve specific requirements like parsing config file.
A much simpler approach could be passing paths as set in the bootstrapper to Cake as done in https://github.com/cake-build/resources/pull/88. Would this also solve the use case?
@flcdrg That looks good to me, though I personally do not rely on these bootstrappers anymore since the dotnet cake
became mainstream so no strong desire on my side to have this fixed at this point.
@pascalberger My use case is that I have projects where the ./tools
folder is already being used for other things and can't be written to.
Setting the paths in environment variables seem like it could be a viable workaround - it's just not as clean as parsing the cake.config
from the point of view of the end-user... As one would have to set the paths in three files (build.sh
, build.ps1
, cake.config
) instead of one (cake.config
) and ensure they're always in sync. If we remove the paths from the cake.config
we assume everyone in the team will always use the bootstrapper and that doesn't seem like a good approach to me.
That said, the dotnet cake
tool honors the paths in the cake.config
file and the boostrapping now is a one-liner dotnet tool restore && dotnet cake
so I don't think it's worth spending more time on this.
Yep, that was my use case too - had a legacy solution that was already using the tools
directory.
I'm also switching to dotnet-cake for new projects, but then because they're new I don't try and use the tools
directory for anything else either!
@flcdrg While we might not bring this work into these bootstrappers, I think I might still use your code (so don't delete it just yet 😄 ) in order to parse the cake.config to allow specifying the version of .Net Core to use in a set of bootstrappers for running Cake.Tool.
@gep13 don't worry, I still use it myself so I plan to keep the branch around, even if it isn't merged in officially :-)
We can add a blog post to the cakebuild.net website how to update bootstrapper to parse cake.config file. This would give it some visibility, without adding the complexity to the default bootstrapper.
@flcdrg would you be interested in this?
@pascalberger sure.. what's the best way to get you the content?
@flcdrg You can create a PR for the blog post by adding a markdown file to https://github.com/cake-build/website/tree/master/input/blog
Blog post is now available here: https://cakebuild.net/blog/2020/12/config-bootstrap
What You Are Seeing?
build.ps1
andbuild.sh
do not honor the Tools path defined incake.config
. The path for tools, add-ins, modules, etc. is hard-coded in the boostrapper.What is Expected?
Before downloading Cake,
build.ps1
andbuild.sh
should read the tools path defined incake.config
and use that path to store the Cake tool before downloading.What version of Cake are you using?
0.38.2
How Did You Get This To Happen? (Steps to Reproduce)
cake.config
from the resources repobuild.ps1
orbuild.sh
from the resources repocake.config
to something else other than./tools
. E.g../build/tools
build.ps1
orbuild.sh
and notice that the Cake tools were downloaded to./tools
instead of./build/tools
as specified incake.config