@@ -28,6 +28,7 @@ function *Die($M, $C=0) {$PSCmdlet.ThrowTerminatingError((New-Object System.Mana
2828Set-Alias assert Assert-Build
2929Set-Alias equals Assert-BuildEquals
3030Set-Alias exec Invoke-BuildExec
31+ Set-Alias print Write-Build
3132Set-Alias property Get-BuildProperty
3233Set-Alias remove Remove-BuildItem
3334Set-Alias requires Test-BuildAsset
@@ -373,8 +374,8 @@ New-Variable * -Description IB ([PSCustomObject]@{
373374 B = 0
374375 Q = 0
375376 H = @ {}
376- Header = if (${*p} ) {${*p}.Header } else {{Write-Build 11 " Task $ ( $args [0 ]) " }}
377- Footer = if (${*p} ) {${*p}.Footer } else {{Write-Build 11 " Done $ ( $args [0 ]) $ ( $Task.Elapsed ) " }}
377+ Header = if (${*p} ) {${*p}.Header } else {{print 11 " Task $ ( $args [0 ]) " }}
378+ Footer = if (${*p} ) {${*p}.Footer } else {{print 11 " Done $ ( $args [0 ]) $ ( $Task.Elapsed ) " }}
378379 Data = @ {}
379380 XBuild = $null
380381 XCheck = $null
@@ -515,8 +516,8 @@ function *Check($J, $T, $P=@()) {
515516function * Echo {
516517 ${*c} = $args [0 ]
517518 ${*t} = " ${*c} " .Replace(" `t " , ' ' )
518- Write-Build 3 " exec {$ ( if (${*t} -match ' ((?:\r\n|[\r\n]) *)\S' ) {" $ ( ${*t}.TrimEnd ().Replace($matches [1 ], " `n " )) `n " } else {${*t} }) }"
519- Write-Build 8 " cd $global :pwd "
519+ print 3 " exec {$ ( if (${*t} -match ' ((?:\r\n|[\r\n]) *)\S' ) {" $ ( ${*t}.TrimEnd ().Replace($matches [1 ], " `n " )) `n " } else {${*t} }) }"
520+ print 8 " cd $global :pwd "
520521 foreach (${*v} in ${*c}.Ast.FindAll ({$args [0 ] -is [System.Management.Automation.Language.VariableExpressionAst ]}, $true )) {
521522 ${*p} = ${*v}.Parent
522523 if (${*p} -is [System.Management.Automation.Language.MemberExpressionAst ]) {
@@ -525,14 +526,14 @@ function *Echo {
525526 }
526527 if (${*v}.Parent -isnot [System.Management.Automation.Language.AssignmentStatementAst ]) {
527528 ${*t} = " ${*v} " -replace ' ^@' , ' $'
528- Write-Build 8 " ${*t} : $ ( & ([scriptblock ]::Create(${*t} ))) "
529+ print 8 " ${*t} : $ ( & ([scriptblock ]::Create(${*t} ))) "
529530 }
530531 }
531532}
532533
533534function * Err($T ) {
534535 ${*}.Errors.Add ([PSCustomObject ]@ {Error = $_ ; File = $BuildFile ; Task = $T })
535- Write-Build 12 " ERROR: $ ( if (* My) {$_ } else {* Msg $_ $_ }) "
536+ print 12 " ERROR: $ ( if (* My) {$_ } else {* Msg $_ $_ }) "
536537 if ($T ) {$T.Error = $_ }
537538}
538539
@@ -639,7 +640,7 @@ function *Task {
639640 New-Variable Task (${*}.Task = ${*}.All [${*n} ]) - Option Constant
640641
641642 if ($Task.Elapsed ) {
642- Write-Build 8 " Done ${*p} "
643+ print 8 " Done ${*p} "
643644 return
644645 }
645646
@@ -652,14 +653,14 @@ function *Task {
652653 }
653654 catch {
654655 * Err $Task
655- Write-Build 8 (* At $Task )
656+ print 8 (* At $Task )
656657 ${*}.Tasks.Add ($Task )
657658 $Task.Elapsed = [TimeSpan ]::Zero
658659 throw
659660 }
660661 }
661662 if (! ${*x} ) {
662- Write-Build 8 " Task ${*p} skipped."
663+ print 8 " Task ${*p} skipped."
663664 return
664665 }
665666
@@ -687,7 +688,7 @@ function *Task {
687688 * Err $Task
688689 throw
689690 }
690- Write-Build 8 ${*i} [1 ]
691+ print 8 ${*i} [1 ]
691692 }
692693 if (${*i} [0 ]) {
693694 continue
@@ -716,7 +717,7 @@ function *Task {
716717 }
717718 catch {
718719 * Err $Task
719- Write-Build 8 (* At $Task )
720+ print 8 (* At $Task )
720721 throw
721722 }
722723 finally {
@@ -828,9 +829,9 @@ try {
828829 exit
829830 }
830831
831- Write-Build 11 " Build $ ( $BuildTask -join ' , ' ) $BuildFile "
832+ print 11 " Build $ ( $BuildTask -join ' , ' ) $BuildFile "
832833 foreach ($_ in ${*}.Redefined ) {
833- if (($_ = $_.Name ) -ne ' .' ) {Write-Build 8 " Redefined task '$_ '." }
834+ if (($_ = $_.Name ) -ne ' .' ) {print 8 " Redefined task '$_ '." }
834835 }
835836 foreach ($_ in ${*}.Doubles ) {
836837 if (${*}.All [$_ [1 ]].If -isnot [scriptblock ]) {
@@ -882,18 +883,18 @@ finally {
882883 $t = ${*}.Tasks
883884 $e = ${*}.Errors
884885 if (${*}.Summary ) {
885- Write-Build 11 ' Build summary:'
886+ print 11 ' Build summary:'
886887 foreach ($_ in $t ) {
887888 ' {0,-16} {1} - {2}:{3}' -f $_.Elapsed , $_.Name , $_.InvocationInfo.ScriptName , $_.InvocationInfo.ScriptLineNumber
888889 if ($_ = $_.Error ) {
889- Write-Build 12 " ERROR: $ ( if (* My) {$_ } else {* Msg $_ $_ }) "
890+ print 12 " ERROR: $ ( if (* My) {$_ } else {* Msg $_ $_ }) "
890891 }
891892 }
892893 }
893894 if ($w = ${*}.Warnings ) {
894895 foreach ($_ in $w ) {
895896 " WARNING: $ ( if ($_.Task ) {" /$ ( $_.Task.Name ) " }) $ ( $_.InvocationInfo.ScriptName ) :$ ( $_.InvocationInfo.ScriptLineNumber ) "
896- Write-Build 14 $_.Message
897+ print 14 $_.Message
897898 }
898899 }
899900 if ($_ = ${*}.P ) {
@@ -906,7 +907,7 @@ finally {
906907 elseif ($e ) {14 , ' Build completed with errors' }
907908 elseif ($w ) {14 , ' Build succeeded with warnings' }
908909 else {10 , ' Build succeeded' }
909- Write-Build $c " $m . $ ( $t.Count ) tasks, $ ( $e.Count ) errors, $ ( $w.Count ) warnings $ ( (${*}.Elapsed = [DateTime ]::Now - ${*}.Started )) "
910+ print $c " $m . $ ( $t.Count ) tasks, $ ( $e.Count ) errors, $ ( $w.Count ) warnings $ ( (${*}.Elapsed = [DateTime ]::Now - ${*}.Started )) "
910911 }
911912}
912913}
0 commit comments