build\build.ps1: removed dependency on Compile task from Test task
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/fd57cc34 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/fd57cc34 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/fd57cc34 Branch: refs/heads/api-work Commit: fd57cc349d406b4090b11adf635a4b98c3ae5201 Parents: 68f82ea Author: Shad Storhaug <[email protected]> Authored: Thu Apr 13 07:24:07 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Apr 13 07:24:07 2017 +0700 ---------------------------------------------------------------------- build.bat | 4 +-- build/build.ps1 | 75 ++++++++++++++++++++++++---------------------------- 2 files changed, 36 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd57cc34/build.bat ---------------------------------------------------------------------- diff --git a/build.bat b/build.bat index ef7e0df..297314d 100644 --- a/build.bat +++ b/build.bat @@ -92,10 +92,10 @@ FOR %%a IN (%*) DO ( ) ) +powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -properties @{\"version\"=\"%version%\";\"configuration\"=\"%configuration%"\";\"packageVersion\"=\"%PackageVersion%"\"} }" + if "!runtests!"=="true" ( powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -task Test -properties @{\"version\"=\"%version%\";\"configuration\"=\"%configuration%"\";\"packageVersion\"=\"%PackageVersion%"\"} }" -) else ( - powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -properties @{\"version\"=\"%version%\";\"configuration\"=\"%configuration%"\";\"packageVersion\"=\"%PackageVersion%"\"} }" ) endlocal \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fd57cc34/build/build.ps1 ---------------------------------------------------------------------- diff --git a/build/build.ps1 b/build/build.ps1 index df9e732..9f4c2ce 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -103,62 +103,55 @@ task Pack -depends Compile -description "This task creates the NuGet packages" { } } -task Test -depends Compile -description "This task runs the tests" { - try { - Write-Host "Running tests..." -ForegroundColor DarkCyan - - pushd $base_directory - $testProjects = Get-ChildItem -Path "project.json" -Recurse | ? { $_.Directory.Name.Contains(".Tests") } - popd +task Test -description "This task runs the tests" { + Write-Host "Running tests..." -ForegroundColor DarkCyan - Write-Host "frameworks_to_test: $frameworks_to_test" -ForegroundColor Yellow + pushd $base_directory + $testProjects = Get-ChildItem -Path "project.json" -Recurse | ? { $_.Directory.Name.Contains(".Tests") } + popd - $frameworksToTest = $frameworks_to_test -split "\s*?,\s*?" + Write-Host "frameworks_to_test: $frameworks_to_test" -ForegroundColor Yellow - foreach ($framework in $frameworksToTest) { - Write-Host "Framework: $framework" -ForegroundColor Blue + $frameworksToTest = $frameworks_to_test -split "\s*?,\s*?" - foreach ($testProject in $testProjects) { + foreach ($framework in $frameworksToTest) { + Write-Host "Framework: $framework" -ForegroundColor Blue - $testName = $testProject.Directory.Name - $projectDirectory = $testProject.DirectoryName - Write-Host "Directory: $projectDirectory" -ForegroundColor Green + foreach ($testProject in $testProjects) { - if ($framework.StartsWith("netcore")) { - $testExpression = "dotnet.exe test '$projectDirectory\project.json' --configuration $configuration --no-build" - } else { - $binaryRoot = "$projectDirectory\bin\$configuration\$framework" + $testName = $testProject.Directory.Name + $projectDirectory = $testProject.DirectoryName + Write-Host "Directory: $projectDirectory" -ForegroundColor Green - $testBinary = "$binaryRoot\win7-x64\$testName.dll" - if (-not (Test-Path $testBinary)) { - $testBinary = "$binaryRoot\win7-x32\$testName.dll" - } - if (-not (Test-Path $testBinary)) { - $testBinary = "$binaryRoot\$testName.dll" - } + if ($framework.StartsWith("netcore")) { + $testExpression = "dotnet.exe test '$projectDirectory\project.json' --configuration $configuration --no-build" + } else { + $binaryRoot = "$projectDirectory\bin\$configuration\$framework" - $testExpression = "$tools_directory\NUnit\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe $testBinary" + $testBinary = "$binaryRoot\win7-x64\$testName.dll" + if (-not (Test-Path $testBinary)) { + $testBinary = "$binaryRoot\win7-x32\$testName.dll" } + if (-not (Test-Path $testBinary)) { + $testBinary = "$binaryRoot\$testName.dll" + } - #$testResultDirectory = "$test_results_directory\$framework\$testName" - #Ensure-Directory-Exists $testResultDirectory - - $testExpression = "$testExpression --result:$projectDirectory\TestResult.xml" + $testExpression = "$tools_directory\NUnit\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe $testBinary" + } - if ($where -ne $null -and (-Not [System.String]::IsNullOrEmpty($where))) { - $testExpression = "$testExpression --where $where" - } + #$testResultDirectory = "$test_results_directory\$framework\$testName" + #Ensure-Directory-Exists $testResultDirectory - Write-Host $testExpression -ForegroundColor Magenta + $testExpression = "$testExpression --result:$projectDirectory\TestResult.xml" - Invoke-Expression $testExpression + if ($where -ne $null -and (-Not [System.String]::IsNullOrEmpty($where))) { + $testExpression = "$testExpression --where $where" } + + Write-Host $testExpression -ForegroundColor Magenta + + Invoke-Expression $testExpression } - $success = $true - } finally { - #if ($success -ne $true) { - Restore-Files $backedUpFiles - #} } }
