Better unknow target handling & build.cmd #954
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
TLDR:
SETLOCAL
inbuild.cmd
to ensure that it doesn't touch the global environmentbuild.cmd
handle build target names quoted or not as first arggetTarget
function that provide an nice error display.Why
I had a problem today where FAKE wasn't building some of our projects anymore, after searching the real reason was that I built fake in the same terminal a little bit before and that
build.cmd
set the environment variableTARGET
to"Default"
(With the quotes).The problem with that is that while FAKE
build.cmd
pass it on the command line, and the extra quotes are removed from there our own build script doesn't and just call :(The fact that we also use a task named
Default
made that a lot harder to debug, took me time to understand who set this evironment variable)But
RunTargetOrDefault
will also use an environment variableTARGET
if it exists, except that it doesn't trim quotes :DAnd then fake was failing with the not really helpful :