-
-
Notifications
You must be signed in to change notification settings - Fork 722
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
Question: Re-using build.ps1 file #492
Comments
Good question. Would be good to have an official solution for this documented on the site. |
I use the same build.ps1 for most my projects currently, it just if missing fetches nuget.exe & installs Cake. All common tools, scripts, resources are fetched as nuget packages in Cake script and are excluded from repo via .gitignore . Why don't you put the build.ps1 in a nuget package and basically have a bootstrapper.ps1 that just fetches nuget and installs build.ps1 package. If you want to take dependency on a certain version you could use a package config, otherwise just call nuget exclude version and you will always get latest version of packages. |
Totally agree. Happy to take this on, once I know exactly what the solution is 😄 |
This is what I thought it might come down to, but I wasn't sure. Could I put the build.cake file into the nuget package, and then extract it within the bootstrapper, to say the I love the idea of being able to update the build.cake file, and push out all the updates. For instance, now that GitVersion, GitReleaseNotes, OpenCover, etc are all in Cake, I want all of these in my 3 projects, but I have to update in 3 places. |
You could actually package build.cake within and only have an "setup.cake" that's local in repo that has everything repo unique like nuget names, paths variables etc. A little like a model view pattern where the build.cake is the view and the repo cake file is the model. |
@devlead do you have any public examples of doing this, or is this only what you do internally? I think I am going to volunteer you to write the blog post/how-to article that I linked to above 😛 |
No public examples I'm afraid, but I'll happily assist you in transfer knowledge into an sample 😉 |
@devlead ok, perfect. I will start putting, what I think are the required pieces together, for the 3 repos that I am interested in doing this on, and then we can use that as a sample to point people to, perhaps as a walkthrough/how-to from the website. |
@devlead ok, so I am just putting some thought to this, and wanted to make sure that I am not missing anything. This is what I was planning on doing...
If this is not the approach that you were suggesting, can you confirm what you were thinking? Thanks! |
@gep13 an essence yes, only difference is that the build.cake in our case includes the setup.cake. Don't use a globbing pattern today, pretty sure it's not supported in directives. Basically for many projects like assemblies are very similar. Only diff is things like Nuget ids, assembly info and versioning. |
If I can't use a globbing pattern when referencing the build.cake distributed in the Nuget Package, I would need to update the setup.cake file each time I pushed a new version of the build.cake file, right? Ideally, I want that to be brought in, automagically, when a new version is pushed. |
Well we've used the ReleaseNotes.md for versioning and don't use a package.config for the common scripts package but our build boostrapper basically runs a Though try to config as little as possible and the more the can inferred by convention the better 😄 |
Ah, ok, so I think I was looking at this backwards, now I see what you mean. Ok, so last question, when you do this....
where does the extracted build.cake file end up? are you able to put it in the root folder of the source folder? If so, how? |
We install it in it's own GIT ignored "resources" folder at the root. |
I am implementing this functionality here: https://github.com/gep13/ChocolateyPackages/tree/master/gep13.DefaultBuild so this issue can be closed. |
I have created a few new projects lately, each of which use the exact same build.ps1 file.
The problem that I face now is, as I start to evolve the build.ps1 file, I need to update it in three places, and potentially more as the number of projects grows.
What is the best approach, or is there one, on re-using the same build.ps1 file in multiple projects.
My aim would be to create a fully generic build.ps1 file, that is a drop in to any project that is going to use Cake as the build engine. But I also want to be able to update it easily in all projects that use it.
The text was updated successfully, but these errors were encountered: