forked from pascalberger/cake-frosting-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cake.Frosting ToolInstaller working directory example
An example using Cake.Frosting 1.0.0-rc0002 which shows the `ToolInstaller` still uses a hardcoded `_environment.WorkingDirectory.Combine("tools").MakeAbsolute(_environment);` path to install tools into. Observe that CakeHost() was configured with a .UseWorkingDirectory("../..") but surprisingly the tools end up being installed in `./build/source/tools` instead of the expected `./tools` directory as was the case in Cake.Frosting 1.0.0-rc0001. Now, as far as the `ToolInstaller` is concerned, both are wrong in this case. The [Paths][Tools] setting from the cake.config file has been specified and should be used instead. See cake-build/cake#2904 (comment)
- Loading branch information
Dieter Verfaillie
committed
Jan 4, 2021
1 parent
0ac29ab
commit 76e6518
Showing
9 changed files
with
109 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,69 @@ | ||
dotnet run --project build/Build.csproj -- $args | ||
exit $LASTEXITCODE; | ||
# Script root | ||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
|
||
# Read configuration file | ||
function Get-IniContent ($filePath) | ||
{ | ||
$ini = @{} | ||
switch -regex -file $FilePath | ||
{ | ||
"^\[(.+)\]$" # Section | ||
{ | ||
$section = $matches[1] | ||
$ini[$section] = @{} | ||
$CommentCount = 0 | ||
} | ||
"^(;.*)$" # Comment | ||
{ | ||
if (!($section)) | ||
{ | ||
$section = "No-Section" | ||
$ini[$section] = @{} | ||
} | ||
$value = $matches[1] | ||
$CommentCount = $CommentCount + 1 | ||
$name = "Comment" + $CommentCount | ||
$ini[$section][$name] = $value | ||
} | ||
"(.+?)\s*=\s*(.*)" # Key | ||
{ | ||
if (!($section)) | ||
{ | ||
$section = "No-Section" | ||
$ini[$section] = @{} | ||
} | ||
$name,$value = $matches[1..2] | ||
$ini[$section][$name] = $value | ||
} | ||
} | ||
return $ini | ||
} | ||
|
||
$buildConfig = Get-IniContent(Join-Path $PSScriptRoot "cake.config") | ||
|
||
# Make sure tools folder exists | ||
$ToolPath = $buildConfig["Paths"]["Tools"] | ||
if (!(Test-Path $ToolPath)) { | ||
Write-Verbose "Creating tools directory..." | ||
New-Item -Path $ToolPath -Type directory | out-null | ||
} | ||
|
||
Push-Location | ||
Set-Location build\source | ||
|
||
Write-Host "Preparing Cake.Frosting build runner..." | ||
Invoke-Expression "dotnet restore" | ||
if($LASTEXITCODE -ne 0) { | ||
Pop-Location; | ||
exit $LASTEXITCODE; | ||
} | ||
|
||
Write-Host "Running Cake.Frosting build runner..." | ||
Write-Host "dotnet run -- $args" | ||
Invoke-Expression "dotnet run -- $args" | ||
if($LASTEXITCODE -ne 0) { | ||
Pop-Location; | ||
exit $LASTEXITCODE; | ||
} | ||
|
||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
dotnet run --project ./build/Build.csproj -- "$@" | ||
dotnet run --project ./build/source/Build.csproj -- "$@" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Nuget] | ||
Source=http://privateget.workplace.local:8000/nuget/workplace-feed/ | ||
UseInProcessClient=true | ||
LoadDependencies=false | ||
|
||
[Paths] | ||
Tools=./build/tools | ||
Addins=./build/tools/Addins | ||
Modules=./build/tools/Modules | ||
|
||
[Settings] | ||
SkipVerification=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.