Build script configuration file #3528
Replies: 16 comments
-
Using something like XML or JSON could give a little more future flexibly, like multiline content etc. |
Beta Was this translation helpful? Give feedback.
-
Supporting Expanding Environment Variables for values would be nice too, then sensitive info could be excluded from config/buildscript bit easily mapped/concatenated in config file. I.e. |
Beta Was this translation helpful? Give feedback.
-
I see your point. However, this configuration file is just default parameters for the command line so I think that XML or JSON would be overkill. You wouldn't write anything in this file that you wouldn't write as a command line parameter. Everything other than that could be done in the actual cake script. I would prefer JSON for this, but the reason I suggested key/value is that I'm not sure that |
Beta Was this translation helpful? Give feedback.
-
@devlead Yes, that would be really useful. Would also be cool if the argument parser would understand environment variables as well. |
Beta Was this translation helpful? Give feedback.
-
You can add json parsing support without dependencies by linking in LitJSON example which files needed here |
Beta Was this translation helpful? Give feedback.
-
My two cents is that most new projects, for example AspNet, are all migrating to having a json formatted default configuration file. Hence cake.json or something like that. Also, I'm curious why not Newtonsoft.Json? It's the defacto json parsing library. My only issue with env variables in arguments is at that point, why not use a bootstrapper that understands env variables like powershell or bash? I have a feeling adding env var support to arguments might end up messy. Not sure how env var expanding in config would work. Never heard of that before. And why would sensitive information be passed in through dynamic -Args or read directly using |
Beta Was this translation helpful? Give feedback.
-
@RichiCoder1 Environment variables is really nice on build servers, you can keep config file in source repo without exposing sensitive information, also a config file would be cross platform, which a bash/ps/bat file isn't. Having it on a config file would also allow build script reuse only changing config file, I have many projects using Cake with very similar build scripts and only small pieces different between them. Regarding adding more binary references, personally I don't add dependencies lightly, anything not internal is hard to change later ;) though anything adding substantial value I'm all for! |
Beta Was this translation helpful? Give feedback.
-
While Newtonsoft.Json might be the most popular one in the .NET world, it likely has tons of features that aren't necessary for Cake. There are also some pains with the loads of versions out there conflicting with one another. I would vote for a smaller faster JSON library. OR Not using JSON as originally suggested. |
Beta Was this translation helpful? Give feedback.
-
I'm cool with smaller then :). And one thing that NPM does that cake could do is it looks for Edit: in addition to config, that is. |
Beta Was this translation helpful? Give feedback.
-
It seems to me that it doesn't worth the effort, bringing this functionality into Cake's core. At the moment Instead, we could implement a "native" JSON support (in Cake's core, that is not hooking up to external dependencies). |
Beta Was this translation helpful? Give feedback.
-
@cake-build/team am I right in saying that we can close this issue? Or is there still items outstanding on this that we want to bring in? |
Beta Was this translation helpful? Give feedback.
-
@gep13 do we really support overriding argument defaults via config as suggested in the issue? |
Beta Was this translation helpful? Give feedback.
-
Is this implemented? What is the alternative otherwise if I want to specify arguments in a config file, and not pass as parameters when invoking cake.exe? |
Beta Was this translation helpful? Give feedback.
-
@nawfalhasan no this is still an open issue, if you don't want to use command line parameters, your options today are to either use environment variables, or just serialize state to something like a json or yaml file. |
Beta Was this translation helpful? Give feedback.
-
Did a quick little search through the open issues, and a text search in this one about moving the pinning of addin/tool versions to a config file. Ideally, such a version pinning file would be generated whenever the script is run and there doesn't already exist this file. This way, pinning would be as easy as checking that file in instead of the current syntax. Think that could have a place in the config file being discussed here? |
Beta Was this translation helpful? Give feedback.
-
Add support for a build script config file. The build config would be a simple key-value pair file. The filename would be the same as the build script with a
.config
prefix (i.e.build.cake.config
).The configuration would only provide defaults. Any values in the build script config file would be
overridden by any arguments passed to cake directly.
Would use the
verbosity
anddryrun
from the config file, but thetarget
from the command line arguments.Beta Was this translation helpful? Give feedback.
All reactions