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 6D09E200C5F for ; Sun, 23 Apr 2017 12:10:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6BB85160B8E; Sun, 23 Apr 2017 10:10:08 +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 57075160BB8 for ; Sun, 23 Apr 2017 12:10:07 +0200 (CEST) Received: (qmail 56409 invoked by uid 500); 23 Apr 2017 10:10:06 -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 56324 invoked by uid 99); 23 Apr 2017 10:10:06 -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, 23 Apr 2017 10:10:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 31883E178A; Sun, 23 Apr 2017 10:10:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Sun, 23 Apr 2017 10:10:12 -0000 Message-Id: <3d394d51fb324a279f1befc5fd4b30ea@git.apache.org> In-Reply-To: <2c3aeb7e2888480daed0af9562c6cd09@git.apache.org> References: <2c3aeb7e2888480daed0af9562c6cd09@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [7/7] lucenenet git commit: Deleted runbuild.ps1 archived-at: Sun, 23 Apr 2017 10:10:08 -0000 Deleted runbuild.ps1 Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a340497b Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a340497b Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a340497b Branch: refs/heads/api-work Commit: a340497b5a38a1bf67754ce3d43eea8ce9c25320 Parents: fe590e8 Author: Shad Storhaug Authored: Sun Apr 23 16:46:50 2017 +0700 Committer: Shad Storhaug Committed: Sun Apr 23 16:46:50 2017 +0700 ---------------------------------------------------------------------- runbuild.ps1 | 456 ------------------------------------------------------ 1 file changed, 456 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a340497b/runbuild.ps1 ---------------------------------------------------------------------- diff --git a/runbuild.ps1 b/runbuild.ps1 deleted file mode 100644 index 7e556c0..0000000 --- a/runbuild.ps1 +++ /dev/null @@ -1,456 +0,0 @@ -<# -.SYNOPSIS - Builds, runs, packages and uploads packages for Lucene.NET's .NET Core libraries - -.PARAMETER NuGetSource - URI to upload NuGet packages to. Required for uploading NuGet packages -.PARAMETER NuGetApiKey - API Key used to upload package to NuGet source. Required for uploading NuGet packages - -.PARAMETER CreatePackages - Create NuGet packages -.PARAMETER UploadPackages - Upload NuGet packages -.PARAMETER RunTests - Run all test libraries - -.PARAMETER Configuration - Runs scripts with either Debug or Release configuration - -.PARAMETER ProjectsToTest - An array of project names to test. (ie. @("Lucene.Net.Tests", "Lucene.Net.Tests.Codecs")) -.PARAMETER ExcludeTestCategories - An array of test categories to exclude in test runs. Default is $null (don't exclude anything). - -.PARAMETER FrameworksToTest - An array of frameworks to run tests against. Default is "net451" and "netcoreapp1.0" - -.PARAMETER Quiet - Silence output. Useful for piping Test output into a log file instead of to console. - -.PARAMETER TestResultsDirectory - Directory for NUnit TestResults. Default is $PSScriptRoot\release\TestResults -.PARAMETER NuGetPackageDirectory - Directory for generated NuGet packages. Default is $PSScriptRoot\release\NuGetPackages - -.PARAMETER Version - Version of the assembly (no pre-release tag). Default is 0.0.0 (indicating to parse the value from PackageVersion). -.PARAMETER PackageVersion - Version of the NuGet Package (including the pre-release tag). Default is 4.8.0. - -.PARAMETER AssemblyInfoFile - Path to the common assembly info file. Default is PSScriptRoot\src\CommonAssemblyInfo.cs -.PARAMETER CopyrightYear - The end year that will be on the copyright. Default is the current year on the system. -.PARAMETER Copyright - The copyright message that will be applied to AssemblyCopyrightAttribute and AssemblyTrademarkAttribute. - The default is "Copyright 2006 - $CopyrightYear The Apache Software Foundation". -.PARAMETER ProductName - The value that will be used for the ProductNameAttribute. Default is "Lucene.Net". - -.EXAMPLE - runbuild.ps1 -Configuration "Debug" -RunTests -Quiet - - Build all .NET Core projects as Debug and run all tests. Tests are run - against "net451" and "netcoreapp1.0" frameworks and excludes - "LongRunningTests". All output for tests is piped into an output.log and - then placed in the $TestResultsDirectory. -.EXAMPLE - runbuild.ps1 -CreatePackages - - Creates NuGet packages for .NET Core projects compiled as Release. -.EXAMPLE - runbuild.ps1 "http://myget.org/conniey/F/lucenenet-feed" "0000-0000-0000" - - Creates and uploads NuGet packages for .NET Core projects compiled as - Release. Uploads projects to "http://myget.org/conniey/F/lucenenet-feed". -.EXAMPLE - runbuild.ps1 -RunTests -ExcludeTestCategoriesNetCore @("HasTimeout", "LongRunningTest") -FrameworksToTest @("netcoreapp1.0") - - Build all .NET Core projects as Release and run all tests. Tests are run - against "netcoreapp1.0" frameworks and excludes "HasTimeout" and - "LongRunningTest". - -.EXAMPLE - runbuild.ps1 -ProjectsToTest @("Lucene.Net.Tests") -RunTests - - Builds all .NET Core projects as Release and runs the test project Lucene.Net.Tests. -#> - -[CmdletBinding(DefaultParameterSetName="Default")] -param( - [Parameter(Mandatory = $true, Position = 0, ParameterSetName="UploadPackages")] - [string]$NuGetSource, - [Parameter(Mandatory = $true, Position = 1, ParameterSetName="UploadPackages")] - [string]$NuGetApiKey, - - [Parameter(Mandatory = $true, ParameterSetName="CreatePackages")] - [switch]$CreatePackages, - [Parameter(Mandatory = $true, ParameterSetName="UploadPackages")] - [switch]$UploadPackages, - [switch]$RunTests, - - [ValidateSet("Debug", "Release")] - [string]$Configuration = "Release", - - [string[]]$ProjectsToTest, - [string[]]$ExcludeTestCategories, - [string[]]$FrameworksToTest = @("netcoreapp1.0"), - - [switch]$Quiet, - [string]$TestResultsDirectory, - [string]$NuGetPackageDirectory, - - [string]$PackageVersion = "4.8.0", - [string]$Version = "0.0.0", - - [string]$AssemblyInfoFile = "$PSScriptRoot\src\CommonAssemblyInfo.cs", - [string]$CopyrightYear = [DateTime]::Today.Year.ToString(), #Get the current year from the system - [string]$Copyright = "Copyright 2006 - $CopyrightYear The Apache Software Foundation", - [string]$CompanyName = "The Apache Software Foundation", - [string]$ProductName = "Lucene.Net" -) - -#Get the current working directory -$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition - -$root = $PSScriptRoot - -#Release directory for all build assets -$ReleaseDirectory = Join-Path $root "release" -$defaultNugetPackageDirectory = Join-Path $ReleaseDirectory "NuGetPackages" -$defaultTestResultsDirectory = Join-Path $ReleaseDirectory "TestResults" - -if ([string]::IsNullOrEmpty($NuGetPackageDirectory)) { - $NuGetPackageDirectory = $defaultNugetPackageDirectory -} - -if ([string]::IsNullOrEmpty($TestResultsDirectory)) { - $TestResultsDirectory = $defaultTestResultsDirectory -} - -#If version is not passed in, parse it from $PackageVersion -if ($Version -eq "0.0.0" -or [string]::IsNullOrEmpty($Version)) { - $Version = $PackageVersion - if ($Version.Contains("-") -eq $true) { - $Version = $Version.SubString(0, $Version.IndexOf("-")) - } -} - -function Ensure-Directory-Exists([string] $path) -{ - if (!(Test-Path $path)) { - New-Item $path -ItemType Directory - } -} - -function Generate-Assembly-Info { -param( - [string]$product, - [string]$company, - [string]$copyright, - [string]$version, - [string]$packageVersion, - [string]$file = $(throw "file is a required parameter.") -) - #Use only the major version as the assembly version. - #This ensures binary compatibility unless the major version changes. - $version-match "(^\d+)" - $AssemblyVersion = $Matches[0] - $AssemblyVersion = "$AssemblyVersion.0.0" - - $asmInfo = "using System; -using System.Reflection; - -[assembly: AssemblyProduct(""$product"")] -[assembly: AssemblyCompany(""$company"")] -[assembly: AssemblyTrademark(""$copyright"")] -[assembly: AssemblyCopyright(""$copyright"")] -[assembly: AssemblyVersion(""$AssemblyVersion"")] -[assembly: AssemblyFileVersion(""$version"")] -[assembly: AssemblyInformationalVersion(""$packageVersion"")] -" - $dir = [System.IO.Path]::GetDirectoryName($file) - Ensure-Directory-Exists $dir - - Write-Host "Generating assembly info file: $file" - Out-File -filePath $file -encoding UTF8 -inputObject $asmInfo -} - -function Backup-Assembly-Info() { - Move-Item $AssemblyInfoFile "$AssemblyInfoFile.bak" -Force -} - -function Restore-Assembly-Info() { - if (Test-Path "$AssemblyInfoFile.bak") { - Move-Item "$AssemblyInfoFile.bak" $AssemblyInfoFile -Force - } -} - -function Update-Constants-Version([string]$version) { - $constantsFile = "$root\src\Lucene.Net\Util\Constants.cs" - (Get-Content $constantsFile) | % { - $_-replace "(?<=LUCENE_VERSION\s*?=\s*?"")([^""]*)", $version - } | Set-Content $constantsFile -Force -} - -if (Test-Path $ReleaseDirectory) { - Write-Host "Removing old build assets..." - - Remove-Item $ReleaseDirectory -Recurse -Force -} -Ensure-Directory-Exists $ReleaseDirectory - -function Compile-Projects($projects) { - - try { - Backup-Assembly-Info - - Generate-Assembly-Info ` - -product $ProductName ` - -company $CompanyName ` - -copyright $Copyright ` - -version $Version ` - -packageVersion $PackageVersion ` - -file $AssemblyInfoFile - - Update-Constants-Version $PackageVersion - - foreach ($project in $projects) { - pushd $project.DirectoryName - - & dotnet.exe build --configuration $Configuration - - popd - } - } finally { - Restore-Assembly-Info - } -} - -function Generate-ExcludeCategoryString ($categories) { - $contents = "" - - if ($categories -ne $null -and $categories.Count -gt 0) { - foreach ($category in $categories) { - $formatted = [String]::Format("Category!={0}", $category); - - if ([string]::IsNullOrEmpty($contents)) { - $contents = "--where=""$formatted" - } else { - $contents += " && $formatted" - } - } - - $contents += '"' - } - - return $contents -} - -function Test-Projects($projects) { - - if (Test-Path $TestResultsDirectory) { - Write-Host "Removing old test results..." - - Remove-Item $TestResultsDirectory -Recurse -Force - } - - Ensure-Directory-Exists $TestResultsDirectory - - # Setting the preference so that we can run all the tests regardless of - # errors that may happen. - $oldPreference = $ErrorActionPreference - $ErrorActionPreference = "Continue" - - # Generate the string to exclude categories from being tested - $excludeCategories = Generate-ExcludeCategoryString $ExcludeTestCategories - - foreach ($project in $projects) { - - pushd $project.DirectoryName - - $testName = $project.Directory.Name - $testFolder = Join-Path $TestResultsDirectory $testName - - New-Item $testFolder -ItemType Directory | Out-Null - - foreach ($framework in $FrameworksToTest) { - Write-Host "Testing [$testName] on [$framework]..." - - $testResult = "TestResult.$framework.xml" - - if ($framework.StartsWith("netcore")) { - $testExpression = "dotnet.exe test --configuration $Configuration --framework $framework --no-build $excludeCategories" - } else { - $projectDirectory = $project.DirectoryName - - $testBinary = "$projectDirectory\bin\$Configuration\$framework\win7-x64\$testName.dll" - if (-not (Test-Path $testBinary)) { - $testBinary = "$projectDirectory\bin\$Configuration\$framework\win7-x32\$testName.dll" - } - if (-not (Test-Path $testBinary)) { - $testBinary = "$projectDirectory\bin\$Configuration\$framework\$testName.dll" - } - - $testExpression = "$root\lib\NUnit\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe $testBinary $excludeCategories" - } - - Write-Host $testExpression -ForegroundColor Magenta - - if ($Quiet) { - $outputLog = "output.$framework.log" - - Invoke-Expression $testExpression | Set-Content $outputLog - Move-Item $outputLog $testFolder\ - } else { - Invoke-Expression $testExpression - } - - if (Test-Path ".\TestResult.xml") { - Copy-Item ".\TestResult.xml" $(Join-Path $testFolder $testResult) - } else { - Write-Warning "Could not find TestResult.xml." - } - } - - popd - } - - $ErrorActionPreference = $oldPreference -} - -# Gets the description from the AssemblyDescriptionAttribute -function Get-Assembly-Description($project) { - #project path has a project.json file, we need the path without it - $dir = [System.IO.Path]::GetDirectoryName($project).TrimEnd([System.IO.Path]::DirectorySeparatorChar) - $projectName = [System.IO.Path]::GetFileName($dir) - $projectAssemblyPath = "$dir\bin\$Configuration\net451\$projectName.dll" - - $assembly = [Reflection.Assembly]::ReflectionOnlyLoadFrom($projectAssemblyPath) - $descriptionAttributes = [reflection.customattributedata]::GetCustomAttributes($assembly) | Where-Object {$_.AttributeType -like "System.Reflection.AssemblyDescriptionAttribute"} - - if ($descriptionAttributes.Length -gt 0) { - $descriptionAttributes[0].ToString()-match "(?<=\[System.Reflection.AssemblyDescriptionAttribute\("")([^""]*)" | Out-Null - return $Matches[0] - } -} - -function Create-NuGetPackages($projects) { - - if (Test-Path $NuGetPackageDirectory) { - Write-Host "Removing old NuGet packages..." - - Remove-Item $NuGetPackageDirectory -Recurse -Force - } - - Ensure-Directory-Exists $NuGetPackageDirectory - - foreach ($project in $projects) { - pushd $project.DirectoryName - - # Update the packOptions.summary with the value from AssemblyDescriptionAttribute - $assemblyDescription = Get-Assembly-Description $project - Write-Host "Updating package description with '$assemblyDescription'" -ForegroundColor Yellow - - (Get-Content $project) | % { - $_-replace "(?<=""summary""\s*?:\s*?"")([^""]*)", $assemblyDescription - } | Set-Content $project -Force - - Write-Host "Creating NuGet package for $project..." -ForegroundColor Magenta - - & dotnet.exe pack --configuration $Configuration --output $NuGetPackageDirectory --no-build - - popd - } - - return $NuGetPackageDirectory -} - -function Upload-NuGetPackages { - $NuGetExe = & "$root\lib\Nuget\Get-NuGet.ps1" - - $packagesToUpload = Get-ChildItem $NuGetPackageDirectory | ? { $_.Extension.Equals(".nupkg") -and !$_.BaseName.Contains(".symbols") } - - foreach ($package in $packagesToUpload) { - - Write-Host "Uploading $($package)..." - - Invoke-Expression "$NuGetExe push $($package.FullName) -ApiKey $NuGetApiKey -Source $NuGetSource" - } -} - -& where.exe dotnet.exe - -if ($LASTEXITCODE -ne 0) { - Write-Error "Could not find .NET CLI in PATH. Please install it." -} - -& dotnet.exe --version - -# Stopping script if any errors occur -$ErrorActionPreference = "Stop" - -$projectJsons = Get-ChildItem -Path "project.json" -Recurse - -try { - - foreach ($projectJson in $projectJsons) { - #Backup the project.json file - Copy-Item $projectJson "$projectJson.bak" -Force - - Write-Host "Updating project.json: $projectJson" -ForegroundColor Cyan - - #Update version (for NuGet package) and dependency version of this project's inter-dependencies - (Get-Content $projectJson) | % { - $_-replace "(?<=""Lucene.Net[\w\.]*?""\s*?:\s*?"")([^""]+)", $PackageVersion - } | Set-Content $projectJson -Force - - $json = (Get-Content $projectJson -Raw) | ConvertFrom-Json - $json.version = $PackageVersion - $json | ConvertTo-Json -depth 100 | Out-File $projectJson -encoding UTF8 -Force - } - - & dotnet.exe restore - - Compile-Projects $projectJsons - - if ($RunTests) { - Write-Host "Running tests..." - - if ($ProjectsToTest -ne $null -and $ProjectsToTest.Count -gt 0) { - $testProjects = $projectJsons | ? { $ProjectsToTest.Contains($_.Directory.Name) } - - if (@($testProjects).Count -eq 0) { - Write-Warning "Could not find any test projects matching the given ProjectsToTest. No tests run." - } - } else { - $testProjects = $projectJsons | ? { $_.Directory.Name.Contains(".Tests") } - } - - Test-Projects $testProjects - } - - if ($CreatePackages -or $UploadPackages) { - Write-Host "Creating NuGet packages..." - - $projectsToPackage = $projectJsons | ? { !$_.Directory.Name.Contains(".Test") } - Create-NuGetPackages $projectsToPackage - } - -} finally { - #Restore the project.json files - foreach ($projectJson in $projectJsons) { - if (Test-Path "$projectJson.bak") { - Move-Item "$projectJson.bak" $projectJson -Force - } - } -} - -if ($UploadPackages) { - - Write-Host "Uploading NuGet packages..." - - Upload-NuGetPackages -} -