Open CarteriTrellis opened 5 years ago
The problem here once again lies with build.ps1 like issue #74. If you were to pass your arguments directly to cake it would probably work.
Supposing that we only have to fix arguments in the format -name=value, we could add something like this to the bottom of build.ps1 (around line 243):
If ($ScriptArgs) {
$Args = ($ScriptArgs).split(" ")
$ScriptArgs = ""
foreach ($element in $Args) {
$elementParts = ($element).split("=")
If ($elementParts.Length -eq 2) {
$ScriptArgs += $elementParts[0] + "=`"" + $elementParts[1] + "`" "
}
else {
$ScriptArgs += $element + " "
}
}
}
This would also cover #73
The problem here once again lies with build.ps1 like issue #74. If you were to pass your arguments directly to cake it would probably work.
I have no doubt that cake would have worked fine. build.ps1 was supposed to serve as the single-source-of-truth for build definitions on that particular project, though.
(And yeah, I'd probably try more or less exactly what you're proposing by way of fixing this.)
Tried @Roadrunner67 solution with latest build.ps1
on develop
and had a few minor issues:
"
, you'll end up with double quotes in them (""foo""
). This breaks script execution.""foo""\s\s""bar""
)..cake
build executable (a.k.a.: build.cake
) and the beginning of arguments ("build.cake"-target
) - looks weird, but doesn't really seem to affect invocation.After some tweaks, this is what I ended up with:
If ($ScriptArgs) {
$Args = ($ScriptArgs) -split "\s+"
$ScriptArgs = ""
foreach ($element in $Args) {
$elementParts = ($element) -split "="
If ($elementParts.Length -eq 2) {
$ScriptArgs += $elementParts[0] + "=`"" + $elementParts[1].Trim("`"") + "`""
}
else {
$ScriptArgs += $element
}
}
}
# Build Cake arguments
$cakeArguments = ""
If ($Script) {
$cakeArguments += @("`"$Script`" ");
}
Hi @nfantone, there was an error in this commit, it shouldn't have been
# Build Cake arguments
$cakeArguments = ""
But instead
# Build an array (not a string) of Cake arguments to be joined later
$cakeArguments = @()
This was fixed in PR #80
I am using the following arguments in PowerShell with the bootstrapper:
.\build.ps1 -target=build -configuration=Debug -ScriptArgs='--packageVersion="1.0.0-dev"'
What You Are Seeing?
packageVersion
is staying set to the default value, "1.0.0".What is Expected?
packageVersion
= "1.0.0-dev"When I remove '=' from arguments, I get the expected results:
.\build.ps1 -target build -configuration Debug -ScriptArgs '--packageVersion="1.0.0-dev"'
What version of Cake are you using?
v0.32.1
Are you running on a 32 or 64 bit system?
64-bit
What environment are you running on? Windows? Linux? Mac?
Windows 10
Are you running on a CI Server? If so, which one?
TeamCity
How Did You Get This To Happen? (Steps to Reproduce)
Output Log