Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3DA86200D06 for ; Sun, 10 Sep 2017 22:38:51 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3C3C51609B9; Sun, 10 Sep 2017 20:38:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5A5991609BD for ; Sun, 10 Sep 2017 22:38:50 +0200 (CEST) Received: (qmail 31847 invoked by uid 500); 10 Sep 2017 20:38:49 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 31833 invoked by uid 99); 10 Sep 2017 20:38:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Sep 2017 20:38:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 400B9E361C; Sun, 10 Sep 2017 20:38:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Sun, 10 Sep 2017 20:38:49 -0000 Message-Id: <3d41d98249ab499b9c0ccff3f3a8b0fa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] lucenenet git commit: build/build.ps1: Broke the installation step for .NET Core 1.0.4 SDK to a separate task and added a check whether it exists before installing archived-at: Sun, 10 Sep 2017 20:38:51 -0000 Repository: lucenenet Updated Branches: refs/heads/master af1f201ef -> 60e812525 build/build.ps1: Broke the installation step for .NET Core 1.0.4 SDK to a separate task and added a check whether it exists before installing Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/aaf81eab Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/aaf81eab Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/aaf81eab Branch: refs/heads/master Commit: aaf81eab6fb7fe834ca7f4fcb896cb328f4cc763 Parents: af1f201 Author: Shad Storhaug Authored: Mon Sep 11 02:33:03 2017 +0700 Committer: Shad Storhaug Committed: Mon Sep 11 03:34:34 2017 +0700 ---------------------------------------------------------------------- build/build.ps1 | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/aaf81eab/build/build.ps1 ---------------------------------------------------------------------- diff --git a/build/build.ps1 b/build/build.ps1 index d4dbbab..bde695d 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -26,6 +26,7 @@ properties { [string]$test_results_directory = "$release_directory\TestResults" [string]$solutionFile = "$base_directory\Lucene.Net.sln" [string]$versionFile = "$base_directory\Version.proj" + [string]$sdkPath = "$env:programfiles/dotnet/sdk" [string]$buildCounter = $(if ($buildCounter) { $buildCounter } else { $env:BuildCounter }) #NOTE: Pass in as a parameter (not a property) or environment variable to override [string]$preReleaseCounterPattern = $(if ($preReleaseCounterPattern) { $preReleaseCounterPattern } else { if ($env:PreReleaseCounterPattern) { $env:PreReleaseCounterPattern } else { "00000" } }) #NOTE: Pass in as a parameter (not a property) or environment variable to override @@ -58,27 +59,19 @@ task Clean -description "This task cleans up the build directory" { Get-ChildItem $base_directory -Include *.bak -Recurse | foreach ($_) {Remove-Item $_.FullName} } -task InstallSDK -description "This task makes sure the correct SDK version is installed" { +task InstallSDK2 -description "This task makes sure the correct SDK version is installed to build and run .NET Core 2.0 tests" { & where.exe dotnet.exe - $sdkVersion = "" + $sdkVersion = [version]"0.0.0.0" if ($LASTEXITCODE -eq 0) { - $sdkVersion = ((& dotnet.exe --version) | Out-String).Trim() + $sdkVersion = [version][string]((& dotnet.exe --version) | Out-String).Trim() } - - Write-Host "Current SDK version: $sdkVersion" -ForegroundColor Yellow - # Make sure framework for .NET Core 1.0.4 is available - if (!$sdkVersion.Equals("1.0.4")) { - Write-Host "Require SDK version 1.0.4, installing..." -ForegroundColor Red - #Install the correct version of the .NET SDK for this build - Invoke-Expression "$base_directory\build\dotnet-install.ps1 -Version 1.0.4" - } + Write-Host "Current SDK version: $sdkVersion" -ForegroundColor Yellow # Make sure framework for .NET Core 2.0.0 is available - if (!$sdkVersion.Equals("2.0.0")) { - Write-Host "Require SDK version 2.0.0, installing..." -ForegroundColor Red - #Install the correct version of the .NET SDK for this build + if (($sdkVersion -lt ([version]"2.0.0")) -or ($sdkVersion -ge ([version]"3.0.0"))) { + Write-Host "Requires SDK version 2.0.0 or greater, installing..." -ForegroundColor Red Invoke-Expression "$base_directory\build\dotnet-install.ps1 -Version 2.0.0" } @@ -90,7 +83,24 @@ task InstallSDK -description "This task makes sure the correct SDK version is in } } -task Init -depends InstallSDK -description "This task makes sure the build environment is correctly setup" { +task InstallSDK1IfRequired -description "This task installs the .NET Core 1.x SDK (required for testing under .NET Core 1.0)" { + if ($frameworks_to_test.Contains("netcoreapp1.")) { + # Make sure framework for .NET Core 1.0.4 is available + if ((Test-Path "$sdkPath/1.0.4" -eq $false) -and (Test-Path "$sdkPath/1.1.0" -eq $false)) { + Write-Host "Requires SDK version 1.0.4, installing..." -ForegroundColor Red + Invoke-Expression "$base_directory\build\dotnet-install.ps1 -Version 1.0.4" + } + + # Safety check - this should never happen + & where.exe dotnet.exe + + if ($LASTEXITCODE -ne 0) { + throw "Could not find dotnet CLI in PATH. Please install the .NET Core 1.0.4 SDK." + } + } +} + +task Init -depends InstallSDK2 -description "This task makes sure the build environment is correctly setup" { #Update TeamCity or MyGet with packageVersion Write-Output "##teamcity[buildNumber '$packageVersion']" Write-Output "##myget[buildNumber '$packageVersion']" @@ -189,7 +199,7 @@ task Pack -depends Compile -description "This task creates the NuGet packages" { } } -task Test -depends InstallSDK, Restore -description "This task runs the tests" { +task Test -depends InstallSDK1IfRequired, Restore -description "This task runs the tests" { Write-Host "Running tests..." -ForegroundColor DarkCyan pushd $base_directory @@ -205,10 +215,10 @@ task Test -depends InstallSDK, Restore -description "This task runs the tests" { foreach ($testProject in $testProjects) { $testName = $testProject.Directory.Name - $testExpression = "dotnet.exe test '$testProject' --configuration $configuration --framework $framework --no-build" + $testExpression = "dotnet.exe test '$testProject' --configuration $configuration --framework $framework --no-restore --no-build" $testResultDirectory = "$test_results_directory\$framework\$testName" - #Ensure-Directory-Exists $testResultDirectory + Ensure-Directory-Exists $testResultDirectory $testExpression = "$testExpression --results-directory $testResultDirectory\TestResult.xml" @@ -445,8 +455,7 @@ function Restore-File([string]$path) { } } -function Ensure-Directory-Exists([string] $path) -{ +function Ensure-Directory-Exists([string] $path) { if (!(Test-Path $path)) { New-Item $path -ItemType Directory }