Trying to get a PSAKE script to work. Its seems that tasks are not executing the functions within them?
I have 2 files
-- default.ps1 --
Import-Module "C:\dev\Phoenix\trunk\Build\BuildScripts\include.ps1"
Import-Module "C:\Software\PSAKE\JamesKovacs-psake-b0094de\psake.psm1"
Invoke-psake "C:\dev\Phoenix\trunk\Build\BuildScripts\build.ps1"
remove-module psake
-- build.ps1 --
$framework = '4.0'
properties {
$root_dir = 'c:\dev\Phoenix\trunk\'
$integration_deploy_dir = '\\Server025\Phoenix_IntegrationTests\'
$build_scripts_dir = '$root_dir\Build\BuildScripts'
$test_dir = Join-Path $root_dir '\Tests\Core.UnitTests\bin\Debug'
$dll = Join-Path $test_dir 'Phoenix.Core.UnitTests.dll'
}
task default -depends Test
task MsBuild { exec { msbuild /version }}
task Test -depends Deploy
{
Write-Host "Start task Test"
Add-PSSnapIn Gallio
Write-Host "TEST -- $dll"
Test-Gallio $test_dir Release x64 $dll "Core.UnitTests" ## FYI - call to include func
Write-Host "End task Test"
}
task Deploy
{
Write-Host "Start task deploy"
Write-Host "Deploying to integration server"
copy $root_dir"\Sites" $integration_deploy_dir -Recurse -Force
Write-Host "End task deploy"
}
At the moment it just seems to 'print out' the stuff listed within tasks without actually doing anything. What am I missing? Thanks
Sorry forgot to mention I really just want to get the COPY method working first -- thx
Thanks for the help - Ive made all your suggestions and still no luck.
If I put the code 'inline' rather that in PSAKE tasks the code runs fine.
I now have this
-- default.ps1
Import-Module C:\dev\Phoenix\trunk\Build\BuildScripts\include.ps1
Import-Module C:\Software\PSAKE\JamesKovacs-psake-b0094de\psake.psm1
Invoke-psake C:\dev\Phoenix\trunk\Build\BuildScripts\build.ps1
remove-module psake
-- build.ps1 $framework = '4.0'
properties {
$root_dir = 'c:\dev\Phoenix\trunk'
$sites_dir = 'c:\dev\Phoenix\trunk\sites'
$integration_deploy_dir = '\\Vsydnweb025\Phoenix_IntegrationTests\'
$build_scripts_dir = "$root_dir\Build\BuildScripts"
}
task default -depends Deploy
task Deploy
{
Write-Host 'Start task deploy'
Write-Host 'Deploying to integration server'
copy $sites_dir $integration_deploy_dir -Recurse -Force
Write-Host 'End task deploy'
get-childitem $integration_deploy_dir -include *.svclog -recurse | foreach ($_) {remove-item $_.fullname}
}
The output of this is as follows:
Write-Host 'Start task deploy'
Write-Host 'Deploying to integration server'
copy $sites_dir $integration_deploy_dir -Recurse -Force
Write-Host 'End task deploy'
get-childitem $integration_deploy_dir -include *.svclog -recurse | foreach ($_) {remove-item $_.fullname}
Build Succeeded!
----------------------------------------------------------------------
Build Time Report
----------------------------------------------------------------------
Name Duration
---- --------
Deploy 00:00:00.0006013
Total: 00:00:02.5335350
So it seems the functions within the task are just being printed out.
The copy function did not run - nor the Piped .SvcLog file delete
Ie on the screen I would expect
'Start task deploy'
instead of
Write-Host 'Start task deploy'
Ill keep trying to get it to work.
Thanks for your help!!!
Had this answered in the google group
The beginning "{" needs to be on the same line as the "task" function since it's a scriptblock that is being passed as a parameter to the "task" function. PS is interpreting your code as 2 statements instead of 1 statement.