Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64a95ad

Browse files
committed
Delete cake directory if script changed.
1 parent 66c66e4 commit 64a95ad

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

build.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@ Param(
99
[string[]]$ScriptArgs
1010
)
1111

12-
# create cake directory
12+
# delete cake directory if script changed
1313
$CakeDirPath = Join-Path $PSScriptRoot "cake"
14+
$PackagesConfigPath = Join-Path $CakeDirPath "packages.config"
15+
If ((Test-Path $PackagesConfigPath) -and ((Get-Item(Join-Path $PSScriptRoot "build.cake")).LastWriteTime -gt (Get-Item($PackagesConfigPath)).LastWriteTime)) {
16+
Write-Host "Cake script changed; rebuilding cake directory."
17+
Remove-Item $CakeDirPath -Force -Recurse
18+
}
19+
20+
# create cake directory
1421
New-Item -Path $CakeDirPath -Type Directory -ErrorAction SilentlyContinue | Out-Null
1522

1623
# create packages.config
17-
$PackagesConfigPath = Join-Path $CakeDirPath "packages.config"
1824
If (!(Test-Path $PackagesConfigPath)) {
1925
[System.IO.File]::WriteAllLines($PackagesConfigPath, @(
2026
"<?xml version=`"1.0`" encoding=`"utf-8`"?>",
2127
"<packages>",
22-
"`t<package id=`"Cake`" version=`"0.14.0`" />",
28+
"`t<package id=`"Cake`" version=`"0.17.0`" />",
2329
"</packages>"))
2430
}
2531

0 commit comments

Comments
 (0)